Cant write to control table on XL330-M288-T servomotors using Dynamixel2Arduino on OpenRB-150

Hey folks,

I have been struggling with this issue all day.

I cannot write to the control table of my XL330-M288-T motors. I am using writeControlTableItem from the Dynamixel2Arduino library. My setup is an OpenRB-150 powered from my laptops USB.

I am trying to change goal_current or current_limit on the control table. I am able to change those values from Dynamixel Wizzard.

Here is the snippet of code that I am using to figure this out:

int torque_success1 = dxl.torqueOff(SERVO_ID_1);
    int torque_success2 = dxl.torqueOff(SERVO_ID_2);
    int write_success1 = dxl.writeControlTableItem((uint8_t)38, (uint8_t)1, (uint32_t)3, (uint32_t)2000);
    int write_success2 = dxl.writeControlTableItem((uint8_t)38, (uint8_t)2, (uint32_t)3, (uint32_t)2000);

    // Print the results to USB
    USB.print("ADDR: "); USB.println(ADDR); // Print the address in decimal format
    USB.print("Value: "); USB.println(value);
    USB.print("Torque Off Success Servo 1: "); USB.println(torque_success1);
    USB.print("Torque Off Success Servo 2: "); USB.println(torque_success2);
    USB.print("Write Success Servo 1: "); USB.println(write_success1);
    USB.print("Write Success Servo 2: "); USB.println(write_success2);

dxl.writeControlTableItem returns 0 no matter what I try. I can’t even write to address 64 (torque_enable) to turn on or off torque. However, dxl.torqueOn, dxl.torqueOff, dxl.setGoalPosition, and dxl.getPresentPosition all work just fine and I can control the positions of my motors.

The documentation of the dxl.writeControlTableItem specifies these inputs, which I have ensured match the datatypes I am using:

  • item_index : DYNAMIXEL control table item index. Data type : unsigned int8
  • id : ID of a specific DYNAMIXEL. Data type : unsigned int8
  • data : Data to write on the DYNAMIXEL control table. Data type : unsigned int32
  • timeout : Timeout for a response to a data transfer. (default : 100ms) Data type : unsigned int32

Does anybody have any idea why this might be happening? I am completely stumped by this.
Thanks for any help,

Syntax-wise I did not see anything erroneous in the way you write into Address 38 for Current Limit.

However I did not understand the actual values used for the third and fourth parameters:
“3” is very low since the maximum value for Current Limit is 1750.
“2000” meant 2 sec for time out. Why so long when the default value is 100?

Also instead of using “38” directly can you try the predefined constant “CURRENT_LIMIT” instead?

Thanks for getting back to me.

I used the predefined constant and it finally worked. No idea why that was causing issues.

Thank you so much!

I had a hunch that it was this “predefined named constants” issue. Because the D2A library was written to apply to all existing Robotis actuators, it uses a “behind the scenes” database at run time to keep track of the actual models of actuators used in the user’s robot. From that info, these “predefined named constants” are assigned with the proper values at runtime. It is good to use these “named constants” anyway so that other programmers can readily tell which parameter you are trying to set, especially when your robot uses a mixture of different actuator models.