FlexSEA Wiki

A WEARABLE ROBOTICS TOOLKIT

User Tools

Site Tools


python_interface2_doc

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
python_interface2_doc [2019/04/15 17:39]
flabelle
— (current)
Line 1: Line 1:
-===== Python Interface 2.0 Overview ===== 
  
-The full, up to date, python interface is documented through comments in pyFlexsea.py. The documentation without implementations is copied here for convenience:​ 
- 
-<​code>​ 
-# Opens the given serial port at the given index and looks for devices 
-def fxOpen(port,​ idx): 
- 
-# Returns a boolean that indicates whether the port is open 
-def fxIsOpen(idx):​ 
- 
-# Returns a list of device ids corresponding to connected devices 
-def fxGetDeviceIds():​ 
- 
-# Starts streaming data read commands and act pack commands for the given device 
-# params: 
-# devId : the id of the device to stream 
-# freq : the frequency to stream at 
-# shouldLog : whether to log data received from this device to a log file 
-# shouldAuto : whether to use autostreaming or manual streaming 
-# returns: 
-# c_bool value indicating whether the request was a success 
-def fxStartStreaming(devId,​ freq, shouldLog, shouldAuto):​ 
- 
-# Stops streaming data read commands and act pack commands for the given device 
-# params: 
-# devId : the id of the device to stop streaming 
-# returns: 
-# c_bool value indicating whether the request was a success 
-def fxStopStreaming(devId):​ 
- 
-# Sets the active stream variables for the given device 
-# Note: changing the stream variables during a logged stream has undefined behaviour 
-# params: 
-# devId : the id of the device to set fields for 
-# fieldIds : a list containing the fields to stream ​ 
-def fxSetStreamVariables(devId,​ fieldIds): 
- 
-# Reads the most recent data received from the device 
-# params: 
-# devId : the id of the device to read 
-# fieldIds : a list containing the fields to read  
-# returns: 
-# a python list containing the values of the requested fields ​ 
-# (in the order requested), or None for fields that errored 
-def fxReadDevice(devId,​ fieldIds): 
- 
-# Sets the control mode for the given device 
-# params: 
-# devId : the id of the device ​ 
-# ctrlMode : the control mode to use [must be one of values provided in pyFlexsea_def.py] 
-def setControlMode(devId,​ ctrlMode): 
- 
-# Sets the voltage setpoint for the given device 
-# params: 
-# devId : the id of the device ​ 
-# mV : the voltage to set in milliVolts 
-def setMotorVoltage(devId,​ mV): 
- 
-# Sets the current setpoint for the given device 
-# params: 
-# devId : the id of the device ​ 
-# cur : the current to use as setpoint in milliAmps 
-def setMotorCurrent(devId,​ cur): 
- 
-# Sets the position setpoint for the given device 
-# params: 
-# devId : the id of the device ​ 
-# pos : the absolute encoder position to use as setpoint 
-def setPosition(devId,​ pos): 
- 
-# Sets the PID controller gains for the given device 
-# params: 
-# devId : the id of the device ​ 
-# z_k : the proportional gain to set for the active setpoint 
-# z_b : the integral gain to set for the active setpoint 
-# i_kp : the proportional gain to set for the underlying current controller (only relevant for impedance control) 
-# i_ki : the integral gain to set for the underlying current controller (only relevant for impedance control) 
-def setGains(devId,​ g0, g1, g2, g3): 
- 
-# Sets the activation state for FSM2 on the given device 
-# params: 
-# devId : the id of the device ​ 
-# on : whether to set the FSM on or off 
-def actPackFSM2(devId,​ on): 
- 
-# Tells the given device to run a find poles routine 
-# params: 
-# devId : the id of the device ​ 
-# block : whether to block for 60 seconds while the device runs the routine 
-def findPoles(devId,​ block): 
- 
-# Loads the library from the c lib 
-def loadFlexsea():​ 
- 
-</​code>​ 
python_interface2_doc.1555349940.txt.gz ยท Last modified: 2019/04/15 17:39 by flabelle