Dynamixel MX-28T and MX-106T (2.0)+Arduino Uno+IDE_Extended Position Control Mode+Velocity limit

Hi everyone,

I am controlling MX servos using Arduino Uno and working on the Extended position control mode, now the problem is I don't know how to set the velocity limit/control velocity for MX servo protocol (2.0) under extended position control mode. However, I have tried with the below code and it seems the code is working and the velocity is controlled only for protocol (1.0) .

`void setup() {


// Turn off torque when configuring items in EEPROM area
dxl.setOperatingMode(DXL_ID, OP_VELOCITY);

//Set Goal Velocity using RPM
dxl.setGoalVelocity(DXL_ID, 20, UNIT_RPM);

DEBUG_SERIAL.print("Present Velocity(rpm) : ");
DEBUG_SERIAL.println(dxl.getPresentVelocity(DXL_ID, UNIT_RPM));


void loop() {

// Extended Position Control Mode in protocol2.0,
dxl.setOperatingMode(DXL_ID, OP_EXTENDED_POSITION);
if(dxl.setGoalPosition(DXL_ID, 0)){
DEBUG_SERIAL.print("Present Extended Position1 : ");
DEBUG_SERIAL.println(dxl.getPresentPosition(DXL_ID)); DEBUG_SERIAL.println();
// Extended Position Contorl Mode in protocol2.0,
dxl.setOperatingMode(DXL_ID, OP_EXTENDED_POSITION);
if(dxl.setGoalPosition(DXL_ID, 5000)){
DEBUG_SERIAL.print("Present Extended Position2 : ");
DEBUG_SERIAL.println(dxl.getPresentPosition(DXL_ID)); DEBUG_SERIAL.println();

The code can control the extended position and velocity of servo having version (0.1), but the same code failed for version (2.0) because the dynamixel servo (2.0) rotates with max.velocity (where as it's velocity should be according to the goal velocity) following the extended position limits.

Please, if someone knows what wrong I am doing! and how to modify the code... it will be great help and thanks.

Danaish Rathore

That is not your complete sketch. You should have lots of library includes and global declarations before setup(). Link to library you are using?

Hi, I have used Dynamixel2Arduino library from GitHub. and the problem is solved now. Thanks

Update! The problem is solved now. I have just used the profile velocity under extended position control mode and it is working with protocol(2.0).

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.