Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

programming a bioloid in C++, controlling it with a gamepad

Bioloid robot kit from Korean company Robotis; CM5 controller block, AX12 servos..
14 postsPage 1 of 1
14 postsPage 1 of 1

programming a bioloid in C++, controlling it with a gamepad

Post by animaniac » Tue Mar 22, 2011 12:18 am

Post by animaniac
Tue Mar 22, 2011 12:18 am

hi, I just bought a bioloid and I'm quite impressed by the package, but one thing I expected to find is a tutorial about how to program it as a generic robot using C++. do you have a software to advise me, and internet resources (tutorials, examples)? do you know if there is a way to convert bioloid programs (.bpg) to C++ programs?

another question, I own a PS2 dualshock gamepad, I use it on my computer with a USB adapter, any chance I can use it to control the bioloid in real time through the serial cable?

one more thing, why are bioloid servos so cheap, when they are far superior to classic ones (torque, feedback, continuous rotation...)?

thanks everyone
hi, I just bought a bioloid and I'm quite impressed by the package, but one thing I expected to find is a tutorial about how to program it as a generic robot using C++. do you have a software to advise me, and internet resources (tutorials, examples)? do you know if there is a way to convert bioloid programs (.bpg) to C++ programs?

another question, I own a PS2 dualshock gamepad, I use it on my computer with a USB adapter, any chance I can use it to control the bioloid in real time through the serial cable?

one more thing, why are bioloid servos so cheap, when they are far superior to classic ones (torque, feedback, continuous rotation...)?

thanks everyone
animaniac
Savvy Roboteer
Savvy Roboteer
Posts: 25
Joined: Wed Aug 25, 2010 8:56 pm

Re: programming a bioloid in C++, controlling it with a game

Post by billyzelsnack » Tue Mar 22, 2011 3:02 am

Post by billyzelsnack
Tue Mar 22, 2011 3:02 am

animaniac wrote:one more thing, why are bioloid servos so cheap, when they are far superior to classic ones (torque, feedback, continuous rotation...)?


The only thing that makes sense to me is they took the retail price of the Bioloid kit and divided by 20. 18 servos + 1 AX-S1 + 1 more servo because the original kit came with 19 servos.
animaniac wrote:one more thing, why are bioloid servos so cheap, when they are far superior to classic ones (torque, feedback, continuous rotation...)?


The only thing that makes sense to me is they took the retail price of the Bioloid kit and divided by 20. 18 servos + 1 AX-S1 + 1 more servo because the original kit came with 19 servos.
billyzelsnack
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 618
Joined: Sat Dec 30, 2006 1:00 am

Post by PedroR » Tue Mar 22, 2011 6:08 pm

Post by PedroR
Tue Mar 22, 2011 6:08 pm

Hi

I don't know which version of Bioloid you have but from the post I'm assuming you have the Comprehensive Kit.

You can download the old CM-5 C SDK for the CM-5 controller (used in the Comprehensive and Beginner kits) here http://forums.trossenrobotics.com/datac ... c-sdk-167/

For the CM-510 (the controller of the PREMIUM Kit) you can go to http://support.robotis.com and browse the website as they have the C SDK available there.

If you have the Comprehensive and would like to Upgrade to the new CM-510 Controller + LiPo please see here http://robosavvy.com/store/product_info ... ts_id/1244 (it's currently showing availability "Yellow" but they're expected to be back in stock by the beginning of April).
The CM-510 includes significant improvements such as the ATMEGA 2561, 6 external A/D ports (which in turn enable support for Gyro, Accelerometer, etc).
Hi

I don't know which version of Bioloid you have but from the post I'm assuming you have the Comprehensive Kit.

You can download the old CM-5 C SDK for the CM-5 controller (used in the Comprehensive and Beginner kits) here http://forums.trossenrobotics.com/datac ... c-sdk-167/

For the CM-510 (the controller of the PREMIUM Kit) you can go to http://support.robotis.com and browse the website as they have the C SDK available there.

If you have the Comprehensive and would like to Upgrade to the new CM-510 Controller + LiPo please see here http://robosavvy.com/store/product_info ... ts_id/1244 (it's currently showing availability "Yellow" but they're expected to be back in stock by the beginning of April).
The CM-510 includes significant improvements such as the ATMEGA 2561, 6 external A/D ports (which in turn enable support for Gyro, Accelerometer, etc).
PedroR
Savvy Roboteer
Savvy Roboteer
Posts: 1199
Joined: Mon Jun 16, 2008 11:07 pm

Post by animaniac » Tue Mar 22, 2011 6:49 pm

Post by animaniac
Tue Mar 22, 2011 6:49 pm

the CM-5 is still compatible with an accelerometer right? is it the "bus" plug? also, do you have a favorite program for creating and running programs? I am a beginner, so I'don't mind driving my robot from the computer. I'll learn the basics before going for a new controller.
the CM-5 is still compatible with an accelerometer right? is it the "bus" plug? also, do you have a favorite program for creating and running programs? I am a beginner, so I'don't mind driving my robot from the computer. I'll learn the basics before going for a new controller.
animaniac
Savvy Roboteer
Savvy Roboteer
Posts: 25
Joined: Wed Aug 25, 2010 8:56 pm

Post by PedroR » Tue Mar 22, 2011 6:58 pm

Post by PedroR
Tue Mar 22, 2011 6:58 pm

Hi Animaniac

The CM-5 is not compatible with an Accelerometer or any sensor other than the AX-S1 out of the Box. The CM-5 has no connectors for external sensors (either Analog or Digital).

There is a work around which is to design a board that connects to the Dynamixel bus (emulating a servo) and in turn you can connect the sensors to that board. (The AX-S1 sensor module itself is a board that connects to the bus and "pretends" to be a servo, respecting the servo protocol.)

There are some designs of those boards out there but none is supported officially by Robotis. One such example is this one http://www.bioloid.info/tiki/tiki-index ... l+IO+Board but I don't know about its availability.

By contrast the new CM-510 exposes 6 external connector/ports for Sensors/GPIO.
Each port supplies +5V, GND, Analog IN and a GPIO pin that you can set High or Low (typical example is connect this to power an LED).

The Bioloid PREMIUM for example includes an Analog Gyro that connects to 2 of these ports to supply analog readings of the X and Y axis.

Since these are generic ports you can connect any analog Sensor that works on the 0-5V range such as Gyros, Accelerometers, etc.

As for SPI and I2C none are supported on these controllers as far as I know (CM-5 or CM-510).
Hi Animaniac

The CM-5 is not compatible with an Accelerometer or any sensor other than the AX-S1 out of the Box. The CM-5 has no connectors for external sensors (either Analog or Digital).

There is a work around which is to design a board that connects to the Dynamixel bus (emulating a servo) and in turn you can connect the sensors to that board. (The AX-S1 sensor module itself is a board that connects to the bus and "pretends" to be a servo, respecting the servo protocol.)

There are some designs of those boards out there but none is supported officially by Robotis. One such example is this one http://www.bioloid.info/tiki/tiki-index ... l+IO+Board but I don't know about its availability.

By contrast the new CM-510 exposes 6 external connector/ports for Sensors/GPIO.
Each port supplies +5V, GND, Analog IN and a GPIO pin that you can set High or Low (typical example is connect this to power an LED).

The Bioloid PREMIUM for example includes an Analog Gyro that connects to 2 of these ports to supply analog readings of the X and Y axis.

Since these are generic ports you can connect any analog Sensor that works on the 0-5V range such as Gyros, Accelerometers, etc.

As for SPI and I2C none are supported on these controllers as far as I know (CM-5 or CM-510).
PedroR
Savvy Roboteer
Savvy Roboteer
Posts: 1199
Joined: Mon Jun 16, 2008 11:07 pm

Post by animaniac » Wed Mar 23, 2011 12:24 am

Post by animaniac
Wed Mar 23, 2011 12:24 am

I checked the URBI homepage thinking it would be an easy start to make custom program for the bioloid, but their bioloid page is a complete mess... do you know a good tutorial to program a bioloid with C++ or URBI? also, if you forget about the servo connectors, can a cheap USB to serial adapter replace the expensive bioloid one?
I checked the URBI homepage thinking it would be an easy start to make custom program for the bioloid, but their bioloid page is a complete mess... do you know a good tutorial to program a bioloid with C++ or URBI? also, if you forget about the servo connectors, can a cheap USB to serial adapter replace the expensive bioloid one?
animaniac
Savvy Roboteer
Savvy Roboteer
Posts: 25
Joined: Wed Aug 25, 2010 8:56 pm

Post by PedroR » Wed Mar 23, 2011 6:22 pm

Post by PedroR
Wed Mar 23, 2011 6:22 pm

Hi Animaniac

I already posted above the links to the official SDKs available for programming the Bioloid in C.

You are now mentioning a different thing which is connecting to the Servo bus directly from the computer.

To clarify you can program the Bioloid in the following manners:

1) Using the Graphical Robotis Software (Roboplus or Mtion Editor/Behaviour Control program)

2) Programming a new firmware for the controller. This is done in C and compiled with WinAVR. Once compiled, you install the firmware on the Robot micro controller (CM 5 or CM510).
The links and information in my post from March 22nd are the ones to do this which was what I understood you wanted to do.

3) As a third option, you can bypass the Robot's micro controller and use a USB2Dynamixel to connect your PC directly to the servo bus.
In this scenario, the PC can control all the devices (servos, AX-S1) in the Dynamixel bus and effectivelly control all the Robot.
You should google for "Dynamixel SDK" for samples on how to do this.
In this scenario you can program in any language but the code will always run on YOUR PC and your PC will need to be connected to the servo bus at all times.

There are Pros and Cons to each approach. Google and our forum have lots of information and projects of people who tried it in the three different manners.


As for your question about a cheap USB to to Serial adapter:
The Bioloid uses a one wire (half duplex) mechanism to communicate. This means both RX and TX are on the same wire.

The Robotis adapter, although expensive, is very good at managing the traffic that goes TO and FROM that single line and avoid colisions.

I believe you could in theory use a cheap USB to Serial converter but you need to do some hacking yourself.
What I've seen being done (assuming you don't kill the USB2Serial) is Short RX and TX on the cheap USB2Serial adapter and connect it to the DATA line on the Bioloid connector.
The problem with this is that because RX and TX are shorted everything that you send from the PC on TX will come back to the PC on the RX line. So you need to run an algorithm on the PC to eliminate the duplicate communication and filter out only the servo responses.

If you really want to do it, I recommend your search our forum as certainly somebody did this already.

Using the "expensive" Robotis USB2Dynamixel solves all these problems. It's expensive but it just works efficiently and without any complications.

Pedro.
Hi Animaniac

I already posted above the links to the official SDKs available for programming the Bioloid in C.

You are now mentioning a different thing which is connecting to the Servo bus directly from the computer.

To clarify you can program the Bioloid in the following manners:

1) Using the Graphical Robotis Software (Roboplus or Mtion Editor/Behaviour Control program)

2) Programming a new firmware for the controller. This is done in C and compiled with WinAVR. Once compiled, you install the firmware on the Robot micro controller (CM 5 or CM510).
The links and information in my post from March 22nd are the ones to do this which was what I understood you wanted to do.

3) As a third option, you can bypass the Robot's micro controller and use a USB2Dynamixel to connect your PC directly to the servo bus.
In this scenario, the PC can control all the devices (servos, AX-S1) in the Dynamixel bus and effectivelly control all the Robot.
You should google for "Dynamixel SDK" for samples on how to do this.
In this scenario you can program in any language but the code will always run on YOUR PC and your PC will need to be connected to the servo bus at all times.

There are Pros and Cons to each approach. Google and our forum have lots of information and projects of people who tried it in the three different manners.


As for your question about a cheap USB to to Serial adapter:
The Bioloid uses a one wire (half duplex) mechanism to communicate. This means both RX and TX are on the same wire.

The Robotis adapter, although expensive, is very good at managing the traffic that goes TO and FROM that single line and avoid colisions.

I believe you could in theory use a cheap USB to Serial converter but you need to do some hacking yourself.
What I've seen being done (assuming you don't kill the USB2Serial) is Short RX and TX on the cheap USB2Serial adapter and connect it to the DATA line on the Bioloid connector.
The problem with this is that because RX and TX are shorted everything that you send from the PC on TX will come back to the PC on the RX line. So you need to run an algorithm on the PC to eliminate the duplicate communication and filter out only the servo responses.

If you really want to do it, I recommend your search our forum as certainly somebody did this already.

Using the "expensive" Robotis USB2Dynamixel solves all these problems. It's expensive but it just works efficiently and without any complications.

Pedro.
Last edited by PedroR on Wed Mar 23, 2011 7:42 pm, edited 1 time in total.
PedroR
Savvy Roboteer
Savvy Roboteer
Posts: 1199
Joined: Mon Jun 16, 2008 11:07 pm

Post by Fritzoid » Wed Mar 23, 2011 6:48 pm

Post by Fritzoid
Wed Mar 23, 2011 6:48 pm

animaniac wrote:
if you forget about the servo connectors, can a cheap USB to serial adapter replace the expensive bioloid one?

If all you are interested in is an RS232 connection then an off-the-shelf USB to serial adapter can be used with the Robotis serial cable. Be aware though that some USB adapters work better than others due to timing considerations.
animaniac wrote:
if you forget about the servo connectors, can a cheap USB to serial adapter replace the expensive bioloid one?

If all you are interested in is an RS232 connection then an off-the-shelf USB to serial adapter can be used with the Robotis serial cable. Be aware though that some USB adapters work better than others due to timing considerations.
Fritzoid
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 331
Joined: Mon Dec 18, 2006 1:00 am

Post by animaniac » Sun Apr 03, 2011 7:43 pm

Post by animaniac
Sun Apr 03, 2011 7:43 pm

I tried to download winAVR to flash the CM5 with the urbi firmware and HOLY CRAP THERE'S LIKE A 100 .EXE IN HERE!!! do you know how I can use winAVR to load the firmware?
I tried to download winAVR to flash the CM5 with the urbi firmware and HOLY CRAP THERE'S LIKE A 100 .EXE IN HERE!!! do you know how I can use winAVR to load the firmware?
animaniac
Savvy Roboteer
Savvy Roboteer
Posts: 25
Joined: Wed Aug 25, 2010 8:56 pm

Post by billyzelsnack » Sun Apr 03, 2011 11:24 pm

Post by billyzelsnack
Sun Apr 03, 2011 11:24 pm

Probably AVRDUDE, but you'll need to know a bunch of commandline arguments. I would bet the URBI project has some sort of makefile/script to do this.
Probably AVRDUDE, but you'll need to know a bunch of commandline arguments. I would bet the URBI project has some sort of makefile/script to do this.
billyzelsnack
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 618
Joined: Sat Dec 30, 2006 1:00 am

Post by animaniac » Sun Apr 03, 2011 11:29 pm

Post by animaniac
Sun Apr 03, 2011 11:29 pm

actually, I tried to use winAVR because the urbi tutorial to use the robot terminal for loading the URBI firmware in the CM5 doesnt work for me: when I type LOAD it just tells me bad command.
actually, I tried to use winAVR because the urbi tutorial to use the robot terminal for loading the URBI firmware in the CM5 doesnt work for me: when I type LOAD it just tells me bad command.
animaniac
Savvy Roboteer
Savvy Roboteer
Posts: 25
Joined: Wed Aug 25, 2010 8:56 pm

Post by MOHIT JINDAL » Tue Apr 05, 2011 2:22 am

Post by MOHIT JINDAL
Tue Apr 05, 2011 2:22 am

Hi PedroR,
I also want to control all Ax12+ with Usb2Dynamixel but Robotis give code for only 3 Dynamixels. Can you help me with a code to control 25 Ax12A from Usb2Dynamixel ? :roll:
Any idea to control 30 Ax12A from Roboplus motion or Usb2Dynamixel :?:
Please Help
Thanks :D
Hi PedroR,
I also want to control all Ax12+ with Usb2Dynamixel but Robotis give code for only 3 Dynamixels. Can you help me with a code to control 25 Ax12A from Usb2Dynamixel ? :roll:
Any idea to control 30 Ax12A from Roboplus motion or Usb2Dynamixel :?:
Please Help
Thanks :D
MOHIT JINDAL
Savvy Roboteer
Savvy Roboteer
Posts: 178
Joined: Wed Nov 10, 2010 7:43 am

Post by PedroR » Tue Apr 05, 2011 3:38 pm

Post by PedroR
Tue Apr 05, 2011 3:38 pm

Hi Mohit

I am not familiar with the sample code from Robotis. However it should not be hard to extend it from 3 servos to more servos.

As long as you understand how the Dynamixel protocol works it should be fine to add more servos.

Regards
Pedro.
Hi Mohit

I am not familiar with the sample code from Robotis. However it should not be hard to extend it from 3 servos to more servos.

As long as you understand how the Dynamixel protocol works it should be fine to add more servos.

Regards
Pedro.
PedroR
Savvy Roboteer
Savvy Roboteer
Posts: 1199
Joined: Mon Jun 16, 2008 11:07 pm

Post by garycmartin » Tue Apr 05, 2011 6:38 pm

Post by garycmartin
Tue Apr 05, 2011 6:38 pm

Hi Mohit,

MOHIT JINDAL wrote:Hi PedroR,
I also want to control all Ax12+ with Usb2Dynamixel but Robotis give code for only 3 Dynamixels. Can you help me with a code to control 25 Ax12A from Usb2Dynamixel ? :roll:
Any idea to control 30 Ax12A from Roboplus motion


FWIW, Roboplus Motion is documented to control up to 26 servos (ID 0 to 25). Roboplus Task seems to indicate the same, only allowing ID's from 0 to 25 (if you type a larger integer it changes it to 0). Note that there does seem to be a bug in Task for ID values of 24 or 25, if you try to use them it always enters ID 23 into the script. Luckily I only have 20 servos to control just now ;-)
Hi Mohit,

MOHIT JINDAL wrote:Hi PedroR,
I also want to control all Ax12+ with Usb2Dynamixel but Robotis give code for only 3 Dynamixels. Can you help me with a code to control 25 Ax12A from Usb2Dynamixel ? :roll:
Any idea to control 30 Ax12A from Roboplus motion


FWIW, Roboplus Motion is documented to control up to 26 servos (ID 0 to 25). Roboplus Task seems to indicate the same, only allowing ID's from 0 to 25 (if you type a larger integer it changes it to 0). Note that there does seem to be a bug in Task for ID values of 24 or 25, if you try to use them it always enters ID 23 into the script. Luckily I only have 20 servos to control just now ;-)
garycmartin
Savvy Roboteer
Savvy Roboteer
Posts: 42
Joined: Fri Jan 15, 2010 9:27 pm


14 postsPage 1 of 1
14 postsPage 1 of 1