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() {

DEBUG_SERIAL.begin(115200);
dxl.begin(57600);
dxl.setPortProtocolVersion(DXL_PROTOCOL_VERSION);
dxl.ping(DXL_ID);

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

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

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

}

void loop() {

// Extended Position Control Mode in protocol2.0,
//dxl.torqueOff(DXL_ID);
dxl.setOperatingMode(DXL_ID, OP_EXTENDED_POSITION);
dxl.torqueOn(DXL_ID);
if(dxl.setGoalPosition(DXL_ID, 0)){
delay(5000);
DEBUG_SERIAL.print("Present Extended Position1 : ");
DEBUG_SERIAL.println(dxl.getPresentPosition(DXL_ID)); DEBUG_SERIAL.println();
}
// Extended Position Contorl Mode in protocol2.0,
//dxl.torqueOff(DXL_ID);
dxl.setOperatingMode(DXL_ID, OP_EXTENDED_POSITION);
dxl.torqueOn(DXL_ID);
if(dxl.setGoalPosition(DXL_ID, 5000)){
delay(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.

Regards,
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).