- Custom Development
This document describes the Python scripts that demonstrate how to control the Actuator Package. These scripts rely on the flexsea python library bundled with the required binary libraries precompiled for both Windows 32 and 64 bits (.dll), and Linux (.so) including Rapspbian and Ubuntu.
These scripts require Python 3.7.x and have been tested to work on the following platforms:
Follow the instructions on the readme to install Python to your OS.
Python versions lower than 3.7 are no longer supported. We recommend using 3.7+ 32-bit for a new install.
The code is available on GitHub at Actuator Package. This git repository contains the API, DLLs, and sample scripts. The fx_plan_stack API is encapsulated in the flexsea python library. More information on the API can be found here.
Before starting, set up your Actuator Package following it's ActPack's quick start guide.
Let's get started by running a demo script:
# Define your own virtual environment # this is not required but it helps to keep your environment clean python3 -m virtualenv --python=/usr/bin/python3.7 actpack # Activate your virtualenv source actpack/bin/activate # Once the environment is activated, install the package python3 -m pip install --upgrade pip python3 -m pip install flexsea
git clone https://github.com/DephyInc/Actuator-Package.git cd Actuator_Package git update-index --assume-unchanged Python/flexsea_demo/ports.yaml
git checkout branchName
/Python/flexsea_demo/ports.yamlby renaming the ports or uncommenting lines.
cd Python/flexsea_demo ./run_demos.py
(actpack_test) carlos@Zef:~/dev/dephy/FlexSEA/Actuator-Package/Python/flexsea_demo$ ./run_demos.py ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ██░▄▄▀██░▄▄▄██░▄▄░██░██░██░███░██ ██░██░██░▄▄▄██░▀▀░██░▄▄░██▄▀▀▀▄██ ██░▀▀░██░▀▀▀██░█████░██░████░████ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ Beyond Nature™ STOP! Read our important safety information at https://dephy.com/start/ before running the scripts for the first time. Actuator Package Demo Scripts: ------------------------------  Read Only  Open Control  Current Control  Position Control  Impedance Control  Two Positions Control  High Speed Test  High Stress Test  Two Devices Position Control  Two Devices Leader Follower Control Advanced Utilities: ------------------------------  Bootloader Check  Find Poles Choose experiment number [q to quit]:
All scripts can be run individually by calling them and passing arguments. Use
–help to see usage information. See the example below using
$ ./high_speed_test.py --help usage: high_speed_test.py [-h] [-b B] Ports [Ports ...] FlexSEA High Speed Test positional arguments: Ports Your devices' serial ports. optional arguments: -h, --help show this help message and exit -b B, --baud B Serial communication baud rate.
run_demos.py script accepts command line arguments. The first argument is the experiment number and the second (optional) is the number of devices.
Calling Read Only directly (default = 1 device):
Two Devices Leader Follower is #9 and it uses 2 devices. To launch it with one command:
./run_demos.py 9 2
To use it, uncomment and/or modify the lines you need. Below is an example of that file used on Windows, with one port (COM3).
# ports.yaml # # Adjust the baudrate if needed and uncomment or edit the port list. # # Note that commented-out lines start with a `#` # Also the ports list has dashes `-` before the values to signify a list # # See the sample ports values below depending on your platform baud_rate: 230400 ports: # Windows - COM3 # - COM4 # Ubuntu WSL # - /dev/ttyS3 # - /dev/ttyS4 # Native Linux (e.g. Ubuntu or Raspbian) # - /dev/ttyACM0 # - /dev/ttyACM1