FlexSEA Wiki


User Tools

Site Tools


This is an old revision of the document!

Python Interface 2.0

This document describes the Python 3 scripts that demonstrate how to control the Actuator Package. These scripts are accompanied by and are dependent upon C based libraries for both Windows (.dll) and Unix (.so). Pre-compiled libraries are provided for Windows 32 and 64 bits, RaspberryPi and Linux (Ubuntu).

These scripts are written in Python 3 and have been tested on Python version 3.7.3 and 3.6 32 bit and 64 bit (using Windows 10 Pro), as well as 32 bit Rasbian on a Raspberry Pi 3 and Ubuntu 18 64 bits. They do not seem to work with Python 3.8.1 on Windows.

The code is available at Actuator Package. This git repository contains the API, DLLs, and example scripts. The functions are documented in pyFlexsea.py. Additional documentation on the fx_plan_stack API can be found here.

Converting from Python interface 1.0

The new python interface addresses some short comings of the previous version. As the Python interface 1.0 is no longer supported, here is how to port your existing code.

Quick Start

If you have not already setup up your Actuator Package, please read the ActPack's quick start guide.

Ready to get started? Try running a demo script:

  1. Make sure your device has recent firmware
    1. At a minimum it has to be newer than August 2018
    2. We recommend using the latest from the Release page
  2. Clone the repo :
     git clone --recursive https://github.com/DephyInc/Actuator-Package.git 
  3. Copy Actuator-Package/Python/flexseapython/com_template.txt to a file named Actuator-Package/Python/flexseapython/com.txt
    1. The first line is the baud rate. If connecting over USB or Bluetooth you can ignore the baud rate, otherwise please enter your desired rate.
    2. The second line is the port name (ex.: COM5 or /dev/ttyACM0)
    3. If connecting to more than one device you can add additional port names each on a new line
  4. Plug in and turn on the device. If you are using Windows make sure that you have the STM32 Virtual Com Port Driver installed.
  5. From a cmd window or terminal, run the Actuator-Package/Python/fxMain.py script in Python
    python fxMain.py
  6. Enter the experiment number. Be careful, most of them will make the motor move!


Some of the scripts (High-speed test, Impedance, etc.) include plotting. By default we use the WebAgg engine to show the plots in a browser. The first time you use the scripts you will need to install matplotlib and tornado (via pip).


  • If you encounter problems with the DLLs, here are some useful tips.
  • If your device has never had poles configured, you should run “find poles” from the demo script before trying other demos
pythonscripts2.1579550639.txt.gz · Last modified: 2020/01/20 20:03 by rqurashi