FlexSEA Wiki

A WEARABLE ROBOTICS TOOLKIT

User Tools

Site Tools


pythonscripts2

Python Interface 2.0

This document describes Python 2/3 scripts that demonstrate how to control the FlexSEA-Rigid. These scripts are accompanied by and are dependent upon C based libraries for both Windows (.dll) and Rasbian(.so). A preliminary version of the C library for Ubuntu operating systems can be made available upon request.

These scripts are written in Python 2/3 and have been tested on Python version 3.6 32 bit and 64 bit (using Windows 10 Pro), as well as 32 bit Rasbian on a Raspberry Pi 3.

The code is available at Actuator Package. This git repository contains the API, DLLs, and example scripts. The functions are documented in pyFlexsea.py. Take a look at the Python demo scripts to see examples of the interface usage, and look here for an overview of the API functions. 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 enough firmware (later than August 2018)
  2. Clone the repo :
     git clone --recursive https://github.com/DephyInc/Actuator-Package.git 
  3. Copy the appropriate lib into the correct build folder. All prebuilt libs are found under the release folder. To get a specific version, it may be necessary to build the fx plan library from scratch. The library placement is system specific:
    • For Windows, copy release/win/libfx_plan_stack.dll to fx_plan_stack/build/win. Ensure the redistributable DLLs (libgcc_s_dw2.dll, libstdc++-6.dll, and libwinpthread-1.dll) are in the Python directory.
    • For Rasppberry Pi, copy release/raspi/libfx_plan_stack.so to fx_plan_stack/build/unix
    • For Linux, copy release/linux/libfx_plan_stack.so to fx_plan_stack/build/unix – (sorry, not released yet!)
  4. In a text editor:
    1. Open flexseapython/com.txt and configure the correct ports (ex.: COM5 or /dev/ttyACM0)
    2. If you have more than one device, use one line per COM port
  5. Plug in and turn on the device. If you are using Windows make sure that you have the STM32 Virtual Com Port Driver installed.
  6. From a cmd window or terminal, run the fxMain.py script in python

Notes

  • 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.txt · Last modified: 2019/02/14 15:40 by flabelle