×

PC Control These demos and projects allow the robot to be controlled via a computer.

ArbotiX Commander Control - These demos and projects control the Robot using the ArbotiX Commander, the handheld Arduino based remote control.

Direct Control - These demos and projects control the Robot directly from sensors connected directly to the Robot's control board.

Pose Control - These demos and projects allow you to create and playback a sequence of poses.

Serial Control - These demos and projects control the robot using a serial packet protocol.

Standalone - These demos and projects are deisgned to let your robot function without a computer or additional microcontroller.

Wireless Control - These demos and projects allow you to control the robot wirelessly - usually by replacing the Serial Connection with XBee modules.

Reference - These articles have technical details regarding the control and operation of the robot.

×

More info here

Arbotix 1.6 Documentation

Setup Functions

void dxlInit ( long  baud)

function to initialize servo library, defualts to Serial1 for the ArbotiX

Parameters
baudspeed to start the DYNAMIXEL chain at
Returns
none

Compatible Servos: All AX / MX servos

EXAMPLE: start library at 1mbps (1000000 bps)

dxlInit(1000000);

initializes serial1 transmit at baud, 8-N-1

Instruction Based Functions

int dxlGetRegister ( int  id,
int  regstart,
int  length 
)

Function to get data from specified register on single servo.

Parameters
idthe ID number for target servo
regstartstarting/lower register to start reading from
lengthhow many registers to read. Usually 1 or 2
Returns
error byte

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's present position (register 36/37)

int position = dxlGetRegister(id, 36, 2);

Read register value(s)

void dxlSetRegister ( int  id,
int  regstart,
int  data 
)

Function to set a single register on the servo.

Parameters
idthe ID number for target servo
registerthe target register to set the data in
datadata for the register, values 0-255 (anything larger will be truncated)
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo # 1's register #25 (led /AX_LED) to 1

dxlSetRegister(1, AX_LED, 1);

void dxlSetRegister2 ( int  id,
int  regstart,
int  data 
)

Function to write a single value to 2 registers.

Parameters
idthe ID number for target servo
regstartstarting/lower register. Data will be written accross regstart and regstart+1
datadata for the registers, values 0-65535
Returns
none

Compatible Servos: All AX/MX Servos

This function will do the necessary conversions to conevert the 'data' value into 2 single bytes , and then write the bytes to the corresponding registers. This function is usually used to write data for values that span 2 registers like goal position, goal speed, etc

EXAMPLE: set servo # 1's register #30 (goal position / AX_GOAL_POSITION) to 512

dxlSetRegister2(1,AX_GOAL_POSITION, 512);

void dxlReset ( int  id)

reset the target servo This function sets the servo back to factory defaults. This includes mode, baud rate and ID

Parameters
idtarget servo id
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: reset servo ID # 1 dxlReset(1);

int dxlGetError ( int  id)

standalone check for an error on the servo uses the 'ping' command to minimize packet size and returns the error byte

Parameters
idtarget servo id
Returns
-1 if no servo is found, otherewise returns the error byte. 0 = no error, greater than 0 = an error that can be deciphered

Compatible Servos: All AX/MX Servos

EXAMPLE: check is servo 1 has an error int dxlError = dxlGetError(1);

void dxlRegWrite ( int  id,
int  regstart,
int  data 
)

Function to set a single register on the servo's buffer register writes sent with this function are not executed / loaded into the servo until the dxlAction() function is called.

Parameters
idthe ID number for target servo
registerthe target register to set the data in
datadata for the register, values 0-255 (anything larger will be truncated)
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo # 1's buffered register #25 (LED / AX_LED) to 512

dxlSetRegister(1,AX_LED, 1);

void dxlRegWrite2 ( int  id,
int  regstart,
int  data 
)

Function to write a single value to 2 registers register writes sent with this function are not executed / loaded into the servo until the dxlAction() function is called.

Parameters
idthe ID number for target servo
regstartstarting/lower register. Data will be written accross regstart and regstart+1
datadata for the registers, values 0-65535
Returns
none

Compatible Servos: All AX/MX Servos

This function will do the necessary conversions to conevert the 'data' value into 2 single bytes , and then write the bytes to the corresponding registers. This function is usually used to write data for values that span 2 registers like goal position, goal speed, etc

EXAMPLE: set servo # 1's buffered register #30 (goal position) to 512

dxlSetRegister2(1,AX_GOAL_POSITION, 512);

void dxlAction ( )

Function to execute the registered command for all servo this version of the function assumes broadcast address and sends a write to all servos. This can be used to simultaneously execute all registered servo data.

Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: execute all servos buffered register data

dxlAction()

void dxlAction ( int  id)

Function to execute the registered command for a servo this function follows dxlRegWrite() or dxlRegWrite2() to execute the registered data.

Parameters
idthe ID number for target servo
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: execute servo # 1's buffered register data

dxlAction(1)

void dxlSyncWrite ( int  servoData[][2],
int  numberOfServos,
int  registerStart,
int  registerLength 
)

Function to write register data to multiple servos simultaneously a single packet can send all the data to write register data to up to 26 servos at the same time.

Parameters
servoDatathe ID number for target servo
numberOfServosnumber of servos to write data to
registerStartstarting/lower register.
registerLengthhow many registers to write across - usually 1 or 2
Returns
none

Compatible Servos: All AX/MX Servos

This function will do the necessary conversions to convert the 'data' value into 2 single bytes , and then write the bytes to the corresponding registers. EXAMPLE: set servo # 1 2 and 3 position to 0, 512, and 1023 int servoData[3][2] ={ {1,0}, {2,512}, {3,1023}, };

dxlSycWrite(servoData, 3, AX_GOAL_POSITION_L,2);

void mxBulkRead ( int  readRequestData[][3],
int  numberOfRequests,
int  returnData[] 
)

set an MX servo to multi turn mode This function does not check if the servo is already in wheel mode. To preserve EEPROM, you should check mode beforehand so that you only set multi turn mode when needed

Parameters
idtarget servo id
Returns
none

Compatible Servos: All MX Servos

EXAMPLE: request positional data from servos 1, 2, 3, 4 int mxServoData[3]; int requestParameters[4][3] ={ {2,1,36}, {2,2,36}, {2,3,36}, {2,4,36}, } ; //{register length,servo id, register number} mxBulkRead(requestParameters, 4, mxServoData);

int dxlPing ( int  id)

check for the presence of a servo

Parameters
idtarget servo id
Returns
1 for servo found, -1 if no servo is found

Compatible Servos: All AX/MX Servos

EXAMPLE: check is servo 1 is present int dxlCheck = dxlPing(1);

int dxlGetLastError ( )

Function to get last error byte.

Parameters
idthe ID number for target servo
Returns
error byte

Compatible Servos: All AX/MX Servos

By defualt, a DYNAMIXEL servo will return data after a read operation. Included in this data is an 'error' byte. Each bit of the byte indicates a different error. If all the bits are '0', the whole byte is 'zero' and there is no error. Otherwise an error is present.

Bit 7 - NA

Bit 6 - Instruction Error (ERR_INSTRUCTION)

Bit 5 - Overload Error (ERR_OVERLOAD)

Bit 4 - CheckSum Error (ERR_CHECKSUM)

Bit 3 - Range Error (ERR_RANGE)

Bit 2 - OverHeating Error (ERR_OVERHEATING)

Bit 1 - Angle Limit Error (ERR_ANGLE_LIMIT)

Bit 0 - Input Voltage Error (ERR_VOLTAGE)

EXAMPLE: get servo # 1's error byte after a positional read

int position = dxlGetPosition(id);

int error = ax12GetLastError()

Helper Functions

float dxlGetSystemVoltage ( int  numberOfServos)

Gets the average system voltage of sequental servos This function requests the voltage from each servo and then averages them all into a single voltage. This function assumes that the first servo is #1 and the last one is numberOfServos.

Parameters
numberOfServosthe number of servos in the system
Returns
present avereged voltage of the system as a float

Compatible Servos: All AX/MX Servos

EXAMPLE: return the voltage for a system with servos 1,2 and 3

float systemVoltage = dxlGetSystemVoltage(3);

float dxlGetSystemVoltage ( int  numberOfServos,
int  servoList[] 
)

Gets the average system voltage of non-sequential servos This function requests the voltage from each servo and then averages them all into a single voltage. This function will scan the ids passed in the servoList[] array.

Parameters
numberOfServosthe number of servos in the system
servoListan array with the IDs of each servo in the system
Returns
present avereged voltage of the system as a float

Compatible Servos: All AX/MX Servos

EXAMPLE: return the voltage for a system with servos 4,5 and 6 int servoList[3] = {4,5,6}; float systemVoltage = dxlGetSystemVoltage(3, servoList);

void dxlLedTest ( int  numberOfServos,
int  ledTime 
)

sequentially lights up each servo in the chain This function lights up each sequential servo in the chain This function assumes that the first servo is #1 and the last one is numberOfServos

Parameters
numberOfServosthe number of servos in the system
ledTimetime in miliseconds that each servo turns its LED on
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: light up the servos in a system with servos 1,2 and 3

dxlLedTest(3, 1000);

void dxlLedTest ( int  numberOfServos,
int  servoList[],
int  ledTime 
)

sequentially lights up each servo in the chain This function lights up each sequential servo in the chain This function assumes that the first servo is #1 and the last one is numberOfServos

Parameters
numberOfServosthe number of servos in the system
servoListan array with the IDs of each servo in the system
ledTimetime in miliseconds that each servo turns its LED on
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: light up the servos in a system with servos 1,2 and 3

int servoList[3] = {4,5,6}; dxlLedTest(3, servoList, 1000);

int dxlScanServos ( int  numberOfServos,
int  returnList[] 
)

scans for a certain number of servos and returns the number of servos found This function scans each sequential servo in the chain This function assumes that the first servo is #1 and the last one is numberOfServos. This function returns a number of found servos, as well as modifies the returnList[] array with each servos error bit

Parameters
numberOfServosthe number of servos in the system
returnList[]an array , numberOfServos long. The function will modify this array with the error bit for each servo
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: light up the servos in a system with servos 1,2 and 3 int returnList[3]; int foundServos = dxlScanServos(3, returnList);

int dxlScanServos ( int  numberOfServos,
int  servoList[],
int  returnList[] 
)

scans for a certain number of servos and returns the number of servos found This function scans each sequential servo in the chain This function assumes that the first servo is #1 and the last one is numberOfServos. This function returns a number of found servos, as well as modifies the returnList[] array with each servos error bit

Parameters
numberOfServosthe number of servos in the system
servoListan array with the IDs of each servo in the system
returnList[]an array , numberOfServos long. The function will modify this array with the error bit for each servo
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: scan a system with servos 4,5,6 int returnList[3]; int servoList[3] = {4,5,6}; int foundServos = dxlScanServos(3, servoList, returnList);

void mxSetJointMode ( int  servoId)

sets an MX servo to joint mode This function does not check if the servo is already in joint mode. To preserve EEPROM, you should check mode beforehand so that you only set joint mode when needed

Parameters
idtarget servo id
Returns
none

Compatible Servos: MX Servos

EXAMPLE: set MX servo ID # 1 to joint mode mxSetJointMode(1);

void axSetJointMode ( int  servoId)

sets an AX servo to joint mode This function does not check if the servo is already in joint mode. To preserve EEPROM, you should check mode beforehand so that you only set joint mode when needed

Parameters
idtarget servo id
Returns
none

Compatible Servos: All AX Servos

EXAMPLE: set AX servo ID # 1 to joint mode mxSetJointMode(1);

void dxlSetJointMode ( int  servoId,
int  CWAngleLimit,
int  CCWAngleLimit 
)

generic function to set servo to joint mode This function does not check if the servo is already in joint mode. To preserve EEPROM, you should check mode beforehand so that you only set joint mode when needed

Parameters
idtarget servo id
CWAngleLimitClockwise angle limit
CCWAngleLimitCounter Clockwise angle limit
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo ID # 1 to joint mode mxSetJointMode(1, 0, 1023);

void dxlSetWheelMode ( int  servoId)

set a servo to wheel mode This function does not check if the servo is already in wheel mode. To preserve EEPROM, you should check mode beforehand so that you only set wheel mode when needed

Parameters
idtarget servo id
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo ID # 1 to wheel mode dxlSetWheelMode(1);

void mxSetMultiTurnMode ( int  servoId)

set an MX servo to multi turn mode This function does not check if the servo is already in wheel mode. To preserve EEPROM, you should check mode beforehand so that you only set multi turn mode when needed

Parameters
idtarget servo id
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo ID # 1 to wheel mode mxSetMultiTurnMode(1);

int dxlGetMode ( int  servoId)

gets the mode of a servo

Parameters
servoIdtarget servo id
Returns
1 = joint mode 2 = wheel mode 3 = MX multi turn mode 4 = MX torque mode

Compatible Servos: All AX/MX Servos (MX only for multi-turn/torque mode)

EXAMPLE: chech servo id # 1 mode mode = dxlGetMode(1);

int axToMxPosition ( int  axPosition)

Function to convert AX positions to MX positions.

Parameters
axPositionposition for AX servo
Returns
MX position

EXAMPLE: send 512, returns 2048

int mxPosition = axToMxPosition(512);

int mxToAxPosition ( int  mxPosition)

Function to convert MX positions to AX positions.

Parameters
axPositionposition for AX servo
Returns
AX Position is applicable, '0' if the position is lower than the AX range and '1023' if the position is higher than the MX range

EXAMPLE: send 2048, returns 512

int axPosition = mxToAxPosition(2048);

int dxlIsModelMX ( int  modelNumber)

checks if model number is MX

Parameters
servoIdtarget servo id
Returns
1 = model number is MX, 0 = model is not MX
int dxlIsModelAX ( int  modelNumber)

checks if model number is AX

Parameters
servoIdtarget servo id
Returns
1 = model number is AX, 0 = model is not AX
#define dxlSyncWritePosition (   servoData,
  numberOfServos 
)    dxlSyncWrite(servoData, numberOfServos, AX_GOAL_POSITION_L, 2);

Macro to sync write position sync write is most commonly used with position, so a custom macro was created. A single packet can send all the data to write register data to up to 26 servos at the same time.

Parameters
servoDatathe ID number for target servo
numberOfServosnumber of servos to write data to

Compatible Servos: All AX/MX Servos

This function will do the necessary conversions to convert the 'data' value into 2 single bytes , and then write the bytes to the corresponding registers. EXAMPLE: set servo # 1 2 and 3 position to 0, 512, and 1023 int servoData[3][2] ={ {1,0}, {2,512}, {3,1023}, };

dxlSyncWritePosition(servoData, 3,);

#define axSetWheelMode (   id)    (dxlSetWheelMode(id))

Macro to turn set wheel mode for AX here to mirror ax/mx joint mode.

Parameters
idthe ID number for target servo
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo 1 to wheel mode

axSetWheelMode(1);

#define mxSetWheelMode (   id)    (dxlSetWheelMode(id))

Macro to turn set wheel mode for AX here to mirror ax/mx joint mode.

Parameters
idthe ID number for target servo
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo 1 to wheel mode

mxSetWheelMode(1);

#define dxlLEDOn (   id)    (dxlSetRegister(id, AX_LED, 1))

Macro to turn a single servo's LED on.

Parameters
idthe ID number for target servo
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: turn servo #1's LED on

dxlLEDOn(1);

#define dxlLEDOff (   id)    (dxlSetRegister(id, AX_LED, 0))

Macro to turn a single servo's LED off.

Parameters
idthe ID number for target servo
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: turn servo #1's LED off

dxlLEDOff(1);

#define dxlLockEEPROM (   id)    (dxlSetRegister(id, AX_LOCK, 1))

Macro to lock a single servo's EEPROM.

Parameters
idthe ID number for target servo
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: lock servo #1's EEPROM

dxlLockEEPROM(1);

#define dxlTorqueOn (   id)    (dxlSetRegister(id, AX_TORQUE_ENABLE, 1))

Macro to turn the torque on for a single servo.

Parameters
idthe ID number for target servo
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo # 1's torque to on

dxlTorqueOn(1);

#define dxlTorqueOff (   id)    (dxlSetRegister(id, AX_TORQUE_ENABLE, 0))

Macro to turn the torque off for a single servo.

Parameters
idthe ID number for target servo
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo # 1's torque to off

dxlTorqueOff(1);

#define dxlTorqueOnAll ( )    (dxlSetRegister(254, AX_TORQUE_ENABLE, 1))

Macro to set torqqe on for ALL servos.

Returns
none

Compatible Servos: All AX/MX Servos

This function uses the broadcast address to turn torque on to every connected servo

EXAMPLE: turn on torque to all servos

dxlTorqueOnAll();

#define dxlTorqueOffAll ( )    (dxlSetRegister(254, AX_TORQUE_ENABLE, 0))

Macro to set torque off for ALL servos.

Returns
none

Compatible Servos: All AX/MX Servos

This function uses the broadcast address to turn torque off to every connected servo

EXAMPLE: turn off torque to all servos

dxlTorqueOnAll();

Serial Reporting Functions

void dxlRegisterReportMultiple ( int  numberOfServos)

Function to display all of the register data for a series of servos to the Serial port.

Parameters
numberOfServosthe number of servos in the system
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: display all the register data for a system with servos 1,2 and 3

dxlRegisterReportMultiple(3);

void dxlRegisterReportMultiple ( int  numberOfServos,
int  servoList[] 
)

Function to display all of the register data for a series of servos to the Serial port.

Parameters
numberOfServosthe number of servos in the system
servoListan array with the IDs of each servo in the system
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: display all the register data for a system with servos 4,5 and 6

int servoList[3] = {4,5,6}; dxlRegisterReportMultiple(3, servoList);

void dxlServoReport ( )

scans every servo possible and displays data on the Serial port

Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: scan dxlScanServos();

void dxlServoReport ( int  numberOfServos)

scans for a certain number of servos and displays data on the Serial port This function scans each sequential servo in the chain This function assumes that the first servo is #1 and the last one is numberOfServos.

Parameters
numberOfServosthe number of servos in the system
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: scan a system with servos 1,2 and 3 dxlServoReport(3);

void dxlServoReport ( int  numberOfServos,
int  servoList[] 
)

scans for servos from a list and displays data on the Serial port This function scans each sequential servo in the chain This function assumes that the first servo is #1 and the last one is numberOfServos.

Parameters
numberOfServosthe number of servos in the system
servoListan array with the IDs of each servo in the system
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: scan a system with servos 4,5,6 int servoList[3] = {4,5,6}; dxlServoReport(3,servoList);

void dxlVoltageReport ( int  numberOfServos)

prints data voltage data based on dxlGetSystemVoltage() This function scans each sequential servo in the chain This function assumes that the first servo is #1 and the last one is numberOfServos.

Parameters
numberOfServosthe number of servos in the system
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: get voltage report for system with servos 1,2 and 3 dxlVoltageReport(3);

void dxlVoltageReport ( int  numberOfServos,
int  servoList[] 
)

prints data voltage data based on dxlGetSystemVoltage() This function scans each sequential servo in the chain This function assumes that the first servo is #1 and the last one is numberOfServos.

Parameters
numberOfServosthe number of servos in the system
servoListan array with the IDs of each servo in the system
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: get voltage report for system with servos 4,5,6 int servoList[3] = {4,5,6}; dxlVoltageReport(3,servoList);

Register GET Functions / Macros

#define dxlGetModel (   id)    (dxlGetRegister(id, AX_MODEL_NUMBER_L, 2))

Macro to get the model number for the servo.

Parameters
idthe ID number for target servo
Returns
model number of the servo.

Servo Name - Model number value - define macro

AX-12A - 12 - AX_12_MODEL_NUMBER

AX-18A -18 - AX_18_MODEL_NUMBER 18

AX-12W - 44 - AX_12W_MODEL_NUMBER 44

MX-12W - 104 -MX_12W_MODEL_NUMBER 104

MX-28 - 29 - MX_28_MODEL_NUMBER 29

MX-64 - 54 - MX_64_MODEL_NUMBER 54

MX-106 - 64 - MX_106_MODEL_NUMBER 64

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's model number

int modelNumber = dxlGetModel(1);

#define dxlGetFirmwareVersion (   id)    (dxlGetRegister(id, AX_VERSION, 1))

Macro to get the firmware version number for the servo.

Parameters
idthe ID number for target servo
Returns
firmware version of the servo.

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's firmwre version

int firmwareVersion = dxlGetFirmwareVersion(1);

#define dxlGetId (   id)    (dxlGetRegister(id, AX_ID, 1))

Macro to get the ID for the servo.

Parameters
idthe ID number for target servo
Returns
id of the servo.

Compatible Servos: All AX/MX Servos

This function is here for completness sake, but can also be used as a 'ping' / sanity check

EXAMPLE: get servo # 1's id

int id1 = dxlGetFirmwareVersion(1);

#define dxlGetBaud (   id)    (dxlGetRegister(id, AX_BAUD_RATE, 1))

Macro to get the baud rate register for the servo.

Parameters
idthe ID number for target servo
Returns
register data for baud rate (not the actual buad rate)

The actual baud rate can be calculated by

Compatible Servos: All AX/MX Servos

Speed(BPS) = 2000000/(Data+1)

where Data is the value in the register.

Common Baud Rates: 1 = 1,000,000 bps (1MBPS) 34 = 57142.9 (Target 57600);

EXAMPLE: get servo # 1's baud register data

int baud = dxlGetBaud(1);

#define dxlGetReturnDelayTime (   id)    (dxlGetRegister(id, AX_RETURN_DELAY_TIME, 1))

Macro to get the return delay time for the servo.

Parameters
idthe ID number for target servo
Returns
time (in milliseconds) between servo receiving data and returning packet

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's return delay time

int returnTime = dxlGetReturnDelayTime(id);

#define dxlGetCWAngleLimit (   id)    (dxlGetRegister(id, AX_CW_ANGLE_LIMIT_L, 2))

Macro to get the clockwise angle limit for the servo.

Parameters
idthe ID number for target servo
Returns
clockwise angle limit (in native servo position)

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's Clockwise angle limit

int cwAngleLimit = dxlGetCWAngleLimit(id);

#define dxlGetCCWAngleLimit (   id)    (dxlGetRegister(id, AX_CCW_ANGLE_LIMIT_L, 2))

Macro to get the counter-clockwise angle limit for the servo.

Parameters
idthe ID number for target servo
Returns
counter-clockwise angle limit (in native servo position)

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's counter-clockwise angle limit

int ccwAngleLimit = dxlGetCCWAngleLimit(id);

#define dxlGetTempLimit (   id)    (dxlGetRegister(id, AX_LIMIT_TEMPERATURE, 1))

Macro to get the temperature limit for the servo.

Parameters
idthe ID number for target servo
Returns
temperature limit in degreees celcius

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's counter-clockwise angle limit

int tempLimit = dxlGetTempLimit(id);

#define dxlGetLowVoltage (   id)    (dxlGetRegister(id, AX_DOWN_LIMIT_VOLTAGE, 1))

Macro to get the low voltage limit for the servo.

Parameters
idthe ID number for target servo
Returns
low voltage limit, voltage is the register value/ 10 (ie. 99 = 9.9v)

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's lower limit voltage

int lowVoltage = dxlGetLowVoltage(id) / 10;

#define dxlGetHighVoltage (   id)    (dxlGetRegister(id, AX_UP_LIMIT_VOLTAGE, 1))

Macro to get the high voltage limit for the servo.

Parameters
idthe ID number for target servo
Returns
high voltage limit, voltage is the register value/ 10 (ie. 128 = 12.8v)

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's high limit voltage

int highVoltage = dxlGetHighVoltage(id) / 10;

#define dxlGetStartupMaxTorque (   id)    (dxlGetRegister(id, AX_MAX_TORQUE_L, 2))

Macro to get the startup torque for the servo.

Parameters
idthe ID number for target servo
Returns
startup torque limit. Value 0-1023, where each unit is about .1% of the max torque (i.e. 512 = 50%, 1023 = 100%)

Compatible Servos: All AX/MX Servos

This function gets the EEPROM max torque. Every time the servo is reset, this value will get loaded into the RAM max torque. If the RAM torque is overwritten, that will take precedece

EXAMPLE: get servo # 1's startup torque value

int startupTorque = dxlGetStartupMaxTorque(id)

#define dxlGetStatusReturnLevel (   id)    (dxlGetRegister(id, AX_RETURN_LEVEL, 1))

Macro to get the startup torque for the servo.

Parameters
idthe ID number for target servo
Returns
status return level for the servo.

Compatible Servos: All AX/MX Servos

2 = return packet for all commands (AX_RETURN_ALL)

1 = returns for READ commands only. (AX_RETURN_READ)

0 = no return packets except for PING (AX_RETURN_NONE)

This function gets the EEPROM max torque. Every time the servo is reset, this value will get loaded into the RAM max torque. If the RAM torque is overwritten, that will take precedece

EXAMPLE: get servo # 1's startup torque value

int statusReturnLevel = dxlGetStatusReturnLevel(id)

#define dxlGetAlarmLED (   id)    (dxlGetRegister(id, AX_ALARM_LED, 1))

Macro to get the startup torque for the servo.

Parameters
idthe ID number for target servo
Returns
bye that holds alarm data. eacb bit of this value is mapped to a different error. If the error occurs and the bit is set to '1', then the LED will trigger when the error triggers

Compatible Servos: All AX/MX Servos

Bit 7 - NA

Bit 6 - Instruction Error

Bit 5 - Overload Error

Bit 4 - CheckSum Error

Bit 3 - Range Error

Bit 2 - OverHeating Error

Bit 1 - Angle Limit Error

Bit 0 - Input Voltage Error

EXAMPLE: get servo # 1's alarm LED data

int alarmLED = dxlGetAlarmLED(id)

#define dxlGetAlarmShutdown (   id)    (dxlGetRegister(id, AX_ALARM_SHUTDOWN, 1))

Macro to get the startup torque for the servo.

Parameters
idthe ID number for target servo
Returns
bye that holds alarm shutdown data. each bit of this value is mapped to a different error. If the error occurs and the bit is set to '1', then the servo will shutdown when the error triggers

Compatible Servos: All AX/MX Servos

Bit 7 - NA

Bit 6 - Instruction Error

Bit 5 - Overload Error

Bit 4 - CheckSum Error

Bit 3 - Range Error

Bit 2 - OverHeating Error

Bit 1 - Angle Limit Error

Bit 0 - Input Voltage Error

EXAMPLE: get servo # 1's alarm LED data

int alarmShutdown = dxlGetAlarmShutdown(id)

#define mxGetMultiTurnOffset (   id)    (dxlGetRegister(id, MX_MULTI_TURN_OFFSET_L, 2))

Macro to get the multi turn offset for the servo.

Parameters
idthe ID number for target servo
Returns
offset for multi turn mode

Compatible Servos: All MX Servos

EXAMPLE: get servo # 1's startup torque value

int multiTurnOffset = mxGetMultiTurnOffset(id)

#define mxGetResolutionDivider (   id)    (dxlGetRegister(id, MX_RESOLUTION_DIVIDER, 1))

Macro to get the resolution divider for the servo.

Parameters
idthe ID number for target servo

Compatible Servos: All MX Servos

Returns
Resolution devider for multi-turn mode

EXAMPLE: get servo # 1's startup torque value

int resolutionDivider = mxGetResolutionDivider(id)

#define dxlGetTorqueEnable (   id)    (dxlGetRegister(id, AX_TORQUE_ENABLE, 1))

Macro to get whether or not the servo's torque is enabled.

Parameters
idthe ID number for target servo
Returns
0 = torque disabled, 1 = torque enabled

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's torque value

int torqueState = dxlGetTorqueEnable(id)

#define dxlGetLed (   id)    (dxlGetRegister(id, AX_LED, 1))

Macro to get whether or not the servo's LED is on.

Parameters
idthe ID number for target servo
Returns
0 = led off, 1 = led on

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's led value

int ledState = dxlGetLed(id)

#define axGetCCWComplianceMargin (   id)    (dxlGetRegister(id, AX_CCW_COMPLIANCE_MARGIN, 1))

Macro to get the servo's counter clowckwise compliance margin.

Parameters
idthe ID number for target servo
Returns
counter clockwise compliance margin

Compatible Servos: All AX Servos

EXAMPLE: get servo # 1's counter clockwise compliance margin

int ccwComplianceMargin = axGetCCWComplianceMargin(id)

#define axGetCWComplianceMargin (   id)    (dxlGetRegister(id, AX_CW_COMPLIANCE_MARGIN, 1))

Macro to get the servo's clowckwise compliance margin.

Parameters
idthe ID number for target servo
Returns
clockwise compliance margin

Compatible Servos: All AX Servos

EXAMPLE: get servo # 1's clockwise compliance margin

int cwComplianceMargin = axGetCWComplianceMargin(id)

#define axGetCCWComplianceSlope (   id)    (dxlGetRegister(id, AX_CCW_COMPLIANCE_SLOPE, 1))

Macro to get the servo's counter clowckwise compliance Slope.

Parameters
idthe ID number for target servo
Returns
counter clockwise compliance Slope

Compatible Servos: All AX Servos

EXAMPLE: get servo # 1's counter clockwise compliance Slope

int ccwComplianceSlope = axGetCCWComplianceSlope(id)

#define axGetCWComplianceSlope (   id)    (dxlGetRegister(id, AX_CW_COMPLIANCE_SLOPE, 1))

Macro to get the servo's clowckwise compliance Slope.

Parameters
idthe ID number for target servo
Returns
clockwise compliance Slope

Compatible Servos: All AX Servos

EXAMPLE: get servo # 1's clockwise compliance Slope

int cwComplianceSlope = axGetCWComplianceSlope(id)

#define dxlGetGoalPosition (   id)    (dxlGetRegister(id, AX_GOAL_POSITION_L, 2))

Macro to get the servo's goal position.

Parameters
idthe ID number for target servo
Returns
goal position (NOTE: This is NOT the present position, see dxlGetPosition() )

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's goal position

int goalPosition = dxlGetGoalPosition(id)

#define dxlGetGoalSpeed (   id)    (dxlGetRegister(id, AX_GOAL_SPEED_L, 2))

Macro to get the servo's goal speed.

Parameters
idthe ID number for target servo
Returns
goal speed (NOTE: This is NOT the present speed, see dxlGetSpeed() )

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's goal position

int goalSpeed = dxlGetGoalSpeed(id)

#define dxlGetTorqueLimit (   id)    (dxlGetRegister(id, AX_TORQUE_LIMIT_L, 2))

Macro to get the servo's running torque limit.

Parameters
idthe ID number for target servo
Returns
running torque limit

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's torque limit

int torqueLimit = dxlGetTorqueLimit(id)

#define dxlGetPosition (   id)    (dxlGetRegister(id, AX_PRESENT_POSITION_L, 2))

Macro to get the servo's present position.

Parameters
idthe ID number for target servo
Returns
present position

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's present position

int position = dxlGetPosition(id)

#define dxlGetSpeed (   id)    (dxlGetRegister(id, AX_PRESENT_SPEED_L, 2))

Macro to get the servo's present speed.

Parameters
idthe ID number for target servo
Returns
present speed

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's present speed

int speed = dxlGetSpeed(id)

#define dxlGetTorque (   id)    (dxlGetRegister(id, AX_PRESENT_LOAD_L, 2))

Macro to get the servo's present torque.

Parameters
idthe ID number for target servo
Returns
present torque

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's present torque

int torque = dxlGetTorque(id)

#define dxlGetVoltage (   id)    (dxlGetRegister(id, AX_PRESENT_VOLTAGE, 1))

Macro to get the servo's present voltage.

Parameters
idthe ID number for target servo
Returns
present voltage * 10 (i.e. 111 = 11.1 volts)

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's present voltage

int voltage = dxlGetVoltage(id)

#define dxlGetTemperature (   id)    (dxlGetRegister(id, AX_PRESENT_TEMPERATURE, 1))

Macro to get the servo's present temperature.

Parameters
idthe ID number for target servo
Returns
present temperature in degrees celcius

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's present temperature

int temperature = dxlGetTemperature(id)

#define dxlGetRegistered (   id)    (dxlGetRegister(id, AX_REGISTERED_INSTRUCTION, 1))

Macro to get find out if the servo has a registered command.

Parameters
idthe ID number for target servo
Returns
0 = no registered command 1 = registered command

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's present torque

int registered = dxlGetRegistered(id)

#define dxlGetMoving (   id)    (dxlGetRegister(id, AX_MOVING, 1))

Macro to get the servo's moving register.

Parameters
idthe ID number for target servo
Returns
0 = not moving, 1 = moving

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's moving register

int moving = dxlGetMoving(id)

#define dxlGetLock (   id)    (dxlGetRegister(id, AX_LOCK, 1))

Macro to get the servo's EEPROM lock data.

Parameters
idthe ID number for target servo
Returns
0 = EEPROM not locked, 1 = EEPROMlocked

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's moving register

int lock = dxlGetLock(id)

#define dxlGetPunch (   id)    (dxlGetRegister(id, AX_PUNCH_L, 2))

Macro to get the servo's punch data.

Parameters
idthe ID number for target servo
Returns
punch data

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's punch data

int punch = dxlGetPunch(id)

#define mxGetD (   id)    (dxlGetRegister(id, MX_D, 1))

Macro to get the servo's d(derivative) gain.

Parameters
idthe ID number for target servo
Returns
d(derivative) gain

Compatible Servos: All MX Servos

EXAMPLE: get servo # 1's D Gain

int d = mxGetD(id)

#define mxGetI (   id)    (dxlGetRegister(id, MX_I, 1))

Macro to get the servo's i(integral) gain.

Parameters
idthe ID number for target servo
Returns
i(integral) gain

Compatible Servos: All MX Servos

EXAMPLE: get servo # 1's I Gain

int i = mxGetI(id)

#define mxGetP (   id)    (dxlGetRegister(id, MX_P, 1))

Macro to get the servo's p(proportional) gain.

Parameters
idthe ID number for target servo
Returns
p(proportional) gain

Compatible Servos: All MX Servos

EXAMPLE: get servo # 1's P Gain

int p = mxGetP(id)

#define mxGetGoalAcceleration (   id)    (dxlGetRegister(id, MX_GOAL_ACCELERATION, 1))

Macro to get the servo's goal acceleration.

Parameters
idthe ID number for target servo
Returns
goal acceleration

Compatible Servos: All MX Servos

EXAMPLE: get servo # 1's goal acceleration

int acceleration = mxGetGoalAcceleration(id)

#define mxGetCurrent (   id)    (dxlGetRegister(id, MX_CURRENT_L, 1))

Macro to get the servo's current.

Parameters
idthe ID number for target servo
Returns
current

Compatible Servos: All MX Servos

EXAMPLE: get servo # 1's current

int current = mxGetCurrent(id)

#define mxGetGoalTorque (   id)    (dxlGetRegister(id, MX_GOAL_TORQUE_L, 2))

Macro to get the servo's goal torque.

Parameters
idthe ID number for target servo
Returns
goal torque

Compatible Servos: All MX Servos

EXAMPLE: get servo # 1's goal torque

int goalTorque = mxGetGoalTorque(id)

#define mxGetTorqueMode (   id)    (dxlGetRegister(id, MX_TORQUE_CONTROL_MODE, 1))

Macro to get the servo's torque mode.

Parameters
idthe ID number for target servo
Returns
torque mode

Compatible Servos: All MX Servos

EXAMPLE: get servo # 1's torque mode

int torqueMode = mxGetTorqueMode(id)

Register SET Functions / Macros

#define dxlSetId (   oldId,
  newId 
)    (dxlSetRegister(oldId, AX_ID, newId))

Macro to set servo id.

Parameters
oldIdthe ID number for target servo
newIdnew ID for the servo
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo # 1 to id #2

dxlSetId(1,2);

#define dxlSetBaud (   id,
  baud 
)    (dxlSetRegister(id, AX_BAUD_RATE, baud))

Macro to set the return delay time.

Parameters
idthe ID number for target servo
baudinteger that represents baud rate. see http://support.robotis.com/en/product/dynamixel/ax_series/dxl_ax_actuator.htm#Actuator_Address_04
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo # 1 baud to 1MBPS

dxlSetBaud(1,1);

#define dxlSetReturnDelayTime (   id,
  delayTime 
)    (dxlSetRegister(id, AX_RETURN_DELAY_TIME, delayTime))

Macro to set the return delay time.

Parameters
idthe ID number for target servo
delayTimetime (in milliseconds) that the servo should wait before returning data
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo # 1 return delay time on servo # 1 to 100ms

dxlSetReturnDelayTime(1,100);

#define dxlSetCWAngleLimit (   id,
  cwLimit 
)    (dxlSetRegister2(id, AX_CW_ANGLE_LIMIT_L, cwLimit))

Macro to set the Clockwise Angle Limit for the servo.

Parameters
idthe ID number for target servo
cwLimitclockwise angle limit (in native servo position)
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo # 1 cw angle limit to 0

dxlSetCWAngleLimit(1,0);

#define dxlSetCCWAngleLimit (   id,
  ccwLimit 
)    (dxlSetRegister2(id, AX_CCW_ANGLE_LIMIT_L, ccwLimit))

Macro to set the Counter Clockwise Angle Limit for the servo.

Parameters
idthe ID number for target servo
ccwLimitcounter clockwise angle limit (in native servo position)
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo # 1 cw angle limit to 1023

dxlSetCCWAngleLimit(1,1023);

#define dxlSetTempLimit (   id,
  temperature 
)    (dxlSetRegister(id, AX_LIMIT_TEMPERATURE, temperature))

Macro to set the temperature limit for the servo.

Parameters
idthe ID number for target servo
temperaturetemperature limit in degrees celcius before servo goes into alarm mode
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo # 1 temp limit to 50 degrees Celcius

dxlSetTempLimit(1,50);

#define dxlSetLowVoltage (   id,
  lowVoltage 
)    (dxlSetRegister(id, AX_DOWN_LIMIT_VOLTAGE, lowVoltage))

Macro to set the low voltage limit for the servo.

Parameters
idthe ID number for target servo
lowVoltageminimum voltage for servo before going into alarm mode. Value is (real voltage() * 10
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo # 1 low voltage limit to 9.9 volts

dxlSetLowVoltage(1,99);

#define dxlSetHighVoltage (   id,
  highVoltage 
)    (dxlSetRegister(id, AX_UP_LIMIT_VOLTAGE, highVoltage))

Macro to set the high voltage limit for the servo.

Parameters
idthe ID number for target servo
highVoltagemaximum voltage for servo before going into alarm mode. Value is (real voltage() * 10
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo # 1 high voltage limit to 12.8 volts

dxlSetLowVoltage(1,128);

#define dxlSetStartupMaxTorque (   id,
  torque 
)    (dxlSetRegister2(id, AX_MAX_TORQUE_L, torque))

Macro to set startup torque limit limit for the servo.

Parameters
idthe ID number for target servo
torquestartup torque limit. Value 0-1023, where each unit is about .1% of the max torque (i.e. 512 = 50%, 1023 = 100%)
Returns
none

This function sets the EEPROM max torque. Every time the servo is reset, this value will get loaded into the RAM max torque. If the RAM torque is overwritten, that will take precedece

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo # 1 torque limit to 74.9%

dxlSetStartupMaxTorque(1,767);

#define dxlSetStatusReturnLevel (   id,
  statusReturnData 
)    (dxlSetRegister(id, AX_RETURN_LEVEL, statusReturnData))

Macro to set status return level for the servo.

Parameters
idthe ID number for target servo
statusReturnDatastatus return level for the servo.

2 = return packet for all commands (AX_RETURN_ALL)

1 = returns for READ commands only. (AX_RETURN_READ)

0 = no return packets except for PING (AX_RETURN_NONE)

Returns
none

broadcast instructions (254) will never recieve return packets, regardless of what the status return level is set to

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo # 1 to only send return packets on PING

dxlSetStatusReturnLevel(1,0);

#define dxlSetAlarmLED (   id,
  alarmData 
)    (dxlSetRegister(id, AX_ALARM_LED, alarmData))

Macro to set which errors will trigger the alarm LED.

Parameters
idthe ID number for target servo
alarmDataeacb bit of this value is mapped to a different error. If the error occurs and the bit is set to '1', then the LED will trigger when the error triggers

Bit 7 - NA

Bit 6 - Instruction Error

Bit 5 - Overload Error

Bit 4 - CheckSum Error

Bit 3 - Range Error

Bit 2 - OverHeating Error

Bit 1 - Angle Limit Error

Bit 0 - Input Voltage Error

Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo LED alarm for all errors (0-6)

dxlSetAlarmLED(1,127);

#define dxlSetAlarmShutdown (   id,
  shutdownData 
)    (dxlSetRegister(id, AX_ALARM_SHUTDOWN, shutdownData))

Macro to set which errors will trigger the alarm shutdown.

Parameters
idthe ID number for target servo
shutdownDataeach bit of this value is mapped to a different error. If the error occurs and the bit is set to '1', then the LED will trigger when the error triggers

Bit 7 - NA

Bit 6 - Instruction Error

Bit 5 - Overload Error

Bit 4 - CheckSum Error

Bit 3 - Range Error

Bit 2 - OverHeating Error

Bit 1 - Angle Limit Error

Bit 0 - Input Voltage Error

Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: set shutdown for overload and overheating only (2, 5)

dxlSetAlarmShutdown(1,36);

#define mxSetMultiTurnOffset (   id,
  offset 
)    (dxlSetRegister2(id, MX_MULTI_TURN_OFFSET_L, pos))

Macro to set the multi-turn offset for multi turn mode.

Parameters
idthe ID number for target servo
offsetoffset from the actual present position. Can range from -24576 to 24576
Returns
none

Compatible Servos: MX Servos Only

EXAMPLE: set servo # 1 high voltage limit to 12.8 volts

mxSetMultiTurnOffset(1,128);

#define mxSetResolutionDivider (   id,
  divider 
)    (dxlSetRegister(id, MX_RESOLUTION_DIVIDER, pos))

Macro to set the resolution divider for multi turn mode.

Parameters
idthe ID number for target servo
dividervalue 1-4 to divide the resoltuion by. Lower resoltution yields more turns
Returns
none

Present position = (Real Position / Resolution Divider) + Multi-turn Offse

Compatible Servos: MX Servos Only

EXAMPLE: set servo resolution divider to 4

mxSetResolutionDivider(1,4);

#define dxlSetTorqueEnable (   id,
  torqueState 
)    (dxlSetRegister(id, AX_TORQUE_ENABLE, torqueState))

Macro to enable/disable torque to the servo.

Parameters
idthe ID number for target servo
torqueState'0' turns the torque off, '1' enables it
Returns
none

After torque is disabled and enabled, a positional / speed command must be issued to enage torque.

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo 1's torque to be off

dxlSetTorqueEnable(1,0);

#define dxlSetLED (   id,
  ledState 
)    (dxlSetRegister(id, AX_LED, ledState))

Macro to enable/disable the LED on the servo.

Parameters
idthe ID number for target servo
ledState'0' turns the LED off, '1' turns it on
Returns
none

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo 1's LED on

dxlSetLED(1,1);

#define axSetCCWComplainceMargin (   id,
  ccwComplainceMargin 
)    (dxlSetRegister(id, AX_CCW_COMPLIANCE_MARGIN, ccwComplainceMargin))

Macro to set the Counter Clockwise Complaince Margin.

Parameters
idthe ID number for target servo
ccwComplainceMarginCounter Clockwise Compliance Margin, positional values from 0-255
Returns
none

Complaince describes how the motor will act when it tries to get to its goal position. A larger compliance margin means that the motor will stop at a further distance from its goal position The counter clockwise compliance margin only applies to counter clockwise movements.

http://support.robotis.com/en/product/dynamixel/ax_series/dxl_ax_actuator.htm#Actuator_Address_1A

Compatible Servos: AX Servos only

EXAMPLE: set servo 1's CCW Coplaince margin to be 20 positions away from the goal

axSetCCWComplainceMargin(1,20);

#define axSetCWComplainceMargin (   id,
  cwComplainceMargin 
)    (dxlSetRegister(id, AX_CW_COMPLIANCE_MARGIN, cwComplainceMargin))

Macro to set the Clockwise Complaince Margin.

Parameters
idthe ID number for target servo
cwComplainceMarginClockwise Compliance Margin, positional values from 0-255
Returns
none

Complaince describes how the motor will act when it tries to get to its goal position. A larger compliance margin means that the motor will stop at a further distance from its goal position The clockwise compliance margin only applies to clockwise movements.

http://support.robotis.com/en/product/dynamixel/ax_series/dxl_ax_actuator.htm#Actuator_Address_1A

Compatible Servos: AX Servos only

EXAMPLE: set servo 1's CW Coplaince margin to be 20 positions away from the goal

axSetCWComplainceMargin(1,20);

#define axSetCCWComplainceSlope (   id,
  CCWComplianceSlope 
)    (dxlSetRegister(id, AX_CW_COMPLIANCE_SLOPE, CCWComplianceSlope))

Macro to set the Counter Clockwise Complaince Margin.

Parameters
idthe ID number for target servo
CCWComplianceSlopeCouter Clockwise Compliance Margin, positional values from 0-255
Returns
none

Complaince describes how the motor will act when it tries to get to its goal position. A larger compliance slope means that the motor will be more flexible The counter clockwise compliance slope only applies to counter clockwise movements.

Compliace slope is available in 7 steps [value range (actual compliance slope)]

0-3 (0x02)

4-7 (0x07)

8-15 (0x0F)

16-31 (0x1F)

32-63 (0x3F)

64 - 127 (0x7F)

128 - 254 (0xFE)

http://support.robotis.com/en/product/dynamixel/ax_series/dxl_ax_actuator.htm#Actuator_Address_1A

Compatible Servos: AX Servos only

EXAMPLE: set servo 1's CCW Coplaince slope to be 128

axSetCCWComplainceSlope(1,128);

#define axSetCWComplainceSlope (   id,
  CWComplianceSlope 
)    (dxlSetRegister(id, AX_CCW_COMPLIANCE_SLOPE, CWComplianceSlope))

Macro to set the Clockwise Complaince Margin.

Parameters
idthe ID number for target servo
CWComplianceSlopeClockwise Compliance Margin, positional values from 0-255
Returns
none

Complaince describes how the motor will act when it tries to get to its goal position. A larger compliance slope means that the motor will be more flexible The clockwise compliance slope only applies to clockwise movements.

Compliace slope is available in 7 steps [value range (actual compliance slope)]

0-3 (0x02)

4-7 (0x07)

8-15 (0x0F)

16-31 (0x1F)

32-63 (0x3F)

64 - 127 (0x7F)

128 - 254 (0xFE)

http://support.robotis.com/en/product/dynamixel/ax_series/dxl_ax_actuator.htm#Actuator_Address_1A

Compatible Servos: AX Servos only

EXAMPLE: set servo 1's CW Coplaince slope to be 128

axSetCWComplainceSlope(1,128);

#define mxSetD (   id,
 
)    (dxlSetRegister(id, MX_D, d))

Macro to set the d(derivative) gain setting on the servo.

Parameters
idthe ID number for target servo
dderivative gain for the servo, 0-254
Returns
none

Compatible Servos: MX Servos Only

http://support.robotis.com/en/product/dynamixel/mx_series/mx-64.htm#Actuator_Address_1A

Kd = d gain * 4 / 1000

EXAMPLE: set servo # 1 d gain to 0

mxSetD(1,0);

#define mxSetI (   id,
 
)    (dxlSetRegister(id, MX_I, i))

Macro to set the i(integral) gain setting on the servo.

Parameters
idthe ID number for target servo
iintegral gain for the servo, 0-254
Returns
none

Compatible Servos: MX Servos Only

http://support.robotis.com/en/product/dynamixel/mx_series/mx-64.htm#Actuator_Address_1A

Ki = i gain * 1000 / 2048

EXAMPLE: set servo # 1 i gain to 0

mxSetI(1,0);

#define mxSetP (   id,
 
)    (dxlSetRegister(id, MX_P, p))

Macro to set the p(proportional) gain setting on the servo.

Parameters
idthe ID number for target servo
pproportional gain for the servo, 0-254
Returns
none

Compatible Servos: MX Servos Only

http://support.robotis.com/en/product/dynamixel/mx_series/mx-64.htm#Actuator_Address_1A

Kp = p gain / 8

EXAMPLE: set servo # 1 derivative to 32

mxSetP(1,32);

#define SetPosition (   id,
  pos 
)    (dxlSetRegister2(id, AX_GOAL_POSITION_L, pos))

Macro to set the servo position.

Macro turn torque off for a single servo.

Parameters
idthe ID number for target servo
posservo position, 0-1023 for AX servos, 0-4096 for MX servos
Returns
none
Deprecated:
this macro has been deprecated. Use dxlSetGoalPosition() instead

Compatible Servos: All AX/MX Servos

AX Position graphic http://support.robotis.com/en/product/dynamixel/ax_series/dxl_ax_actuator.htm#Actuator_Address_1E

MX Position graphic http://support.robotis.com/en/product/dynamixel/mx_series/mx-64.htm#Actuator_Address_1E

EXAMPLE: set servo #1 position to 512

dxlSetLED(1,512);

Parameters
idthe ID number for target sensor
Returns
none
Deprecated:
see dxlSetGoalPosition()

Compatible Servos: All AX / MX servos

#define dxlSetGoalPosition (   id,
  position 
)    (dxlSetRegister2(id, AX_GOAL_POSITION_L, position))

Macro to set the servo position.

Parameters
idthe ID number for target servo
positionservo position, 0-1023 for AX servos, 0-4096 for MX servos
Returns
none

Compatible Servos: All AX/MX Servos

AX Position graphic http://support.robotis.com/en/product/dynamixel/ax_series/dxl_ax_actuator.htm#Actuator_Address_1E

MX Position graphic http://support.robotis.com/en/product/dynamixel/mx_series/mx-64.htm#Actuator_Address_1E

EXAMPLE: set servo #1 position to 512

dxlSetLED(1,512);

#define dxlSetGoalSpeed (   id,
  speed 
)    (dxlSetRegister2(id, AX_GOAL_SPEED_L, speed))

Macro to set the goal speed.

Parameters
idthe ID number for target servo
speedservo speed. Values vary depending on servo mode
Returns
none

Compatible Servos: All AX/MX Servos

Joint mode: speed can be from 0-1023, with each increment being about .111 RPM for AX servos and .114 RPM for MX servos. '0' means full speed. Any values above your servos maximum speed will be treated as the maximum speed

Wheel mode; speed can be from 0 - 2047, with each increment being about .1% of total output for AX servos, and .114RPM for MX servos

Values from 0-1023 rotate the servo Counter clockwise with 0 being stopped and 1023 being full speed

    Values from 1024-2047 rotate the servo clockwise with 1024 being stopped and 2047 being full speed

    Essentially the 10nth bit becomes the direction control

    AX servos only allow outut control as a percent. MX servos allow for speed based /rpm control
    

EXAMPLE: set servo #1 position to ~10 RPM (AX servo, 10/.111 = 90)

dxlSetLED(1,90);

#define dxlSetRunningToruqeLimit (   id,
  torque 
)    (dxlSetRegister2(id, AX_TORQUE_LIMIT_L, torque))

Macro to set running torque limit for the servo.

Parameters
idthe ID number for target servo
torquerunning torque limit. Value 0-1023, where each unit is about .1% of the max torque (i.e. 512 = 50%, 1023 = 100%)
Returns
none

This function sets the RAM max torque. This function wil define the torque limit during actual servo operation

Every time the servo is reset, the EEPROM value will get loaded into the RAM max torque, overwriting this value

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo # 1 torque limit to 74.9%

dxlSetRunningToruqeLimit(1,767);

#define dxlSetEEPROMLock (   id,
  lock 
)    (dxlSetRegister(id, AX_LOCK, lock))

Macro to set lock the EEPROM.

Parameters
idthe ID number for target servo
lock0 = EEPROM can be modifed, 1 = EEPROM cannot be modified (it is locked)
Returns
none

If this register is set to 1, then the servo must be reset in order to write to EEPROM again

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo # 1 lock to be on

dxlSetEEPROMLock(1,1);

#define dxlSetPunch (   id,
  punch 
)    (dxlSetRegister2(id, AX_PUNCH_L, punch))

Macro to set servo punch.

Parameters
idthe ID number for target servo
punch0x00 to 0x3FF for AX servos 0x20 to 0x3FF for MX servos
Returns
none

http://support.robotis.com/en/product/dynamixel/ax_series/dxl_ax_actuator.htm#Actuator_Address_20

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo # 1 punch to 32

dxlSetPunch(1,32);

#define mxSetTorqueControlMode (   id,
  mode 
)    (dxlSetRegister(id, MX_TORQUE_CONTROL_MODE, mode))

Macro to set the p(proportional) gain setting on the servo.

Parameters
idthe ID number for target servo
pproportional gain for the servo, 0-254
Returns
none

Compatible Servos: MX 64 and 106 only

http://support.robotis.com/en/product/dynamixel/mx_series/mx-64.htm#Actuator_Address_1A

Kp = p gain / 8

EXAMPLE: set servo # 1 derivative to 32

mxSetP(1,32); Macro to set the torque mode

Parameters
idthe ID number for target servo
mode'0' = torque mode off (wheel/joint/multiturn rules) '1' = torque mode on (all other modes ignored)
Returns
none

Compatible Servos: MX 64 and 106 only

In this mode the servo does not respong to goal positions or moving speed, only the goal torque value. This mode is imilar to wheel mode in its appearance

Kp = p gain / 8

EXAMPLE: set servo # 1 to torque mode

mxSetTorqueControlMode(1,1);

#define mxSetGoalTorque (   id,
  goalTorque 
)    (dxlSetRegister(id, MX_GOAL_L, goalTorque))

Macro to set the goal torque.

Parameters
idthe ID number for target servo
goalTorquevalues 0-2047 where each increment is about 4.5mA (torque and current are proportionally related).
Returns
none

Compatible Servos: MX 64 and 106 only

In this mode the servo does not respong to goal positions or moving speed, only the goal torque value. This mode is imilar to wheel mode in its appearance

Values from 0-1023 rotate the servo Counter clockwise with 0 being stopped and 1023 being full speed

    Values from 1024-2047 rotate the servo clockwise with 1024 being stopped and 2047 being full speed

    Essentially the 10nth bit becomes the direction control
    

Goal torque cannot exceed the max torque limit

EXAMPLE: set servo # 1 goal torque to ~50% counter clockwise

mxSetGoalTorque(1,512);

#define mxSetGoalAcceleration (   id,
  goalAcceleration 
)    (dxlSetRegister(id, MX_ACCELERATION, goalAcceleration))

Macro to set the goal torque.

Parameters
idthe ID number for target servo
goalTorquevalues 0-254 where each increment is ~8.583 Degree / sec^2. '0' means there is no acceleration control, the servo just moves as fast as possible
Returns
none

Compatible Servos: All MX Servos

EXAMPLE: set servo # 1 goal acceleration to 85.83 Degress/sec^2 (this would mean that after 1 second an ideal motor would go fom 0rpm to 14.3 rpm)

mxSetGoalTorque(1,10);

Packet Level Functions

void dxlSetTXall ( )

helper functions to switch direction of comms for sync write

Parameters
idtarget servo id
Todo:
(is id this actually needed?)
Returns
none usually only used by the library

Compatible Servos: All AX / MX servos

EXAMPLE:

setTX();

void dxlSetTX ( int  id)

helper functions to switch direction of comms

Parameters
idtarget servo id
Todo:
(is id this actually needed?)
Returns
none usually only used by the library

Compatible Servos: All AX / MX servos

EXAMPLE:

dxlSetTX();

void dxlSetRX ( int  id)

helper functions to switch direction of comms

Parameters
idtarget servo id
Todo:
(is id this actually needed?)
Returns
none usually only used by the library

Compatible Servos: All AX / MX servos

EXAMPLE:

dxlSetRX();

void dxlWrite ( unsigned char  data)

Sends a character out the serial port.

Parameters
datadata to send
Returns
none usually only used by the library

Compatible Servos: All AX / MX servos

EXAMPLE:

dxlWrite();

Sends a character out the serial port.

void dxlWriteB ( unsigned char  data)

Sends a character out the serial port, and puts it in the tx_buffer.

Parameters
datadata to send
Returns
none usually only used by the library

Compatible Servos: All AX / MX servos

EXAMPLE:

dxlWriteB();

Sends a character out the serial port, and puts it in the tx_buffer

int dxlReadPacket ( int  length)

function to read DYNAMIXEL packet

Parameters
idthe ID number for target servo
delayTimetime (in milliseconds) that the servo should wait before returning data
Returns
none usually only used by the library

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo # 1 return delay time on servo # 1 to 100ms

dxlReadPacket();

Legacy Functions / Macros

#define SetPosition (   id,
  pos 
)    (dxlSetRegister2(id, AX_GOAL_POSITION_L, pos))

Macro to set the servo position.

Macro turn torque off for a single servo.

Parameters
idthe ID number for target servo
posservo position, 0-1023 for AX servos, 0-4096 for MX servos
Returns
none
Deprecated:
this macro has been deprecated. Use dxlSetGoalPosition() instead

Compatible Servos: All AX/MX Servos

AX Position graphic http://support.robotis.com/en/product/dynamixel/ax_series/dxl_ax_actuator.htm#Actuator_Address_1E

MX Position graphic http://support.robotis.com/en/product/dynamixel/mx_series/mx-64.htm#Actuator_Address_1E

EXAMPLE: set servo #1 position to 512

dxlSetLED(1,512);

Parameters
idthe ID number for target sensor
Returns
none
Deprecated:
see dxlSetGoalPosition()

Compatible Servos: All AX / MX servos

#define GetPosition (   id)    (dxlGetRegister(id, AX_PRESENT_POSITION_L, 2))

Macro to get servo position.

Parameters
idthe ID number for target sensor
Returns
positional data
Deprecated:
see dxlGetPosition()

Compatible Servos: All AX / MX servos

#define TorqueOn (   id)    (dxlSetRegister(id, AX_TORQUE_ENABLE, 1))

Macro to turn torque on for a single servo.

Parameters
idthe ID number for target sensor
Returns
none
Deprecated:
see dxlToqueOn()

Compatible Servos: All AX / MX servos

#define Relax (   id)    (dxlSetRegister(id, AX_TORQUE_ENABLE, 0))

Macro to turn torque off for a single servo.

Parameters
idthe ID number for target sensor
Returns
none
Deprecated:
see dxlToqueOff()

Compatible Servos: All AX / MX servos

#define GetLeftIRData (   id)    (dxlGetRegister(id, AX_LEFT_IR_DATA))

Macro get data from S1 sensor module.

Parameters
idthe ID number for target sensor
Returns
IR Data
Deprecated:
S1 module is no longer manufacturered

Compatible Servos: S1 Sensor Module

#define GetCenterIRData (   id)    (dxlGetRegister(id, AX_CENTER_IR_DATA))

Macro get data from S1 sensor module.

Parameters
idthe ID number for target sensor
Returns
IR Data
Deprecated:
S1 module is no longer manufacturered

Compatible Servos: S1 Sensor Module

#define GetRightIRData (   id)    (dxlGetRegister(id, AX_RIGHT_IR_DATA))

Macro get data from S1 sensor module.

Parameters
idthe ID number for target sensor
Returns
IR Data
Deprecated:
S1 module is no longer manufacturered

Compatible Servos: S1 Sensor Module

#define GetObstacles (   id)    (dxlGetRegister(id, OBSTACLE_DETECTION))

Macro get data from S1 sensor module.

Parameters
idthe ID number for target sensor
Returns
obstacle
Deprecated:
S1 module is no longer manufacturered

Compatible Servos: S1 Sensor Module

#define PlayTone (   id,
  note 
)    (dxlSetRegister(id, AX_BUZZER_INDEX, note))

Macro get data from S1 sensor module.

Parameters
idthe ID number for target sensor
notenote freqeuncy to play
Returns
none
Deprecated:
S1 module is no longer manufacturered

Compatible Servos: S1 Sensor Module

#define ax12Init (   baud)    (dxlInit( baud))

Macro to initialize servo library.

Parameters
baudspeed to start the DYNAMIXEL chain at
Returns
none

: see dxlInit();

Compatible Servos: All AX / MX servos

EXAMPLE: start library at 1mbps (1000000 bps)

ax12Init(1000000);

#define ax12ReadPacket (   length)    (dxlReadPacket(length))

Macro to read packet.

Parameters
idthe ID number for target servo
delayTimetime (in milliseconds) that the servo should wait before returning data
Returns
none

: see dxlReadPacket();

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo # 1 return delay time on servo # 1 to 100ms

ax12ReadPacket(1,100);

#define ax12GetRegister (   id,
  regstart,
  length 
)    (dxlGetRegister(id, regstart, length))

Function to get data from specified register on single servo.

Parameters
idthe ID number for target servo
regstartstarting/lower register to start reading from
lengthhow many registers to read. Usually 1 or 2
Returns
error byte

: see dxlGetRegister();

Compatible Servos: All AX/MX Servos

EXAMPLE: get servo # 1's present position (register 36/37)

int position = dxlGetRegister(id, 36, 2);

#define ax12SetRegister (   id,
  regstart,
  data 
)    (dxlSetRegister(id, regstart, data))

Macro to set a single register on the servo.

Parameters
idthe ID number for target servo
registerthe target register to set the data in
datadata for the register, values 0-255 (anything larger will be truncated)
Returns
none

: see dxlSetRegister();

Compatible Servos: All AX/MX Servos

EXAMPLE: set servo # 1's register #30 (goal position) to 512

dxlSetRegister(1,25, 1);

#define ax12SetRegister2 (   id,
  regstart,
  data 
)    (dxlSetRegister2(id, regstart, data))

Macro to write a single value to 2 registers.

Parameters
idthe ID number for target servo
regstartstarting/lower register. Data will be written accross regstart and regstart+1
datadata for the registers, values 0-65535
Returns
none

: see dxlSetRegister2();

Compatible Servos: All AX/MX Servos

This function will do the necessary conversions to conevert the 'data' value into 2 single bytes , and then write the bytes to the corresponding registers. This function is usually used to write data for values that span 2 registers like goal position, goal speed, etc

EXAMPLE: set servo # 1's register #30 (goal position) to 512

dxlSetRegister2(1,30, 512);

#define ax12GetLastError ( )    (dxlGetLastError())

Macro to get last error byte.

Parameters
idthe ID number for target servo
Returns
error byte

: see dxlGetLastError();

Compatible Servos: All AX/MX Servos

By defualt, a DYNAMIXEL servo will return data after a read or write operation. Included in this data is an 'error' byte. Each bit of the byte indicates a different error. If all the bits are '0', the whole byte is 'zero' and there is no error. Otherwise an error is present.

Bit 7 - NA

Bit 6 - Instruction Error (ERR_INSTRUCTION)

Bit 5 - Overload Error (ERR_OVERLOAD)

Bit 4 - CheckSum Error (ERR_CHECKSUM)

Bit 3 - Range Error (ERR_RANGE)

Bit 2 - OverHeating Error (ERR_OVERHEATING)

Bit 1 - Angle Limit Error (ERR_ANGLE_LIMIT)

Bit 0 - Input Voltage Error (ERR_VOLTAGE)

EXAMPLE: get servo # 1's error byte

int position = dxlGetPosition(id);

int error = ax12GetLastError()

#define setTXall ( )    (dxlSetTXall())

Macro to set transmit for sync write.

Parameters
baudspeed to start the DYNAMIXEL chain at
Returns
none
Deprecated:
use dxlSetTXall();

Compatible Servos: All AX / MX servos

EXAMPLE:

dxlSetTXall();

#define setTX (   id)    (dxlSetTX(id))

macro to helper functions to switch direction of comms

Parameters
idtarget servo id
Todo:
(is id this actually needed?)
Returns
none
Deprecated:
use dxlSetTX();

Compatible Servos: All AX / MX servos

EXAMPLE:

setTX();

#define setRX (   id)    (dxlSetRX(id))

macro to helper functions to switch direction of comms

Parameters
idtarget servo id
Todo:
(is id this actually needed?)
Returns
none
Deprecated:
use dxlSetRX();

Compatible Servos: All AX / MX servos

EXAMPLE:

setRX();

#define ax12write (   data)    (dxlWrite(data))

macro to Send a character out the serial port.

Parameters
datadata to send
Returns
none
Deprecated:
use dxlWrite();

Compatible Servos: All AX / MX servos

EXAMPLE:

ax12write();

#define ax12writeB (   data)    (dxlWriteB(data))

macro to Send a character out the serial port, and puts it in the tx_buffer

Parameters
datadata to send
Returns
none
Deprecated:
use dxlWriteB();

Compatible Servos: All AX / MX servos

EXAMPLE:

ax12writeB();