Dynamixel MX-106T (2.0)+OpenCM9.04+Arduino IDE_Extended Position Control Mode+Current limit

Hi everyone, I am using MX-106 ((2.0) connected with OpenCM904 and Dynamixel2Arduino library to upload the code using Arduino IDE. Here I want to set/limit the current of the MX (as to control the torque) under extended position control mode but it doesn’t work. I am trying with this below code;

void setup() {
  // put your setup code here, to run once:
  DEBUG_SERIAL.begin(115200);
  dxl.setPortProtocolVersion(2.0);
  dxl.begin(57600);
  dxl.scan();

  // Turn on torque
  dxl.writeControlTableItem(TORQUE_ENABLE, DXL_ID, 0);

  /* set velocity(speed) mode */
  // MX2.0, X serise
  dxl.writeControlTableItem(OPERATING_MODE, DXL_ID, 4);
  
  // AX~MX
  //dxl.writeControlTableItem(CONTROL_MODE, DXL_ID, 4);
  
  // Turn on torque
  dxl.writeControlTableItem(TORQUE_ENABLE, DXL_ID, 1);
}
/*************************************************************/  
void loop() {
  // put your main code here, to run repeatedly:
  Serial_print();
  dynamixel();
}
/*************************************************************/  
 void Serial_print(){
 currT=millis();
  if (currT-prevT>200){
  Torque=dxl.readControlTableItem(PRESENT_CURRENT, DXL_ID);
  prevT=currT;
    torque=(Torque/2047)*100;
    Serial.print("Torque= "); Serial.print(torque);Serial.println("% ");
  }
 }
 /*************************************************************/  
 void dynamixel(){
     
  // MX2.0, X serise
  dxl.writeControlTableItem(PROFILE_VELOCITY, DXL_ID, 40); //for Mx(2.0)
  if(dxl.writeControlTableItem(CURRENT_LIMIT, DXL_ID, 200))
  {  
  dxl.setOperatingMode(DXL_ID, OP_EXTENDED_POSITION); 
  if(dxl.setGoalPosition(DXL_ID, -10000)){
     delay(5000);
  }
  }
  dxl.writeControlTableItem(PROFILE_VELOCITY, DXL_ID, 20); //for Mx(2.0)
  if(dxl.writeControlTableItem(CURRENT_LIMIT, DXL_ID, 300)){
  dxl.setOperatingMode(DXL_ID, OP_EXTENDED_POSITION);
  if(dxl.setGoalPosition(DXL_ID, 10000)){
     delay(5000);
  }
  }
 }

It would be great if anyone can suggest me or correct me. Thanks in advance to all.

there is work you can take off from the shoulders of your potential helpers.

You should provide tested download-links to the datasheets of the devices that you are using.

best regards Stefan

1 Like

Yes now onward, next time I will must try to include the links too.

And this problem has been solved at some extent on the below forum;

Dynamixel MX-106T (2.0)+OpenCM9.04+Arduino IDE_Extended Position Control Mode+Current limit - #8 by RATHORE - Arduino - ROBOTIS

Thanks.