PDA

View Full Version : Reuse arbotix ROS stack for a Robotis OpenCM9.04-B control board



corot
04-22-2014, 12:23 PM
I bet the title is already confussing and even non-sense... sorry, I'm new on low level control boards.

Well, what I have is a turtlebot arm but instead of the ArtiboX board, I bought the OpenCM9.04-B, and I'm wondering how to use it to control the arm in ROS without doing all the work from scratch. To my knowledge, there's nothing like the arbotix stack for the OpenCM9.04. So to integrate it on ROS, I should somehow replicate the arbotix stack changing the arduino code to match the Robotis API, right?

Can someone think in a easier way? I have no time (nor probably enough knowledge) to do that. I should I directly by an ArbotiX and forget the OpenCM9.04?

Thank you a lot

tician
04-22-2014, 12:40 PM
It should be relatively easy to modify the arbotix_ros -> arbotix_firmware to work with the CM-904. I have not tested the OpenCM ported BioloidController library recently, but it was working fine as of a few months ago. The constants and pin configurations will probably need to be changed and the calls to the arbotix's <ax12.h> library will have to be replaced with calls to the OpenCM's Dynamixel library, but none of that should be very difficult or even time consuming.

corot
04-22-2014, 04:45 PM
It should be relatively easy to modify the arbotix_ros -> arbotix_firmware to work with the CM-904. I have not tested the OpenCM ported BioloidController library recently, but it was working fine as of a few months ago. The constants and pin configurations will probably need to be changed and the calls to the arbotix's <ax12.h> library will have to be replaced with calls to the OpenCM's Dynamixel library, but none of that should be very difficult or even time consuming.

First of all, thank you for your ultra-fast answer!

I have taken a look to the ros.ino file and, biggest problem I see is that it's not well documented (or at least I cannot find any documentation). Looks like it communicates through his own serial protocol with the python code running on the PC (who in turns provides the ROS interface), but that protocol doesn't appear clear to me, to say the least. If I understand your point, my goal should be replicate such protocol but reading and writing to the controller using OpenCM's API, so I can keep the rest of the arbotix stack mostly untouched.

Am I right? Do I miss any important information?

Thanks again

tician
04-22-2014, 05:04 PM
You could basically go through the ros.h and ros.ino files looking for uses of the arbotix dynamixel library and replace them will calls to the OpenCM-904 dynamixel library. The BioloidController calls should be identical, but you have to change the #include header names a little bit. If you succeed in changing the firmware, then none of the other packages will need any changes at all. One important question is which interface you will use to connect the CM-904 to the PC. The SerialUSB object is not terribly reliable at higher speeds, but the more reliable USART of the 4-pin JST PH-series connector requires a USB2UART IC using 3.3V logic levels (the Robotis LN-101 is perfect for this). Only real difference between each approach in code is the name of the serial object used (SerialUSB or Serial2).

The firmware basically turns the arbotix into a dynamixel device accessible through the FTDI/Xbee UART and permit the pc to control all servos connected to its dynamixel bus. The pc sends new poses for the servos to the arbotix, and the arbotix then uses the interpolating motion engine to smoothly move the servos to their goal positions.

corot
04-25-2014, 04:47 AM
Hi tician, thank you very much again. I have realized that you ported PyPose to use it with the OpenCM and, as a preliminary step before trying to use it on ROS, I'm trying to make it work. As I posted in this quasy-tutorial (btw, are you the author, NaN?), I have a problem I cannot solve. Honestly, I don't really understand how the 253 + 7, 8, 9... "special commands for Arbotix" work, and so I'm having a hard time debugging this. I reproduce my error here below. Thanks for your time and help.

Hi NaN, great information. I'm able to run PyPose both on Windows and Linux, and seems to work (capture and relax do), but whenever I call "set pose" all the servos (5-dof arm) run to 0 position. PyPose output looks ok for the setPose function, but after that, when it tries to read again from the board, he complains he cannot find the 0xFF 0xFF that starts next message.

Any idea about what can be happening?
Thank you a lot

Here follows the output of set pose (failed) + relax (works):

Setting pose...
Setting pose size at 5
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff NOT found, restart: 48
Oxff NOT found, restart: 32
Oxff NOT found, restart: 110
Oxff NOT found, restart: 111
......many, many more.....
Oxff NOT found, restart: 42
Oxff NOT found, restart: 42
Oxff NOT found, restart: 10
*** Fail Read *** <---- more or less at this point all servos go suddenly to 0
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
Oxff found
Oxff found
ID found: 253
Length found: 2
Error level found: 0
Checksum found: 0
Checksum computed: 255
PyPose: relaxing servos...
*** Fail Read ***
Oxff found
Oxff found
ID found: 2
Length found: 2
Error level found: 0
Checksum found: 251
Checksum computed: 255
Oxff found
Oxff found
ID found: 3
Length found: 2
Error level found: 0
Checksum found: 250
Checksum computed: 255
Oxff found
Oxff found
ID found: 4
Length found: 2
Error level found: 0
Checksum found: 249
Checksum computed: 255
Oxff found
Oxff found
ID found: 5
Length found: 2
Error level found: 0
Checksum found: 248
Checksum computed: 255

tician
04-25-2014, 04:34 PM
I have not been keeping up with the OpenCM-IDE or robotsource forum, but that should hopefully change soon. Are you using the pypose sketch, or your own attempt to convert the ros sketch? Are you using the version of PyPose modified for the CM-9/904, or the Vanadium Labs version of PyPose for the arbotix?

corot
04-26-2014, 05:00 AM
Hi!
Yes, I use the pypose sketch shipped with Robotis' OpenCM. And for PyPose, I have tried both the Vanadium Labs repo and your fork, with the same result.

I'm trying to understand how PyPose sends the poses to pypose.ini.... cause I guess in my case all must be zero, for any reason

corot
05-03-2014, 07:15 AM
Hello again,

I have found the problem: MAX_NUM_SERVOS constant on pypose.ino must be equal to the actual number of servos you have. If not, BioloidController::readPose will spam the serial line with MAX_NUM_SERVOS - <real number of sensors> error messages saying that servo x was not found. And PyPose.py gets choked by all these bytes he doesn't expect.

I think this quite misguiding, as I expected MAX_NUM_SERVOS to be just a generic upper limit to allocate enough resources. But instead it's a parameter you must tweak for your own configuration. Or maybe I misunderstood the design, not sure.

Anyway, I'm ready now to attack the ROS interface... if I can find some spare time, what it's a lot to say, unfortunately.

Thank you a lot for your guiding; I'm afraid I'll need again on the next step, so... thank you again in advance ^_^