Archive

Choose hardware, firmware and language

This entry is part 1 of 3 in the series Programming Robotis Bioloid hardware

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,…

Linux C++ Dynamixel reading and writing example

C# Dynamixel reading and writing example

Practical C++ programming tutorial for Bioloid

Programming Bioloid: choose hardware, firmware and languages

Programming Bioloid: choose hardware, firmware and languages

Robotis officially 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.

Start learning!

If you want to start learning how to program your CM-5 or CM-510 controller you will find interesting this post “Start programming  CM-5/CM-510 in C“. But may be you prefer to control your robot from a PC, SBC or other computer in C++ or C#

Learning scurves with AX-12

This entry is part 2 of 3 in the series Programming Robotis Bioloid hardware

I’m learning how to use scurves with AX-12, so I’ve created a test CM-510 C program where I try different approachs. Any help will be very well received, because my goal is to control several AX-12 and I’m far far away from it!

Here is the program with an spreadsheet with the calculations (LibreOffice and Excel). I have started from an old post from Bullit in the Tribotix forum (now in PDF format at Robosavvy)

Clockwise is the standard motion, counter clockwise is the scurve intended motion

CM-510 as a multiple sensor dynamixel item (updated 21/03/2014)

This entry is part 3 of 3 in the series Programming Robotis Bioloid hardware

[UPDTATE 21/03/2014] TossModeJCA v6.5. More information and examples at (I) Reading sensors connected to Robotis CM-510. Here you have the source files.

New functions added:

#define F_GET_BATTERY_MILLIVOLTS 6
Get the current battery voltage

#define F_SET_BATTERY_LOW_LEVEL_THRESHOLD 20
Set low battery warning (two red led will be on, PLAY and AUX)

#define F_SET_BATTERY_VERY_LOW_LEVEL_THRESHOLD 21
Set VERY low battery warning, all leds on

Apart from toss commands to Dynamixel devices, All the functions CM-510 could perform are:

#define F_NO_FUNCTION  0
No function, only to initialize values

#define F_GET_SENSOR_VALUE_RAW  1
Read sensor value

#define F_GET_TWO_DMS_SENSOR_VALUES 2
[Experimental] Read 2 sensor values in one query and one answer

#define F_GET_MULTIPLE_SENSOR_VALUE 3
[Experimental] Read several sensor values in one query and one answer

#define F_GET_SENSOR_VALUE_FILTERED  4
Read sensor value, avoiding maximum and minimum values

#define F_SET_SENSOR_VALUES_TO_FILTER 5
Number of readings that will be filtered

#define F_GET_BATTERY_MILLIVOLTS 6
Get the current battery voltage

#define F_SET_BATTERY_LOW_LEVEL_THRESHOLD 20
Set low battery warning (two red led will be on, PLAY and AUX)

#define F_SET_BATTERY_VERY_LOW_LEVEL_THRESHOLD 21
Set VERY low battery warning, all leds on

#define F_BEEP 8
If there is a buzzewr it beep, if no buffer it blinks

#define F_DO_SENSOR_SCAN 9
[Experimental!!!] Using servo ID 13 runds from 300 to 700 reading and return servo por where max value read

#define F_SET_VALUE_DMS1Port 11
Set the port for the first sensor

#define F_SET_VALUE_DMS2Port 12
Set the port for the second sensor

[UPDATE 7/11/13: CM_510 TossModeJCA updated to v5.8. Several parameters error fix and somewhat faster]

My main Bioloid project is to build a robot that will have some interesting (non easily predictable but reasonable) behaviours. AntOne 3.6 is the last version:

AntOne 3.6 is based on 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:

Single controller

Single controller

Updated 23/2/2013

The new hex file v4.3 (the old CM-510 firmware)

Now it supports new functions, as:

– Toss Mode (up) now can read from Dynamixel and write to serial and, as the previous version, read from serial and write to Dynamixel, it allows to….
– receive from zigbee and send the data to the Dynamixel bus
– read raw sensor values
– averaged sensor values when F_SET_SENSOR_VALUES_TO_FILTER is set < 5, not including the min and the max when >= 5
– CM-510 beep
– sensor scan (still in development)

#define F_NO_FUNCTION 0
#define F_GET_SENSOR_VALUE_RAW 1
#define F_GET_TWO_DMS_SENSOR_VALUES 2
#define F_GET_MULTIPLE_SENSOR_VALUE 3
#define F_GET_SENSOR_VALUE_FILTERED 4
#define F_SET_SENSOR_VALUES_TO_FILTER 5

#define F_BEEP 8
#define F_DO_SENSOR_SCAN 9
#define F_SET_VALUE_DMS1 11
#define F_SET_VALUE_DMS2 12

C# example os use:

       private void B_ReadPort_Click(object sender, EventArgs e)
        {
            byte function = (byte)NUD_Function.Value;
            byte portId = (byte)NUD_Port.Value;

            if (portId &amp;lt; 0 || portId &amp;gt; 6)
                portId = 1;

            string strPortId=portId.ToString();

            if (function == 1 || function == 4)
            {
                short portValue = cm510.getSensorValue(function, portId);
                string str = portValue.ToString();

                TB_PortValue.Text = str;
            }
            else
            {
                if (function == 2)
                {
                    byte[] parameters = new byte[3];
                    parameters[0] = function;
                    parameters[1] = Convert.ToByte(TB_DMS1_ID.Text);
                    parameters[2] = Convert.ToByte(TB_DMS2_ID.Text);

                    short[] values = new short[3];
                    cm510.getMultipleSensorValue(parameters, values);
                    //cm510.getTwoSensorValue(function, Convert.ToByte(TB_DMS1_ID.Text), Convert.ToByte(TB_DMS2_ID.Text), values);

                    if (values.Length &amp;gt;= 2)
                    {
                        TB_DMS1_PortValue.Text = values[1].ToString();
                        TB_DMS2_PortValue.Text = values[2].ToString();
                    }
                }
                else
                {
                    if (function == 3)
                    {
                        byte[] parameters = new byte[3];
                        parameters[0] = function;
                        parameters[1] = Convert.ToByte(TB_DMS1_ID.Text);
                        parameters[2] = Convert.ToByte(TB_DMS2_ID.Text);

                        short[] values = new short[3];
                        cm510.getMultipleSensorValue(parameters, values);

                        if (values.Length &amp;gt;= 2)
                        {
                            TB_DMS1_PortValue.Text = values[1].ToString();
                            TB_DMS2_PortValue.Text = values[2].ToString();
                        }
                    }
                    else
                    {
                        if (function == 11)
                        {
                            TB_DMS1_ID.Text = strPortId;
                        }
                        else
                        {
                            if (function == 12)
                            {
                                TB_DMS2_ID.Text = strPortId;
                            }
                        }
                    }
                }
            }
        }

%d bloggers like this: