FlexSEA Wiki

A WEARABLE ROBOTICS TOOLKIT

User Tools

Site Tools


demodescriptions

Demo Scripts

The current scripts consist of 10 demos in 4 languages (Python, C/C++, MATLAB, SIMULINK). Each script shows how to perform various operations using the fx_plan_stack API. Each of the scripts are functionally equivalent across the languages. The Control Gains page serves as a reference for values you can try.

One device:

Two devices:

Read Only

  • Controller type: none (CTRL_NONE)
  • Motor: does not move
  • Display: streams many variables
  • When to use: This should be the first script you run to make sure that your system works well and that you can read data.

Open Control

  • Controller type: open / motor voltage (CTRL_OPEN)
  • Peak voltage: 3000 mV
  • Profile: ramps from 0 to peak then back to 0. Repeats twice.
  • User interaction: none, let the motor speed up and down
  • What can be changed: you can test with a different peak voltage, or with a different ramp speed

Current Control

  • Controller type: current control (CTRL_CURRENT)
  • Current: 1000 mA
  • Profile: holds constant current for 10 seconds then ramps it down to zero.
  • Gains: kp = 50, ki = 32
  • Motor: motor can be left free (it will spin up fast then stabilize) or held in place. Compare the motor current to the requested current.
  • What can be changed: you can test with a lower or higher current. We do not recommend going above 1000 mA during benchtop experiments. You can also change the gains.

Position Control

  • Controller type: position control (CTRL_POSITION)
  • Position: measures position when the script is launched and uses it as the setpoint
  • Profile: holds constant position for 5 seconds
  • User interaction: try moving the motor away from its current position
  • Gains: kp = 50, ki = 3
  • What can be changed: gains

Two Positions Control

  • Controller type: position control (CTRL_POSITION)
  • Position: measures position when the script is launched and uses it as the initial setpoint. Delta is 10000 ticks.
  • Profile: toggles between two positions every second, initial and initial+delta. Does that for 4 seconds.
  • Gains: kp = 25, ki = 2000
  • What can be changed: gains, timings

Impedance Control

  • Controller type: impedance control (CTRL_IMPEDANCE)
  • Position: measures position when the script is launched and uses it as the initial position. Position change will be 7500.
  • Gains
    • Current controller: kp = 100, ki = 32
    • Impedance: K = 325, B = 0 (initially)
  • Profile: Setpoint toggles between two positions every 800 ms. The impedance damping (B) starts at 0 and increments by 125 every cycle.
  • What can be changed: gains, timings
  • What to look for: you will hear the changes in damping. With the Python scripts a plot will also be generated.

High Speed Test

This script demonstrates sending commands to and reading data from the FlexSEA device at high (0-1000Hz) speeds. By default it does this by sending a sinusoidal control signal to the FlexSEA device and reading sensor data to show the response from the FlexSEA device. If using Python or MATLAB the control signal the response signal from the FlexSEA device are shown on a generated plot.

Default current control experiment (Python):

def fxHighSpeedTest(port, baudRate, controllerType = Controller.current, signalType = signal.sine, commandFreq = 1000, signalAmplitude = 1000, numberOfLoops = 10, signalFreq = 1, cycleDelay = .1, requestJitter = False, jitter = 20)

Default position control experiment (Python):

def fxHighSpeedTest(port, baudRate, controllerType = Controller.position, signalType = signal.sine, commandFreq = 1000, signalAmplitude = 10000, numberOfLoops = 10, signalFreq = 1, cycleDelay = .1, requestJitter = False, jitter = 200)

Parameters:

  • controllerType: can be current or position
  • signalType: sine (sine wave) or line (constant command)
  • commandFreq: frequency at which we write to the device
  • signalAmplitude: for a sine wave it's the peak, for a steady command it's the average/DC
  • numberOfLoops: controls the number of sine waves. In line mode it controls the time.
  • signalFreq: sine wave frequency
  • cycleDelay: adds a delay between cycles, as seen on the plot below
  • requestJitter: for line experiments, introducing noise helps detecting a locked-up system. Set to True to enable some jitter.
  • jitter: jitter amplitude

Other configurations:

  • Autostreaming at 1kHz
  • Always logging
  • Current gains: kp = 100, ki = 30
  • Position gains: kp = 300, ki = 50

Additional Information:

  • The Read & Write rates are not guaranteed
    • On Windows we have difficulty writing at more than 200Hz
    • On a RaspberryPi we can usually reach above 500Hz
  • Other software running on your computer can affect the script performance

Find Poles

To commutate the brushless motor we need to map pole positions to encoder count. In products like the ActPack the use of an absolute encoder means that this routine is only called once after the package is assembled. Some clients have relative encoders; they need to find poles every time they power the system. The Find Poles script is intended for these customers only. Use with care! If you do a wrong calibration your Package will be unusable until you properly find the poles.

There is little user interaction although the script in some languages will display a message indicating how long it has been running. Wait for the motor to stop moving before launching other scripts.

Two Devices Position Control

* Incomplete description *

This script demonstrates how two devices can be configured to maintain their current position. The initial position for each device is read and the position is returned to as the user rotates the device.

Two Devices Leader/Follower

* Incomplete description *

This script demonstrates how one device is configured as a “controller” for the second device. The position of the first device is used to make the second device follow it. As the user rotates the first device, the second device will rotate an equivalent amount.

Notes

  • Scripts using two devices do not require one board to be Manage 2, they can both be Manage 1
demodescriptions.txt · Last modified: 2019/10/07 17:31 by jfduval