Skip to main content

Python bindings around National Instruments's Flex Motion

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flex_motion-0.0.1.tar.gz (303.9 kB view details)

Uploaded Source

Built Distribution

flex_motion-0.0.1-py3-none-any.whl (313.9 kB view details)

Uploaded Python 3

File details

Details for the file flex_motion-0.0.1.tar.gz.

File metadata

  • Download URL: flex_motion-0.0.1.tar.gz
  • Upload date:
  • Size: 303.9 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for flex_motion-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ecead7bfd8e61439ea6049546c2613add25765b268a36da5424cdd122e4ce086
MD5 253163262ee8abc5048ea23db7fc048c
BLAKE2b-256 8bfe7bffea7ec9f2baed6dc39dbb278eb9845ee01324ae76c62790ac0bffc7aa

See more details on using hashes here.

File details

Details for the file flex_motion-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: flex_motion-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 313.9 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for flex_motion-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 66decf1e1bcf7d67c1d92318ae1542f1fc5573cfdc0d3cf4d2d32401a38306aa
MD5 74671825c1b9ce5511981b04646d3644
BLAKE2b-256 c9063feb85d04892cee649bea6462ffc961de1be1a083d7886e9d336cbf1ee7f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page