POST No. 2406870
Torque control with Dynamixel MX-64 and MX-106
2018-06-26 17:09:55 urko_18

Hello everyone,

I want to be able to control the torque of 4 dynamixel engines (2 MX 64 and two MX 106) to be able to make a collaborative robotic arm using an arbotix and programming in arduino.

So far I have managed to read the torque of the motors with the register: dxlGetTorque (SERVO_ID [servo]);

The problem is that at the time of running the program and moving the arm, it seems that the microcontroller of the arbotix (atMega644p) is not able to give me the current torque of each motor, since most times it puts -1 in the registration, and that, if I'm not mistaken, I think it's that the registry fails.

I do not know if it is because it is not powerful enough ... and the truth is that I can not think of other ways to control torque ...

Maybe it's better to use a different register? or another strategy?

  I would appreciate ideas and advices, thank you!


2018-06-26 17:09:55
2018-06-26 22:35:58 Kurt

Hi Urko,  

It might help some of the others here like @Will son if you provided some additional information and maybe some code sample that tries to show

what it is you are trying to do, that is failing.  I can probably find out some of this by  rereading your earlier posts on Trossen Robotics Forum, 

like: http://forums.trossenrobotics.com/showthread.php?21694-Problem-to-reed-torque-value-from-Dynamixel

What I don't remember is which version of Arduino IDE you are using.  Are you using the last officially released Arbotix code which was using

Arduino 1.0.x?  Or are you using my support for Arduino 1.5/1.6.x or the actual Beta where Kyle made changes to my version and posted:

 http://forums.trossenrobotics.com/showthread.php?7971-ArbotiX-1-6-Files-Libraries (about 2 years ago).... Or maybe the version that the user tician made that allows you to install using the board manager.

 Information is in a few threads including toward the end of the posting I mentioned for Kyle...

One of the reasons I mention this, is that sometimes I have had issues with some of the versions of the arbotix library in reading information

from the servos.  I know that I put fixes into my versions of the libraries, that usually helped, when I was needing/wanting to read registers

from the servos.  Also there are some possible pitfalls that you can run into with these libraries.  

Example, if your code still includes sections like:

dxlSetGoalPosition(SERVO_ID[servo], current[servo]);

torque[servo] = dxlGetTorque(SERVO_ID[servo]);

If so this could be a couple of issues.  One is if the version of the bioloid (AX) library is properly working with it's timings.  Earlier versions of the

library and maybe still some current versions, used some guess on how long to wait when switching the serial port from TX to RX mode, where as I know my own versions instead check to make

sure the transmit has completed by looking at the serial ports hardware register.

But probably the real issue, is that in the above code snippet, the call: dxlSetGoalPosition(SERVO_ID[servo], current[servo])

Will generate a packet that is sent over the DXL buss to the servos, but it does not wait for a response back from the servo. 

That is unless you change the servo setting: #define AX_RETURN_LEVEL             16

The servo will generate a response packet.  But during this time, you are generating a new TX packet to get the torque. 

Very likely these two will collide and you will not get a valid response for your query. 

Two possible fixes.  Change the servo setting for return level to not return packets, to a value that does not respond to the set type commands. 

More info up at: 


Or modify your code to read in the response...   Maybe something like:

dxlSetGoalPosition(SERVO_ID[servo], current[servo]);


torque[servo] = dxlGetTorque(SERVO_ID[servo]);

Note: the above issue can hit as well if you do something like: 


dxlSetGoalPosition(servo1, position1);

dlxSetGoalposition(servo2, position2);

The second set might be corrupted as the first servo may try to respond at the same time as your second set... 

Hope that helps


P.S. - As I have mentioned before (on Trossen), having a Logic Analyzer can help a lot in looking at issues like this. 

I personally use one by Saleae I also have a Dynamixel protocol analyzer add on for it, which can show you the actual packets...

2018-06-26 22:35:58
2018-06-27 10:39:53 Will Son


As I don't have experience with Arbotix hardware and library, it is difficult for me to catch up with what you mentioned.

I tracked back to Trossen Robotics forum with Kurt's link, but couldn't find enough resources for interpreting your source code.

For example, I wasn't able to find the dxlGetTorque() function from Arbotix-M library that I downloaded from below site.


Like Kurt said, I'd recommend to check your transmitted signal and received signal with either Logic Analyzer or Oscillator and make sure that they are correctly transferred/received.

If it is difficult to find the root of an error, please start with smaller code and make sure each block of code works fine.

Sorry that I can't give you much helpful opinion, but feel free to let me know if I can further help you to resolve the issue.

Thank you!

2018-06-27 11:11:43 kurteck
My educated guess is he is using the library installed as part of Arbotix 1.6 beta, maybe with @tician's install...

My guess is the library is up at: https://github.com/Interbotix/arbotix/tree/arduino-1-6/libraries/ArbotiX
2018-06-27 11:11:43
2018-06-28 09:04:34 willson
Thank you Kurt!
I'll check that library too.
2018-06-28 09:04:34
2018-06-28 16:02:39 urko_18
Yes that is! I´m using those things.
2018-06-28 16:02:39
2018-06-27 10:39:53
2018-06-28 16:05:47 urko


yesterday I saw the messages in the forum but i was ocupated, sorry.

I´ll try the options you have tell me, and I´ll tell to you the resuts that I obtain.

Thank you both of you


2018-06-28 16:05:47
2018-06-28 16:53:27 urko

I have tried to put the dxlReadPacket (current [servo]); and it actually reads the torques, but the problem is that it moves very slowly, it takes too long to make the movements because is waiting to read the torque so...

2018-06-28 16:53:27
2018-06-28 21:48:39 Kurt

I put in a more complete answer up on Trossen forum...

Shorter answer:

You can again turn off the response from the servos to set operations by changing the Status Return Level, of these servos from default 2 to 1, so it will so respond to query functions, but

set functions will not generate response.

How fast the servo will respond to a query (or currently set) operations is dictated by the Return Delay Time, which defaults to 254 or 508us.  I always set these to 0.

Without seeing current code, hard to know what else, but your older code on Trossen had inner loops moving one servo at a time with delays.  If still so, might help to setup code where

you try to move all of the servos concurrently and only one delay per each of these cycles.  Also maybe you need to tune those delays...

2018-06-28 21:48:39