Skip to main content

PyFlexMotion

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 versioned *.toml motor configuration files.

Have a look at the example configurations in flex_motion/example_configurations.

Installing

pip install flex_motion should work, but I recommend git clone followed by pip install -e . until I work out how to compile for other platforms.

Getting Started

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..

System Requirements

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 setting the CONDA_FORCE_32BIT flag.

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 compile_flex_motion.py in the interpreter you created. That should do it!

General Advice

  1. 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.
  2. Double check electrical connections before working on motion software.
  3. Double check your configuration before running software.
  4. 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.

Metadata

Release files for flex-motion 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flex-motion 0.0.1
File Size Uploaded
flex_motion-0.0.1.tar.gz 303.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flex-motion 0.0.1
File Interpreter ABI Platform
flex_motion-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 617.7 kB

Release files / flex_motion-0.0.1.tar.gz

Download URL flex_motion-0.0.1.tar.gz
Size 303.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ecead7bfd8e61439ea6049546c2613add25765b268a36da5424cdd122e4ce086
BLAKE2b-256 checksum
How to use checksums
8bfe7bffea7ec9f2baed6dc39dbb278eb9845ee01324ae76c62790ac0bffc7aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0.post20200106 requests-toolbelt/0.8.0 tqdm/4.40.2 CPython/3.7.3

Release files / flex_motion-0.0.1-py3-none-any.whl

Download URL flex_motion-0.0.1-py3-none-any.whl
Size 313.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66decf1e1bcf7d67c1d92318ae1542f1fc5573cfdc0d3cf4d2d32401a38306aa
BLAKE2b-256 checksum
How to use checksums
c9063feb85d04892cee649bea6462ffc961de1be1a083d7886e9d336cbf1ee7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0.post20200106 requests-toolbelt/0.8.0 tqdm/4.40.2 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page