FlexSEA Wiki

A WEARABLE ROBOTICS TOOLKIT

User Tools

Site Tools


python_interface2_doc

This is an old revision of the document!


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:

# 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 setZGains(devId, z_k, z_b, i_kp, i_ki):

# 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():
python_interface2_doc.1530121050.txt.gz ยท Last modified: 2018/06/27 17:37 by dweisdorf