FlexSEA Wiki

A WEARABLE ROBOTICS TOOLKIT

User Tools

Site Tools


pythonscripts

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pythonscripts [2020/02/07 21:06] (current)
rqurashi created
Line 1: Line 1:
 +====== Python Interface ======
 +
 +This document describes the Python 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 4 and Ubuntu 18 64 bits. They do not seem to work with Python 3.8.1 on Windows.
 +
 +The code is available at [[https://​github.com/​DephyInc/​Actuator-Package/​tree/​develop|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 [[fx_plan_stack_api|here]].
 +
 +=====Converting from Python interface 2.0=====
 +The new python interface addresses some short comings of the [[pythonscripts2|previous version]]. As the Python interface 2.0 is no longer supported, here is how to [[interface_conversion_3_to_4|port your existing code]].
 +
 +=====Quick Start=====
 +
 +If you have not already setup up your Actuator Package, please read the [[dephyactpack#​Quick Start Guide|ActPack'​s quick start guide]]. ​
 +
 +Ready to get started? Try running a [[demodescriptions|demo script]]:
 +
 +  - Make sure your device has recent firmware
 +    - At a minimum it has to be newer than August 2018
 +    - We recommend using the latest from the Release page
 +  - Clone the repo :<​code>​ git clone --recursive https://​github.com/​DephyInc/​Actuator-Package.git </​code>​
 +  - Copy ''​Actuator-Package/​Python/​flexseapython/​com_template.txt''​ to a file named ''​Actuator-Package/​Python/​flexseapython/​com.txt''​
 +    - 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.
 +    - The second line is the port name (ex.: COM5 or /​dev/​ttyACM0)
 +    - If connecting to more than one device you can add additional port names each on a new line
 +  - Plug in and turn on the device. If you are using Windows make sure that you have the [[stm32driver|STM32 Virtual Com Port Driver]] installed.
 +  - From a cmd window or terminal, run the Actuator-Package/​Python/​fxMain.py script in Python <​code>​python fxMain.py</​code>​
 +  - Enter the experiment number. Be careful, most of them will make the motor move!
 +
 +{{ :​pythonscripts.png |}}
 +=====Matplotlib=====
 +
 +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).
 +
 +=====Notes=====
 +  * If you encounter problems with the DLLs, here are some [[generalhints|useful tips]].
 +  * If your device has never had poles configured, you should run "find poles" from the demo script before trying other demos
 +
 +
  
pythonscripts.txt ยท Last modified: 2020/02/07 21:06 by rqurashi