Home e-Manual

Changing MX-106T PID values in ROS

I am using MX-106T (protocol 1) and MX-64T (protocol 1)servos to control a robotic arm. I am running ROS (1.0) on Ubuntu programming in C++ and using the dynamixel SDK. I’m communicating with the servos using a usb2dynamixel device.
I’ve written a ROS package that is able to change the position values of the servos, but I cannot find any example of how to set PID values and movement speed setting of the MX-106T while running on ROS.
I’ve attempted to change the PID settings and movement speed in the package but it causes the servo to stop working altogether.

I am using the following command to successfully set servo position but when I try using the same command to set moving speed or PID values, the values are not set and the servo stops working and needs to be reset.

dxl_comm_result=packetHandler->write4ByteTxRx(portHandler, servoID, Address, MovingSpeedValue, &dxl_error);

below is the actual line of code that I’m using: Servo ID =1 and the MovingSpeed Address = 32, Moving SpeedValue = 25;

dxl_comm_result=packetHandler->write4ByteTxRx(portHandler, 1, 32, 25, &dxl_error);

If anyone has successfully used write4ByteTxRx or any function to set PID values or moving speed in a C++ ROS package using dynaixelSDK or has an example of this I would greatly appreciate it.

Respectfully,
Terence

Hi @adev77, thank you for your post and welcome to our Community page! Based on your description of the issue, allow me to share some information and make some recommendations that should help.

  1. Whenever creating custom code to operate your DYNAMIXELs, I highly recommend having a browser tab available to browse the ROBOTIS e-Manual (emanual.robotis.com) documentation for your specific servo model.

  2. To set various firmware addresses of DYNAMIXELs, the concept is essentially the same as sending a Goal Position command- the desired data must be written to the firmware address that relates to the setting you want to change. The e-Manual for each respective model can provide important information related to the available firmware addresses, including the size of that address (in Bytes) and the range of accepted data. I’ll link the e-Manual for the MX-106 (“1.0”) here for reference: https://emanual.robotis.com/docs/en/dxl/mx/mx-106/

  3. Based on the line of code you’ve shared, I do see a potential issue in the write command size. As the control table in the e-Manual for the MX-106 shows, the Moving Speed firmware address is designated to accept only 2 bytes of data. I’d recommend trying to edit the write command to the “write2ByteTxRx” command from the DYNAMIXEL SDK. The same issue may also be affecting your ability to edit the PID gains, as those are single-byte firmware addresses (see “write1ByteTxRx” and the PID gains in the Control Table)

  4. For convenient reference, I’ll link the C++ API reference for our DYNAMIXEL SDK here.

Let me know if those recommendations help in successfully editing those firmware settings, or whether you have any other questions and I’ll be glad to assist!

Hi Andrew, thanks for the info. That was definitely the problem. I used the write4ByteTxRx() function for all of the values in the MX-106 control table and after noticing strange behavior, I realized that using this function on control values that are only 1 or 2 bytes would overwrite the following control values.

I found an mistake in the dynamixel SDK example. The read_write_node.cpp (and .py equivalent) show setting the goal position using the 4-byte function. This overwrites the following location as well (moving speed).

Thanks again, with the right function calls everything is working well now!

–Terry

1 Like

Hi @adev77, thanks for your response and great to hear you were able to get it working!

Thanks for mentioning the mistake in the example; I’ll bring it up to the team to update.
If you notice any other typos or issues with the example codes please feel free to bring it to our attention here, or you can also post on the Issue Tracker of our GitHub (Issue Tracker for Dynamixel2Arduino libraries here). Best of luck with your projects!