Tuesday, January 11, 2011

Interfacing Dynamixel Motors using C based usb2dynamixel sdk

Recently, I got my hands onto a Bioloid Kit ( yes the small humanoid robot from http://www.trossenrobotics.com/bioloid-comprehensive-robot-kit.aspx ). The kit consists of about 18 amazing AX-12 dynamixel in addition to the other lego-like plastics and a CM-510 controller.

In this post, I'll talk you through interfacing the AX-12 series motor directly to a computer via a usb2dynamixel dongle using the usb2dynamixel's C sdk. So, whats the big deal about dynamixel motors?



Dynamixel motors are similar to traditional servo motors as they both are position-based motors. ie. you can specify the absolute angle the motors have to turn to instead of the more traditional velocity based motors where you specify the angular velocity. But, that's where their similarities end.

The dynamixel motors allow far greater control over how the motors move with approx 50 variables to play with from the more obvious goal frames to max allowable torque, moving speed, present load, present temperature, etc. For more info checkout the specifications pdf

http://www.robosavvy.com/RoboSavvyPages/Support/Bioloid/AX-12(english).pdf

These dynamixel motors can be manipulated from a computer directly using a usb2dynamixel dongle (comes along with the kit).


For linux and windows there exists a C based usb2dynamixel sdk that allows communication with the device. Here's the link to download page

http://support.robotis.com/en/software/dynamixel_sdk/usb2dynamixel/usb2dxl_linux.htm

Before you click the link above and close the tab to this blog let me warn you - "Interfacing the dynamixel motor is not that straight forward as it may seem". I ran into a lot of trouble ignoring the web and trusting my stupid instincts (hey wait a sec, don't be a saint. I bet u've done the same and that's landed you on my blog).

Lets get to the usb2dynamixel dongle interfaced first. This interfacing is independent of the motors. On my ubuntu 10.10 (64-bit) the interfacing worked out of the box. Just lsusb in your terminal and you should see the device detected. This is it. If you run the sample Read-Write example on the usb2dynamixel sdk, it should read success on detecting the dongle. There have been some issues on this front on other OSes (speed of usb driver will have to be changed to work @ 1Mbps through recompilation of the drivers).

Next, lets work out the wiring of the AX-12 motor. The AX-12 motors can be daisy chained (google it for more info). So, multiple motors can be connected through a single dongle. For sake of simplicity of wiring we shall use only one motor for now. Connect the AX-12 via the TTL slot (3-pin socket - specific for AX-12 series). Make sure u select the TTL using the 3-way switch.

Then, you need to power up the motors. This was a source of trouble for me. These motors draw upto 900 mA of current, hence you cannot power them through the usb dongle. Each motor has two 3-pin sockets. One of them will be used to connect to the dongle. The other can be used to power the motor.

I used the 12 V battery that came along with the kit. You could use anything from a 6 V to a 12 V to power up the motors. Then read the info on page 9 in the following pdf

http://www.crustcrawler.com/electronics/USB2Dynamixel/docs/ConnectingAX12toUSB2Dynamixel_Rev0.1.pdf

by John Raffensperger. It contains the pin connections required to power the motor. On powering up the motors, the red LED on the AX-12 should blink and then go off. Make sure you spend some time figuring the cablework to connect the motor to power supply in a neat fashion.

This concludes the wiring of the motor. The motor is now ready to be controlled via the Read-Write example in the sdk. You, however, need to recompile the code after changing the DEFAULT ID in the ReadWrite.c file from "1" to that of the motor connected.

On execution, the motor should turn through 300 degrees. Thats it.

In the next post, I will submit a simple ROS driver module that shall allow control any number AX-12 (daisy chained of course) through ROS services.

1 comment: