FlexSEA Wiki

A WEARABLE ROBOTICS TOOLKIT

User Tools

Site Tools


fxapifunctions

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
fxapifunctions [2018/11/20 14:46]
dtscbs
fxapifunctions [2019/05/06 12:03] (current)
flabelle [void setGains(int devId, int g0, int g1, int g2, int g3)]
Line 1: Line 1:
-[[#​func-members|Functions]]+======= FX_Plan_Stack API =======
  
-com_wrapper.h File Reference+===== Data types ===== 
 +For information about the data available to the Actuator Package, go the [[units|units page]].
  
-File that documents the API of the FlexSEA Plan Stack. [[#​details|More...]]+===== Functions =====
  
-''​#include <stdint.h>''​\\ ​+File that documents the API of the FlexSEA Plan Stack. [[#Detailed Description|More...]]
  
-[[com__wrapper_8h_source|Go to the source code of this file.]]+[[https://​github.com/​DephyInc/​fx_plan_stack/​blob/​master/​src/​com_wrapper.cc|Go to the source code of this file.]]
  
-|  Functions || +^Function Name ^Return ^Arguments ^Description ^ 
-|  ​void |[[com__wrapper_8h#​a0b7452f57660cfcfc83a29ae5ddf02fe|fxSetup]] ()| +fxSetup ​ ​| ​void | |Initialize the FlexSEA API library environment. This must be called before any call to other functions in this library. [[#void fxSetup()|More...]]\\ | 
-| |Initialize the FlexSEA API library environment. This must be called before any call to other functions in this library. [[#a0b7452f57660cfcfc83a29ae5ddf02fe|More...]]\\ | +fxCleanup ​| void  | | Clean up the FlexSEA API library environment. Call this before exiting your program. [[#void fxCleanup()|More...]]\\ | 
-| |+fxOpen ​| void  | char *portName, int portIdx| Open a serial port to communicate with a FlexSEA device. [[#void fxOpen(char *portName, int portIdx)|More...]]\\ | 
-|  ​void |[[com__wrapper_8h#​a8da68bff02d01b128859e9cd2b8a2b6a|fxCleanup]] ()| +fxIsOpen ​| uint8_t  | int portIdx| Check if a com port has been successfully opened. [[#uint8_t fxIsOpen(int portIdx)|More...]]\\ | 
-| |Clean up the FlexSEA API library environment. Call this before exiting your program. [[#a8da68bff02d01b128859e9cd2b8a2b6a|More...]]\\ | +fxClose ​| void  | uint16_t portIdx| Close a com port. [[#void fxClose(uint16_t portIdx)|More...]]\\ | 
-| |+fxGetDeviceIds ​| void  | int *idarray, int n| Get the device id of all connected FlexSEA devices. The device ID is an opaque handle used by the functions in this API to specify which FlexSEA device to communicate with. [[#void fxGetDeviceIds(int * idarray, int n)|More...]]\\ | 
-|  ​void |[[com__wrapper_8h#​a1d3efdb601a4db99cd2dbf2b8868648b|fxOpen]] (char *portName, int portIdx)| +fxSetStreamVariables ​| uint8_t  | int devId, int *fieldIds, int n| This function is called to select which FlexSEA variables are streamed from a device. [[#uint8_t fxSetStreamVariables(int devId,​int * fieldIds, int n)|More...]]\\ | 
-|Open a serial port to communicate with a FlexSEA device. [[#a1d3efdb601a4db99cd2dbf2b8868648b|More...]]\\ | +fxStartStreaming ​| uint8_t  | int devId, int frequency, bool shouldLog, int shouldAuto| Start streaming data from a FlexSEA device. [[#uint8_t fxStartStreaming(int devId,​ int frequency,​ bool shouldLog, int shouldAuto)|More...]]\\ | 
-| |+fxStopStreaming ​| uint8_t  | int devId|Stop streaming data from a FlexSEA device. [[#uint8_t fxStopStreaming(int devId)|More...]]\\ | 
-|  ​uint8_t |[[com__wrapper_8h#​a7ee51395855ea3a4fb43731180d0069b|fxIsOpen]] (int portIdx)| +fxReadDevice  | int * | int devId, int *fieldIds, uint8_t *success, int n| utility function to access the most recent values received from a FlexSEA device. [[#int* fxReadDevice(int devId,​int *fieldIds,​uint8_t *success,​int n)|More...]]\\ | 
-|Check if a com port has been successfully opened. [[#a7ee51395855ea3a4fb43731180d0069b|More...]]\\ | +setControlMode ​| void  | int devId, int ctrlMode |Sets the type of control mode of the FlexSEA device. The modes are open voltage, current, position, and impedance. [[#void setControlMode(int devId,​ int ctrlMode)|More...]]\\ | 
-| |+setMotorVoltage ​| void  | int devId, int mV |Sets the voltage being supplied to the motor. The voltage is specified in mV (millivolts). [[#void setMotorVoltage(int devId,​ int mv)|More...]]\\ | 
-|  ​void |[[com__wrapper_8h#​acb9cada17832e7012fcdcc701af033c2|fxClose]] (uint16_t portIdx)| +setMotorCurrent ​| void  | int devId, int cur |Sets the current for the motor. The current is specified in mA (milliamps). [[#void setMotorCurrent(int devId,​ int cur)|More...]]\\ | 
-|Close a com port. [[#acb9cada17832e7012fcdcc701af033c2|More...]]\\ | +setPosition ​| void  | int devId, int pos |Sets the setpoint in encoder ticks. [[#void setPosition(int devId,​ int pos)|More...]]\\ | 
-| |+setGains ​| void  | int devId, int z_k, int z_b, int i_kp, int i_ki |Sets the gains used by PID controllers on the FlexSEA device. [[#void setGains(int devId,​ int g0, int g1, int g2, int g3)|More...]]\\ | 
-|  ​void |[[com__wrapper_8h#​a22857a1fe42fb4ee592942bd68f120fd|fxGetDeviceIds]] (int *idarray, int n)| +actPackFSM2 ​| void  | int devId, int on |Enables or disables the user FSM 2 on the FlexSEA device. [[#void actPackFSM2(int devId, int on)|More...]]\\ | 
-|Get the device id of all connected FlexSEA devices. The device ID is an opaque handle used by the functions in this API to specify which FlexSEA device to communicate with. [[#a22857a1fe42fb4ee592942bd68f120fd|More...]]\\ | +findPoles ​| void  | int devId, int block |Runs the internal calibration routine on the FlexSEA device. ​Find poles procedure on the device. [[#void findPoles(int devId,​ int block)|More...]]\\ |
-| |+
-|  ​uint8_t |[[com__wrapper_8h#​a015fb128880cc67994c1aa48628d471f|fxSetStreamVariables]] (int devId, int *fieldIds, int n)| +
-|This function is called to select which FlexSEA variables are streamed from a device. [[#a015fb128880cc67994c1aa48628d471f|More...]]\\ | +
-| |+
-|  ​uint8_t |[[com__wrapper_8h#​aebb9b6dc9cfb7216119d2e35a40869db|fxStartStreaming]] (int devId, int frequency, bool shouldLog, int shouldAuto)| +
-|Start streaming data from a FlexSEA device. [[#aebb9b6dc9cfb7216119d2e35a40869db|More...]]\\ | +
-| |+
-|  ​uint8_t |[[com__wrapper_8h#​a47b8f0a047f76834909ef47ec217c1b4|fxStopStreaming]] (int devId)| +
-|Stop streaming data from a FlexSEA device. [[#a47b8f0a047f76834909ef47ec217c1b4|More...]]\\ | +
-| |+
-|  ​int * |[[com__wrapper_8h#​a3cb5bf31cd0386b995fb87bc0449d1e4|fxReadDevice]] (int devId, int *fieldIds, uint8_t *success, int n)| +
-| |a utility function to access the most recent values received from a FlexSEA device. [[#a3cb5bf31cd0386b995fb87bc0449d1e4|More...]]\\ | +
-| |+
-|  ​void |[[com__wrapper_8h#​a8e40bf340b22e8aa7ef65391d9707bd4|setControlMode]] (int devId, int ctrlMode)| +
-|Sets the type of control mode of the FlexSEA device. The modes are open voltage, current, position, and impedance. [[#a8e40bf340b22e8aa7ef65391d9707bd4|More...]]\\ | +
-| |+
-|  ​void |[[com__wrapper_8h#​a65a052424d8de195faddfefd34423f4e|setMotorVoltage]] (int devId, int mV)| +
-|Sets the voltage being supplied to the motor. The voltage is specified in mV (milli-volts). [[#a65a052424d8de195faddfefd34423f4e|More...]]\\ | +
-| |+
-|  ​void |[[com__wrapper_8h#​ae4ae522b6c772893fbe71338d3d539f3|setMotorCurrent]] (int devId, int cur)| +
-|Sets the current for the motor. The current is specified in mA (milli-amps). [[#ae4ae522b6c772893fbe71338d3d539f3|More...]]\\ | +
-| |+
-|  ​void |[[com__wrapper_8h#​a45a94b1b17b7ac72a7f2fc83aa48e04c|setPosition]] (int devId, int pos)| +
-|Sets the setpoint in encoder ticks. [[#a45a94b1b17b7ac72a7f2fc83aa48e04c|More...]]\\ | +
-| |+
-|  ​void |[[com__wrapper_8h#​a79adba07f3b2c61f9bec2d6be78d4648|setZGains]] (int devId, int z_k, int z_b, int i_kp, int i_ki)| +
-|Sets the gains used by PID controllers on the FlexSEA device. [[#a79adba07f3b2c61f9bec2d6be78d4648|More...]]\\ | +
-| |+
-|  ​void |[[com__wrapper_8h#​ae708768cfcb115992c7b206f11668688|actPackFSM2]] (int devId, int on)| +
-|Enables or disables the user FSM 2 on the FlexSEA device. [[#ae708768cfcb115992c7b206f11668688|More...]]\\ | +
-| |+
-|  ​void |[[com__wrapper_8h#​ad71a4263a312ae22f3572d5e95fd6b21|findPoles]] (int devId, int block)| +
-|Runs the internal calibration routine on the FlexSEA device. ​find poles procedure on the device. [[#ad71a4263a312ae22f3572d5e95fd6b21|More...]]\\ ​+
-| ||+
  
 ===== Detailed Description ===== ===== Detailed Description =====
Line 66: Line 33:
 File that documents the API of the FlexSEA Plan Stack. File that documents the API of the FlexSEA Plan Stack.
  
-===== Function Documentation ===== +==== void actPackFSM2(int devId, int on) ====
- +
-===== ◆ actPackFSM2() ====+
- +
-|void actPackFSM2|(|int |devId,​| +
-| | |int |on | +
-| |)| | |+
  
 Enables or disables the user FSM 2 on the FlexSEA device. Enables or disables the user FSM 2 on the FlexSEA device.
  
-  * **Parameters** devId is the opaque handle for the device. on 1 Enables the FSM, 0 disables it. +  * **Parameters**  
 +    ​* devId is the opaque handle for the device. 
 +    * on1 Enables the FSM, 0 disables it. 
  
-  * **Returns** Nothing.+  * **Returns**  
 +    ​* Nothing.
  
-===== ◆ findPoles() ====+==== void findPoles(int devId, int block) ====
- +
-|void findPoles|(|int |devId,​| +
-| | |int |block | +
-| |)| | |+
  
 Runs the internal calibration routine on the FlexSEA device. find poles procedure on the device. Runs the internal calibration routine on the FlexSEA device. find poles procedure on the device.
  
-  * **Parameters** devId is the opaque handle for the device. block Forces the function to block until the operation complete.  +  * **Parameters**  
- +    ​* devIdopaque handle for the device. ​ 
-  * **Returns** Nothing.+    * blockForces the function to block until the operation complete. ​
  
-===== ◆ fxCleanup() =====+  * **Returns**  
 +    * Nothing.
  
-|void fxCleanup|(| |)| |+==== void fxCleanup() ​====
  
 Clean up the FlexSEA API library environment. Call this before exiting your program. Clean up the FlexSEA API library environment. Call this before exiting your program.
  
-  * **Returns** Nothing.+  * **Returns**  
 +    ​* Nothing.
  
-===== ◆ fxClose() ====+==== void fxClose(uint16_t portIdx) ====
- +
-|void fxClose|(|uint16_t |portIdx|)| |+
  
 Close a com port. Close a com port.
  
-  * **Parameters** portIdx ​is the handle to the port to close  +  * **Parameters**  
- +    ​* portIdxhandle to the port to close 
-  * **Returns** Nothing.+
  
-===== ◆ fxGetDeviceIds() =====+  * **Returns**  
 +    * Nothing.
  
-|void fxGetDeviceIds|(|int * |idarray,+==== void fxGetDeviceIds(int * idarray, ​int n====
-| | |int |n | +
-| |)| | |+
  
 Get the device id of all connected FlexSEA devices. The device ID is an opaque handle used by the functions in this API to specify which FlexSEA device to communicate with. Get the device id of all connected FlexSEA devices. The device ID is an opaque handle used by the functions in this API to specify which FlexSEA device to communicate with.
  
-  * **Parameters** idarray On return idarray will contain "​handle"​ for each FlexSEA device found. Each element of the array will contain -1 for no valid device or an opaque '​handle'​ that refers to a device. On input it should contain enough space for the maximum number of devices supported (currently 3). n is the length of the array idarray. ​+  * **Parameters**  
 +    ​* idarrayOn return idarray will contain "​handle"​ for each FlexSEA device found. Each element of the array will contain -1 for no valid device or an opaque '​handle'​ that refers to a device. On input it should contain enough space for the maximum number of devices supported (currently 3).  
 +    * nis the length of the array idarray. ​
  
-  * **Returns** Nothing. idarray is updated with device handles.+  * **Returns**  
 +    ​* Nothing. idarray is updated with device handles.
  
   * **Note** idArray must be pre-allocated with enough space for the maximum number of FlexSEA devices supported by this API (currently 3).   * **Note** idArray must be pre-allocated with enough space for the maximum number of FlexSEA devices supported by this API (currently 3).
  
-===== ◆ fxIsOpen() ====+==== uint8_t ​fxIsOpen(int portIdx) ====
- +
-|uint8_t fxIsOpen|(|int |portIdx|)| |+
  
 Check if a com port has been successfully opened. Check if a com port has been successfully opened.
  
-  * **Parameters** portIdx ​is the "​handle"​ supplied in [[com__wrapper_8h#a1d3efdb601a4db99cd2dbf2b8868648b|fxOpen()]] ​ +  * **Parameters**  
- +    ​* portIdx"​handle"​ supplied in [[#fxOpen()|fxOpen()]] ​
-  * **Returns** 1 if the port is open, 0 otherwise+
  
-===== ◆ fxOpen() =====+  * **Returns**  
 +    * 1 if the port is open, 0 otherwise
  
-|void fxOpen|(|char * |portName,+==== void fxOpen(char *portName, ​int portIdx====
-| | |int |portIdx | +
-| |)| | |+
  
 Open a serial port to communicate with a FlexSEA device. Open a serial port to communicate with a FlexSEA device.
  
-  * **Parameters** portName ​is the name of the port to open (e.g. "​COM3"​) portIdx ​is a user defined "​handle"​ that refers to this port. +  * **Parameters**  
 +    ​* portNamename of the port to open (e.g. "​COM3"​) ​ 
 +    * portIdxuser defined "​handle"​ that refers to this port. 
  
-  * **Returns** Nothing.+  * **Returns**  
 +    ​* Nothing.
  
-===== ◆ fxReadDevice() ​=====+==== int* fxReadDevice(int devId,​int *fieldIds,​uint8_t *success,​int n) ====
  
-|int* fxReadDevice|(|int |devId,​| +A utility function to access the most recent values received from a FlexSEA device.
-| | |int * |fieldIds,​| +
-| | |uint8_t * |success,​| +
-| | |int |n | +
-| |)| | |+
  
-a utility function ​to access ​the most recent values received from FlexSEA device.+  * **Parameters**  
 +    * devId: opaque handle for the device.  
 +    * fieldIds: Specify the field ids of variables ​to read. These must have been requested in the fxSetStreamVariables. Refer to [[http://​dephy.com/​wiki/​flexsea/​doku.php?​id=fxdevicefields|http://​dephy.com/​wiki/​flexsea/​doku.php?​id=fxdevicefields]] for description of the field ids.  
 +    * success: An array of status codes indicating whether the returned data aray contains valid data. This array must contain the same number of elements as the fieldIds array. Each element in the success array will contain 1 if that fieldIds element contains valid data. Otherwise, the success array element will contain 0.  
 +    * n: Specifies the length of the arrays fieldIds and success. The arrays must be preallocated and the sze of the arrays must match
  
-  * **Parameters** devId is the opaque handle for the device. fieldIds Specify the field ids of variables ​to read. These must have been requested in the fxSetStreamVariables. Refer to [[http://​dephy.com/​wiki/​flexsea/​doku.php?​id=fxdevicefields|http://​dephy.com/​wiki/​flexsea/​doku.php?​id=fxdevicefields]] for a description of the field ids. success An array of status codes indicating whether the returned data aray contains ​valid data. This array must contain ​the same number of elements as the fieldIds array. Each element in the success array will contain 1 if that fieldIds element contains valid data. Otherwise, the success array element will contain 0. n Specifies the length of the arrays fieldIds and success. The arrays must be preallocated and the sze of the arrays must match+  * **Returns**  
 +    * Returns a pointer ​to an array that contains the data being read.
  
-  * **Returns** Returns a pointer ​to an array that contains ​the data being read.+  * **Note** This function will fail if the device is not configured ​to stream the requested field. Refer to [[#​fxSetStreamVariables()|fxSetStreamVariables()]].fieldIds and success arrays must be pre-allocated with enough space to hold all of the variables being streamed from the FlexSEA device.The returned data array is reused by each call to fxReadDevice. If you need it to persist, copy the data out of the array.
  
-  * **Note** This function will fail if the device is not configured to stream the requested field. Refer to [[com__wrapper_8h#​a015fb128880cc67994c1aa48628d471f|fxSetStreamVariables()]].fieldIds and success arrays must be pre-allocated with enough space to hold all of the variables being streamed from the FlexSEA device.The returned data array is reused by each call to fxReadDevice. If you need it to persist, copy the data out of the array. +==== uint8_t fxSetStreamVariables(int devId,int * fieldIds, ​int n====
- +
-===== ◆ fxSetStreamVariables() ===== +
- +
-|uint8_t fxSetStreamVariables|(|int |devId,+
-| | |int * |fieldIds,+
-| | |int |n | +
-| |)| | |+
  
 This function is called to select which FlexSEA variables are streamed from a device. This function is called to select which FlexSEA variables are streamed from a device.
  
-  * **Parameters** devId is the opaque handle for the device. fieldIds ​is an array of variables to stream. Each element should contain a valid id. Variables are described at [[http://​dephy.com/​wiki/​flexsea/​doku.php?​id=fxdevicefields|http://​dephy.com/​wiki/​flexsea/​doku.php?​id=fxdevicefields]] n Specifies the length of the array fieldIds.  +  * **Parameters**  
- +    ​* devIdopaque handle for the device. ​ 
-  * **Returns** Returns 0 on error 1 otherwise.+    * fieldIdsan array of variables to stream. Each element should contain a valid id. Variables are described at [[http://​dephy.com/​wiki/​flexsea/​doku.php?​id=fxdevicefields|http://​dephy.com/​wiki/​flexsea/​doku.php?​id=fxdevicefields]] ​ 
 +    * nSpecifies the length of the array fieldIds. ​
  
-===== ◆ fxSetup() =====+  * **Returns**  
 +    * Returns 0 on error 1 otherwise.
  
-|void fxSetup|(| |)| |+==== void fxSetup() ​====
  
 Initialize the FlexSEA API library environment. This must be called before any call to other functions in this library. Initialize the FlexSEA API library environment. This must be called before any call to other functions in this library.
  
-  * **Returns** Nothing.+  * **Returns**  
 +    ​* Nothing.
  
-===== ◆ fxStartStreaming() ===== +==== uint8_t fxStartStreaming(int devIdint frequencybool shouldLog, ​int shouldAuto====
- +
-|uint8_t fxStartStreaming|(|int |devId,+
-| | |int |frequency,+
-| | |bool |shouldLog,+
-| | |int |shouldAuto | +
-| |)| | |+
  
 Start streaming data from a FlexSEA device. Start streaming data from a FlexSEA device.
  
-  * **Parameters** devId is the opaque handle for the device. frequency This is the frequency of updates. This value is in Hz and can be one of the following 1, 5, 10, 20, 33, 50, 100, 200, 300, 500, 1000. shouldLog If set true, the program logs all received data to a file. The name of the file is formed as follows: ​+  * **Parameters**  
 +    ​* devIdopaque handle for the device. ​ 
 +    * frequencyThis is the frequency of updates. This value is in Hz and can be one of the following 1, 5, 10, 20, 33, 50, 100, 200, 300, 500, 1000.  
 +    * shouldLogIf set true, the program logs all received data to a file.  
 +    * shouldAuto: if set true, the device triggers itself to send read messages, otherwise the data is sent at the requested frequency. ​
  
 +  * **Returns** ​
 +    * Returns 0 on error. Otherwise returns 1.
 +
 +  * **Note** The CSV file naming scheme is the following:
 < FlexSEA model >_id< device ID >_< date and time >.csv < FlexSEA model >_id< device ID >_< date and time >.csv
 +
  
 for example: for example:
Line 203: Line 163:
 The file is formatted as a CSV file. The first line of the file will be headers for all columns. Each line after that will contain the data read from the device. The file is formatted as a CSV file. The first line of the file will be headers for all columns. Each line after that will contain the data read from the device.
  
-  * **Parameters** shouldAuto if set true, the device triggers itself to send read messages, otherwise the data is sent at the requested frequency.  +==== uint8_t ​fxStopStreaming(int devId) ====
- +
-  * **Returns** Returns 0 on error. Otherwise returns 1. +
- +
-===== ◆ fxStopStreaming() ====+
- +
-|uint8_t fxStopStreaming|(|int |devId|)| |+
  
 Stop streaming data from a FlexSEA device. Stop streaming data from a FlexSEA device.
  
-  * **Parameters** devId is the opaque handle for the device.  +  * **Parameters**  
- +    ​* devIdopaque handle for the device. ​
-  * **Returns** 0 on success. Otherwise returns 1.+
  
-===== ◆ setControlMode() =====+  * **Returns**  
 +    * 0 on success. Otherwise returns 1.
  
-|void setControlMode|(|int |devId,+==== void setControlMode(int devIdint ctrlMode====
-| | |int |ctrlMode | +
-| |)| | |+
  
 Sets the type of control mode of the FlexSEA device. The modes are open voltage, current, position, and impedance. Sets the type of control mode of the FlexSEA device. The modes are open voltage, current, position, and impedance.
  
-  * **Parameters** devId is the opaque handle for the device. ctrlMode Mode description can be found at: [[http://​dephy.com/​wiki/​flexsea/​doku.php?​id=fxdevicemodes|http://​dephy.com/​wiki/​flexsea/​doku.php?​id=fxdevicemodes]] ​+  * **Parameters**  
 +    ​* devId is the opaque handle for the device. ​ 
 +    * ctrlMode Mode description can be found at: [[http://​dephy.com/​wiki/​flexsea/​doku.php?​id=fxdevicemodes|http://​dephy.com/​wiki/​flexsea/​doku.php?​id=fxdevicemodes]] ​
  
-  * **Returns** Nothing.+  * **Returns**  
 +    ​* Nothing.
  
-===== ◆ setMotorCurrent() ​=====+==== void setMotorCurrent(int devId, int cur) ====
  
-|void setMotorCurrent|(|int |devId,​| +Sets the current for the motor. The current is specified in mA (milliamps).
-| | |int |cur | +
-| |)| | |+
  
-Sets the current ​for the motorThe current ​is specified ​in mA (milli-amps).+  * **Parameters**  
 +    * devId: opaque handle ​for the device 
 +    * cur: current in milliamps
  
-  * **Parameters** devId is the opaque handle for the device. cur Is the current in milli Amos.  +  * **Returns** 
- +    ​* ​ ​Nothing.
-  ​* **Returns** ​Nothing.+
  
   * **Note** The control mode must be set to current. Refer to fxSetControlMode().   * **Note** The control mode must be set to current. Refer to fxSetControlMode().
  
-===== ◆ setMotorVoltage() ​=====+==== void setMotorVoltage(int devId, int mv) ====
  
-|void setMotorVoltage|(|int |devId,​| 
-| | |int |mV | 
-| |)| | | 
  
-Sets the voltage being supplied to the motor. The voltage is specified in mV (milli-volts).+Sets the voltage being supplied to the motor. The voltage is specified in mV (millivolts).
  
-  * **Parameters** devId is the opaque handle for the device. mV is the voltage in milli Volts+  * **Parameters**  
 +    ​* devIdopaque handle for the device. 
 +    * mVvoltage in millivolts
  
-  * **Returns** Nothing.+  * **Returns**  
 +    ​* Nothing.
  
   * **Note** The control mode must be open voltage. Refer to fxSetControlMode().   * **Note** The control mode must be open voltage. Refer to fxSetControlMode().
  
-===== ◆ setPosition() ====+==== void setPosition(int devId, int pos) ====
- +
-|void setPosition|(|int |devId,​| +
-| | |int |pos | +
-| |)| | |+
  
 Sets the setpoint in encoder ticks. Sets the setpoint in encoder ticks.
  
-  * **Parameters** devId is the opaque handle for the device. pos Is the position. ​+  * **Parameters**  
 +    ​* devIdopaque handle for the device. ​ 
 +    * pos: motor position ​in ticks
  
-  * **Returns** Nothing.+  * **Returns** 
 +    *  ​Nothing.
  
   * **Note** The control mode must be either position or impedance.   * **Note** The control mode must be either position or impedance.
  
-===== ◆ setZGains() =====+==== void setGains(int devId, int g0, int g1, int g2, int g3) ==== 
 + 
 + 
 +Sets the gains used by PID controllers,​ namely for the current, position and impedance controllers.
  
-|void setZGains|(|int |devId,| +  * **Parameters - Current**  
-| | |int |z_k,​| +    *devId: opaque handle for the device. 
-| | |int |z_b,​| +    *g0: Proportional gain (kp)  
-| | |int |i_kp,​| +    *g1: Integral gain (ki) 
-| | |int |i_ki | +    *g2: N/A 
-| |)| | |+    *g3: N/A
  
-Sets the gains used by PID controllers on the FlexSEA ​device.+  * **Parameters - Position**  
 +    *devId: opaque handle for the device. 
 +    *g0: Proportional gain (kp)  
 +    *g1: Integral gain (ki) 
 +    *g2: N/A 
 +    *g3: N/A
  
-  * **Parameters** devId is the opaque handle for the device. ​z_k Damping factor ​(used for current in current control & position in position/​impedance controlz_b : Damping ​factor ​(used for current in current control & position in position/​impedance controli_kp : Proportional (used for for the underlying current control within the impedance controller) ​i_ki : Integral gain (used for for the underlying current control within the impedance controller) ​+  * **Parameters ​- Impedance**  
 +    ​*devIdopaque handle for the device. 
 +    *g0Stiffness ​(K) 
 +    *g1: Damping (B) 
 +    *g2: Proportional ​gain (kp) (used for for the underlying current control within the impedance controller) ​ 
 +    *g3: Integral gain (ki) (used for for the underlying current control within the impedance controller) ​
  
-  * **Returns** Nothing.+  * **Returns**  
 +    ​* Nothing.
fxapifunctions.1542725207.txt.gz · Last modified: 2018/11/20 14:46 by dtscbs