Bioloid combinations of hardware, firmware and programming languages

February 11th, 2012

Choose hardware, firmware and language

There are a lot of possible combinations of hardware, firmware and languages for programming Bioloid. I think that the table below show the the main combinations.

You can choose from the easy but limited Robotis own tool (Roboplus Task) and only your CM-5 or CM-510 to a SBC or “embedded” PC like Roboard and any language which can manage a serial port connection, like C, C++, Java, Python,…

Programming Bioloid: choose hardware, firmware and languages

Programming Bioloid: choose hardware, firmware and languages

Robotis oficially supports the programming solutions with the blue background:

  • The dark blue, RoboPlus Tasks , is the only one in which you can create the motions with RoboPlus Motion and execute it in CM-5/CM-510 with the program create with RoboPlus Tasks, after downloading the generated executable into the CM-5/CM-510, of course.

With these programming solutions you can use the Zigbee SDK to send and receive data between the CM5-/CM-510 and any computer, using Zig-110A or the new bluetooth BT-110 , the Zig2Serial and the USB2Dynamixel . You can download example in Visual Basic .Net, C# and Visual C++

But there are more options!

Using a PC, SBC (Single Board Computer), PDA, Mobile or other light and battery powered computer

Using a serial port connection with your more beloved programming language:

  • USB2Dynamixel

If you have any device with a USB host and a FTDI driver you can use USB2Dynamixel to command programatically your Dynamixel servos using the Dynamixel protocol . You only will need your CM-5 or CM-510 to connect your Dynamixel to the battery.

  • Serial port cable

Same as the previous option but instead of using the USB2Dynamixel you only will need the serial cable and the “Toss Mode” launched with the ‘t' command from the “Manage Mode”

  • Wireless control

Instead of only sending and receiving data, with the previous wireless connections you can command remotely your robot using the standard firmware and the “Toss Mode” launched with the ‘t' command from the “Manage Mode”. You will need to command it using the Dynamixel protocol .

With these options and the CM-510 you will find a little problem… there is no way to read your sensor values! Well, you can use this firmware that offers a “Toss Mode” that supports reading CM-510 ports.

 

Programming AX-12+ in C#

December 26th, 2011

A simple example showing how to write a read Dynamixel AX12+ position in C#; as always, it can be used too for serial cable communications, USB2Dynamixel and indeed Zigbee

Writing Dynamixel AX12+ position in C++

December 11th, 2011

Writing Dynamixel AX12+ position can be used too for serial cable communications, USB2Dynamixel and indeed Zigbee

Simple C++ class example using serial port

December 11th, 2011

This code can be used (of course) for serial cable communications, USB2Dynamixel and indeed Zigbee

Robotis Bioloid 6x6 rocker-bogie suspension little "Mars Curiosity"

Deceember 8th, 2011

¿Te gustaría leer los artículos en español?

November 25th, 2011

¿Te gustaría poder leer los artículos en español? ¡Pídelo!

In English: Would you like read these posts in spanish? (Well, if you understand english, probably, it's all the same to you)

New "Programming Bioloid" site: Software Souls

November 24th, 2011

I'm creating a new site to publish the articles. I hope you like it: Software Souls:


Reading Dynamixel AX12+ position

November 14th, 2011

The intent of this code is to be clear and easy to understand, it not pretend to be the best code to do the job. By the way, this great HTML formatting has been created with http://www.bedaux.net/cpp2html

This method create the command to read the position. :

int Dynamixel::getReadAX12PositionCommand(byte id)
{

    //OXFF 0XFF ID LENGTH INSTRUCTION PARAMETER1 …PARAMETER N CHECK SUM
    int pos = 0;

    buffer[pos++] = 0xff;

    buffer[pos++] = 0xff;
    buffer[pos++] = id;

    // length = 4
    buffer[pos++] = 4; //placeholder

    //the instruction, read => 2
    buffer[pos++] = 2;

    // pos registers 36 and 37
    buffer[pos++] = 36;

    //bytes to read
    buffer[pos++] = 2;

    byte checksum = checkSumatory(buffer, pos);
    buffer[pos++] = checksum;

    return pos;
}
And this one will send the command to the Dynamixel bus:
int Dynamixel::getPosition(SerialPort *serialPort, int idAX12) 
{

	int ret=0;

	int n=getReadAX12PositionCommand(idAX12);

	long l=serialPort->sendArray(buffer,n);
	Sleep(2);

	memset(bufferIn,0,BufferSize);
	n=serialPort->getArray(bufferIn, 8);

	short pos = -1;
	if (n>7)
	{

		pos = fromHexHLConversion(bufferIn[5], bufferIn[6]);				
	}

	if (pos<0 || pos > 1023)
		ret=-2;

	else
		ret=pos;

	return ret;
}
Do you have doubts or comments?

Practical C++ programming tutorial for Bioloid robots

November 14th, 2011

This is the main block of a simple Dynamixel example program using serial port.

Do you want to use the usb2dybnamixel? Changing it will be very easy.

int _tmain(int argc, _TCHAR* argv[])
{

	int error=0;
	int idAX12=17;

	SerialPort serialPort;
	Dynamixel dynamixel;	    

    
	if (serialPort.connect(L"COM1")==0) {

		dynamixel.sentTossModeCommand(&serialPort);
		
		int pos=dynamixel.getPosition(&serialPort, idAX12);

		if (pos>250 && pos <1023)
			dynamixel.setPosition(&serialPort, idAX12, pos-100);

		else
			printf ("\nPosition <%i> under 250 or over 1023", pos);

		serialPort.disconnect();
	}
	else {
		printf ("\nCan't open serial port");

		error=-1;
	}

	return error;	
}

CM-5 "Hello World" C program

October 23th, 2011

This post try to explain how to compile, load in the CM-5 (transmit) and execute a C program (a servo version of the "Hello World" classic example).

What do you need?

Obviously, some Bioloid hardware:

- The CM-5

- The battery or power source

- The serial cable

- An AX-12

- A cable to connect the AX-12 with the ID 17 to the CM-5. You can change the ID in the program.

What should you do?

1. Download and install the software:

1.- Download and install the Robotis RoboPlus software.

2.- Download and install WinAVR

3.- Download a Hello World example for WinAVR.

The C “Hello World” servo program is based in the original Robotis example.

4.- You should create a folder for your CM-5 program, for example c:\myprojects\cm5\helloworld Copy there the previously downloaded helloworld.zip and unzip it.

2. Compile and link the program

1. Execute WinAVR and open the unzipped project:

( Bioloid User's Guide.pdf could help you using WinAVR)

 

You should change the ID 17 of the servo for the ID of the servo you are using

 

2.- Compile and link. Make all:

 

3.- You should see “Errors: none”

 

4.- Transmit and execute the helloworld.hex to the CM-5

( Here you can find more info )

Well, if you only want to test the executable, you can download only the hex.

When loaded you should see an screen with two equal values as a correct "Checksum" check (in this example the value is 81, it's calculated from the source code). If the values are not equal there is an error in the transmission.

 

5.- Every time you press the red MODE button the servo should spin

C# or C++ practical programming tutorial for Bioloid robots?

October 6th, 2011

Would you be interested in free a C# or C++ programming tutorial for Bioloid robots?


So ... send an email to

with your choice!

CM-510 as a multiple sensor dynamixel item

July 30th, 2011

My main Bioloid project is to build a robot that will have some interesting (non easily predictable but reasonable) behaviours.

I think that the source code and some comments could be used as help or an advanced tutorial about programming and ATMega with C.

AntOne 3.6 is based in a PDA that has the software for the behaviour and a CM-510 (ATMega 2561) that control the hardware (servos and sensors). But I discovered that standard CM-510 firmware has no command to get sensor values, so I programmed another with that function. But then I thought that it would be interesting to embed some perception functions in the CM-510.

This is a general diagrama:

More info at Software souls

Robotis Bioloid 4x4 omni directional

July 6th, 2011

Robotis Bioloid hexapod with HP Ipaq brain

June 12th, 2011



More info here

The birth of an awesome AX-12 firmware

June 12th, 2011

At ActuatedCharacter are working hard creating a Bioloid that will run and jump. As part as this project they have create an awesome new firmware for the AX-12 servo "to have the fastest possible closed loop control". Here the CM-5 firmware.

Some features:
  • Static control, control of the goal position with PID algorithm.
  • Dynamic control, control of the speed when dislocating to the goal position also using PID algorithm.
  • WM control, direct control of the PWM that goes to the electric motor.
  • Chain reply, reply of all servos positions, in chain, with a single packet request from the master.
  • ...

More here.

Bioloid and Arduino

April 4th, 2011

Bioloid controllers, CM-5(ATMega128) and CM-510 (ATMega2561), and Arduino (ATmega168) use very similar ATMega microcontrollers, so it's easy to use Arduino to control AX-12 servos. But, obviously, yo should have a working knowledge about ATMega microcontrollers programming. You can get detailed information and source code in the next links:

- Arduino library for AX12
- Hylands source code for AVR (search Bioloid projects)
- Pablo Gindel Arduino library for AX12 (spanish)

How to start programming CM-5/CM-510 with C

August 30th, 2010

From time to time I receive questions about how to start programming the CM-5/CM-510 with C.

I think it’s necessay to have a working knowledge about:

1. C programming

2. CM-5/CM-510 programming

3. Dynamixel protocol

1. C programming

I think “C Programming for Microcontrollers is a fast and very practical introduction to C and microcontrolers programming, but I’m a not sure if it an easy way to start learning C.If you a want a more structured and deeper introduction to the C programming language, this is a pretty good and free introduction:

C introduction (pdf)

But there are a lot…

C Language Tutorial (html)
How C Programming Works (html)
Several C programming tutorials (html)

and more from Google

2. CM-5/CM-510 programming

From Robotis support website CM-5/CM-510 programming

3. Dynamixel protocol

From Robotis support website Dynamixel actuator

Two others great sources of information are:

Robosavvy Bioloid information wiki

Source code of Stuart&Matt library

I hope it helps :)

Reading Bioloid Premium CM-510 by the serial cable o usb2dynamixel

June 6th, 2010

I’m creating a little program for the CM-510 that could be used to get sensor values from a PC (or other extern controller) with the standard dynamixel protocol and with :

- the usb2dynamixel and any language you want that supports serial comms or using the Robotis libraries (C, C++, Java, C#, …)
- or the standard serial cable and any language that support serial communications
This program set the CM-510 (with their sensors) as if it were another standard dynamixel itemthat you can query.

Bioloid soporta desarrollo con Linux

April 28th, 2010

Buscando información en la web de ayuda de Robotis (inglés) sobre mi recién comprado Premium Upgrade (que da mucho más juego del que yo pensaba y que pronto comentaré) me he llevado otra grata sorpresa:

Dynamixel SDK for Linux

¡SDK (Software Development Kit) de Dynamixel (es la familia de servos a la que AX-12+ pertenece) para Linux!

¡Y también para Zigbee! Zigbee SDK for Linux

Easy programming for the PC and for the CM-5

December 17th, 2008

Easy programming in the PC with these libraries created by Robotis:

USB2Dynamixel Software v1.01

- Dynamixel Manager.exe : Dynamixel Manager Program Execution File
- Dynamixel SDK(U2D win32).html : Dynamixel Manager Manual
- Examples : Example Source Folder:

  • java
  • labview
  • matlab
  • python
  • visual basic
  • visual c#
  • visual c++

By the way, there is the “monitor” command in the “Manage mode” to monitor the data flow …

Not as easy but far easier than from scracth using this great C library from SturatL& Matt

More info here

C Programming for the Bioloid CM-5

April 28th, 2008

You should get used to the WinAVR environment, it uses “make”, and a must is to know the AX12+ protocol and the some knowledge about programming ATMega128.

The next few lines are the core to positioning an AX12+ motor with the C programming language:(It requires some communication and interruption initialization functions, below you can download the full example)

gbpParameter[0] = P_GOAL_POSITION_L; //Address of goal
gbpParameter[1] = 0×00; //Writing Data P_GOAL_POSITION_L
gbpParameter[2] = 0×02; //Writing Data P_GOAL_POSITION_H
gbpParameter[3] = 0×00; //Writing Data P_GOAL_SPEED_L
gbpParameter[4] = 0×01; //Writing Data P_GOAL_SPEED_H
bTxPacketLength = TxPacket(bID,INST_WRITE,5);
bRxPacketLength = RxPacket(DEFAULT_RETURN_PACKET_SIZE);

TxPacket uses the global gbpParameter array to receive the parameters, and bID is the AX12+ ID to move.
You should have a working knowledge about the AX12+ protocol explained “AX-12.pdf“, you should have understood the chapter “9. Information for Advanced Users” from the Bioloid User’s Guide.pdf” (version 1.0, because it’s not included in later versions).

You can download helloworld project for “Programmers Notepad [WinAVR]” (zip). It’s the Robotis example but splitted in 3 files for clearity and modularity:

1.Declarations from Robotis in “robotis.h”
2. The body of the functions in “robotis.c”
3. The most simple example that moves the AX12+ servo with id 15 to position 512, in “helloworld.c”

[Spanish/Español]
Manejar el entorno WinAVR, que a su vez utiliza make, conocer el protocolo de los AX12+ y programación del ATMega128.

Para mover un motor desde el CM-5 en C el meollo sería este trozo (extraído del ejemplo de Robotis):

gbpParameter[0] = P_GOAL_POSITION_L; //Address of goal
gbpParameter[1] = 0×00; //Writing Data P_GOAL_POSITION_L
gbpParameter[2] = 0×02; //Writing Data P_GOAL_POSITION_H
gbpParameter[3] = 0×00; //Writing Data P_GOAL_SPEED_L
gbpParameter[4] = 0×01; //Writing Data P_GOAL_SPEED_H
bTxPacketLength = TxPacket(bID,INST_WRITE,5);
bRxPacketLength = RxPacket(DEFAULT_RETURN_PACKET_SIZE);

Pero antes requiere unas cuantas funciones de inicialización de interrupciones y comunicaciones. TxPacket utiliza el array global gbpParameter para recibir los parámetros y bID es el ID del AX12+ a mover.

Un requisito previo es tener claro el protocolo de los AX12+, manual “ AX-12(english).pdf “, y haberse estudiado el tutorial de Robotis del capítulo “ 9. Information for Advanced Users ” del manual “ Bioloid User's Guide.pd f” (versión 1.0, ya que en las posteriores no se ha incluido).

Adjunto proyecto helloworld hecho con el “Programmers Notepad [WinAVR]” en un zip. Es el ejemplo de Robotis pero en tres ficheros:

1.Las declaraciones de robotis en “robotis.h”
2.El cuerpo de las funciones de robotis en “robotis.c”
3.El ejemplo más sencillo posible, mueve el motor con id 15 a la posición 512, en “helloworld.c”

April 27th, 2008

[Español]

En este blog iré incluyendo todo lo que he aprendido sobre cómo programar Bioloid.

- Conectado a un PC mediante cable serie o USB2Dynamixel. En C, C++, C# y Java

- En C en el propio CM-5.

Además de información no documentada pero incluida en el firmware como Toss mode y Monitor.

[English]

In this blog I will be including everything what I have learned on how programming Bioloid.

- Connected to a PC by means of serial cable or USB2Dynamixel In C, C++, C# and Java

- In C on the CM-5 Besides information not documented but included in the firmware like Toss mode and Monitor.