 |
FlexSEA Communication
|
Go to the documentation of this file. 1 #ifndef DEVICE_WRAPPER_H
2 #define DEVICE_WRAPPER_H
14 #include "actpack_struct.h"
15 #include "netmaster_struct.h"
16 #include "cellscreener_struct.h"
17 #include "battcycler_struct.h"
18 #include "i2t_struct.h"
48 typedef enum fxAppType
62 struct NetMasterState;
64 struct HabsoluteState;
65 struct CellScreenerState;
66 struct BattCyclerState;
69 #define NUM_TIMER_FREQS 11
72 #define FX_MAX_DEVICES 10
76 #define MIN_UVLO 15000
77 #define MAX_UVLO 50000
80 #define MIN_UNIQUE_ID 0
81 #define MAX_UNIQUE_ID 65535
84 #define MIN_CURRENT_OFFSET -15
85 #define MAX_CURRENT_OFFSET 15
110 int fxOpen(
const char* portName,
111 unsigned int baudRate,
112 unsigned int logLevel);
119 bool fxIsOpen(
unsigned int deviceId);
130 FxError
fxClose(
unsigned int deviceId);
180 unsigned int frequency,
212 FxError
fxReadDevice(
unsigned int deviceId, ActPackState* readData);
305 ActPackState* readData,
322 NetMasterState* readData,
356 HabsoluteState* readData,
373 CellScreenerState* readData,
390 BattCyclerState* readData,
432 FxError
fxSendMotorCommand(
unsigned int deviceId, FxControlMode controlMode,
int value);
451 FxError
fxSetUVLO(
unsigned int deviceId,
unsigned int mV);
485 FxError
fxSetUniqueId(
unsigned int deviceId,
unsigned int uid);
536 FxError
fxSetI2T(
unsigned int deviceId, i2tVals i2tValsToWrite);
589 FxError
fxSetAnkleTorquePoints(
unsigned int deviceId, int16_t *newAnkleTorque, uint8_t controller, uint8_t points);
633 double fxGetTimingGain(
unsigned int deviceId,
bool *isValid,
double *highestTimingGain);
639 #endif // DEVICE_WRAPPER_H
@ FxVoltage
Position - Send a position setpoint.
Definition: device_wrapper.h:38
FxError fxRequestUVLO(unsigned int deviceId)
Send a UVLO request to the specified device. The value is retrieved asynchronously and must be checke...
@ FxNone
Impedance - Send an impedance command. Position setpoints but with stiffness and damping coefficients...
Definition: device_wrapper.h:41
@ FxImpedance
Current - Send a current Setpoint command.
Definition: device_wrapper.h:40
FxError fxSetUVLO(unsigned int deviceId, unsigned int mV)
Set the UVLO to the desired value.
FxError fxSetGains(unsigned int deviceId, unsigned int kp, unsigned int ki, unsigned int kd, unsigned int K, unsigned int B, unsigned int ff)
Sets the gains used by PID controllers on the FlexSEA device.
FxError fxReadNetMasterDevice(unsigned int deviceId, NetMasterState *readData)
Read the most recent data from a streaming FlexSEA NetMaster device. Must call fxStartStreaming befor...
FxAppType fxGetAppType(unsigned int deviceId)
Get the device application type.
int fxReadNetMasterDeviceAll(unsigned int deviceId, NetMasterState *readData, unsigned int n)
Read all exo data from a streaming FlexSEA NetMaster device. Must call fxStartStreaming before callin...
bool fxIsStreaming(unsigned int deviceId)
check if streaming data from a FlexSEA device.
FxError fxSetI2T(unsigned int deviceId, i2tVals i2tValsToWrite)
Set the i2t values to the desired values.
i2tVals fxGetLastReceivedI2T(unsigned int deviceId)
Check the last i2t values which were received from the device. These i2t values are updated asyncrono...
int fxGetValidStreamingFrequencies(unsigned int deviceId, int validFrequencies[NUM_TIMER_FREQS])
Get the valid frequencies for a device.
@ FxCurrent
Voltage - Open Control Command.
Definition: device_wrapper.h:39
int fxReadHabsoluteDeviceAll(unsigned int deviceId, HabsoluteState *readData, unsigned int n)
Read all exo data from a streaming FlexSEA Habsolute device. Must call fxStartStreaming before callin...
FxError fxSetCurrentOffset(unsigned int deviceId, int offset)
Set the current offset to the desired value.
int fxGetReadDataQueueSize(unsigned int deviceId)
Get the maximum read data queue size of a device.
FxError fxStartStreaming(unsigned int deviceId, unsigned int frequency, bool shouldLog)
Start streaming data from a FlexSEA device and optionally log the streamed data. The data logger can ...
FxError fxSetReadDataQueueSize(unsigned int deviceId, unsigned int size)
Set the maximum read data queue size of a device.
int fxReadCellScreenerDeviceAll(unsigned int deviceId, CellScreenerState *readData, unsigned int n)
Read all data from a streaming FlexSEA CellScreener device. Must call fxStartStreaming before calling...
FxError fxRequestI2T(unsigned int deviceId)
Send an i2t values request to the specified device. The value is retrieved asyncronously and must be ...
double fxGetTimingGain(unsigned int deviceId, bool *isValid, double *highestTimingGain)
bool fxIsActiveDevice(unsigned int deviceId)
Check if Device connection is still active and running.
int fxReadBattCyclerDeviceAll(unsigned int deviceId, BattCyclerState *readData, unsigned int n)
Read all data from a streaming FlexSEA BattCycler device. Must call fxStartStreaming before calling t...
FxError fxSetAnkleTorquePoints(unsigned int deviceId, int16_t *newAnkleTorque, uint8_t controller, uint8_t points)
Sends new Ankle Torque points to device (Read/Write)
bool fxIsOpen(unsigned int deviceId)
Check if the device with the given device ID is open.
@ FxCustom
No controller type. Shutoff command.
Definition: device_wrapper.h:42
FxError fxStopStreaming(unsigned int deviceId)
Stop streaming data from a FlexSEA device.
FxError fxReadDevice(unsigned int deviceId, ActPackState *readData)
Read the most recent data from a streaming FlexSEA device stream. Must call fxStartStreaming before c...
FxError fxReadAnkleTorquePoints(unsigned int deviceId, uint8_t points)
Reads new Ankle Torque points to device (pure read)
FxError fxClose(unsigned int deviceId)
Disconnect from a FlexSEA device with the given device ID.
FxError fxFindPoles(unsigned int deviceId)
Find the motor poles.
int fxReadDeviceAll(unsigned int deviceId, ActPackState *readData, unsigned int n)
Read all data from a streaming FlexSEA device stream. Must call fxStartStreaming before calling this.
int fxGetDeviceIds(int *idArray, unsigned int size)
Get the device ID of all connected FlexSEA devices. The device ID is used by the functions in this AP...
FxError fxReadBMSDevice(unsigned int deviceId, BMSState *readData)
Read the most recent data from a streaming FlexSEA BMS device. Must call fxStartStreaming before call...
int fxOpen(const char *portName, unsigned int baudRate, unsigned int logLevel)
Establish a connection with a FlexSEA device.
int fxGetLastReceivedCurrentOffset(unsigned int deviceId)
Check the last current offset which was received from the device. This current offset is updated asyn...
int fxGetLastReceivedUVLO(unsigned int deviceId)
Check the last UVLO value which was received from the device. This UVLO value is updated asyncronousl...
#define NUM_TIMER_FREQS
Valid streaming frequencies.
Definition: device_wrapper.h:69
FxError fxSetUniqueId(unsigned int deviceId, unsigned int uid)
Set the Unique ID to the desired value.
void fxCloseAll()
Disconnect from all FlexSEA devices.
FxError fxReadBattCyclerDevice(unsigned int deviceId, BattCyclerState *readData)
Read the most recent data from a streaming FlexSEA BattCycler device. Must call fxStartStreaming befo...
int16_t * fxGetLastReceivedAnkleTorquePoints(unsigned int deviceId)
Returns the last points read by the stack.
FxError fxSendMotorCommand(unsigned int deviceId, FxControlMode controlMode, int value)
Send a command to the device.
FxError fxReadHabsoluteDevice(unsigned int deviceId, HabsoluteState *readData)
Read the most recent data from a streaming FlexSEA Habsolute device. Must call fxStartStreaming befor...
FxError fxRequestCurrentOffset(unsigned int deviceId)
Send a current offset request to the specified device. The value is retrieved asynchronously and must...
FxError fxReadCellScreenerDevice(unsigned int deviceId, CellScreenerState *readData)
Read the most recent data from a streaming FlexSEA CellScreener device. Must call fxStartStreaming be...
FxError fxIsBootloaderActivated(unsigned int deviceId)
Returns target bootloader status.
FxError fxSendEventFlags(int flag, int time)
FxError fxActivateBootloader(unsigned int deviceId, uint8_t target)
Activates target bootloader.
fxControlMode
Definition: device_wrapper.h:35
int fxReadBMSDeviceAll(unsigned int deviceId, BMSState *readData, unsigned int n)
Read all exo data from a streaming FlexSEA BMS device. Must call fxStartStreaming before calling this...