Python bindings around National Instruments's Flex Motion
PyFlexMotion provides Python wrapper layers around the National Instruments package Flex Motion.
API layers are provided at both low (direct API access) and high-level (Axis/Board/Object Oriented) abstractions which can be mixed.
All configuration is structured and can be specified with
*.toml motor configuration files.
Have a look at the example configurations in
pip install flex_motion should work, but I recommend
pip install -e . until I work out how to compile for other platforms.
from pathlib import Path from flex_motion import Board # build dictionary of hardware motion control boards boards = Board.from_config(Path('path/to/my/config')) # configure the board, attached trajectories, and axes boards['A'].start() # application code..
Because of library requirements, you will need to install PyFlexMotion into a 32-bit Python environment. Because of NI platform constraints, only 32 and 64-bit installations of Windows will work.
PyFlexMotion uses CFFI as the interface layer to Flex Motion and ships with the NI library files and the compiled C interface for the x86-64 CPU architecture. If you need to run on a different architecture, clone the repository and rebuild the CFFI bindings manually.
Getting 32-bit Python
If you are using Conda or Miniconda, you can ensure a 32-bit Python by
Here's how this looks on
bash and PowerShell.
$> set CONDA_FORCE_32BIT=1 $> conda create -n my_environment python=3.7 $> conda activate my_environment
In particular, you need to ensure that
CONDA_FORCE_32BIT is set also when
you activate the environment.
Rebuilding the CFFI bindings
Navigate into the
flex_motion package and run
in the interpreter you created. That should do it!
- NEVER write fresh motion software on an assembled system, test and prototype your software with motors detached so that you can avoid unnecessary hardware damage.
- Double check electrical connections before working on motion software.
- Double check your configuration before running software.
- Try basic motions in NI Motion Assistant first, to work out any quirks. You can also get much of the needed configuration from inside MAX or NI Motion Assistant.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size flex_motion-0.0.1-py3-none-any.whl (313.9 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size flex_motion-0.0.1.tar.gz (303.9 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for flex_motion-0.0.1-py3-none-any.whl