[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:
[caption id="attachment_47" align="alignnone" width="547"] Single controller[/caption]
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 button
- 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)
[sourcecode language="c"]
#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
[/sourcecode]
C# example os use:
[sourcecode language="csharp"]
private void B_ReadPort_Click(object sender, EventArgs e)
{
byte function = (byte)NUD_Function.Value;
byte portId = (byte)NUD_Port.Value;
if (portId < 0 || portId > 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 >= 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 >= 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;
}
}
}
}
}
}
[/sourcecode]
I am unable to get you firmware loaded onto the CM-510. I'm using the Roboplus Terminal to try to transmit the file. With the CM-510 power off I connect with the terminal program, hold Shift-3 to get into the boot loader and then choose 'Transmit File' from the 'Files' menu to transmit the TossModeJCA.hex file. While the terminal echos the file being transmitted there are numerous lines claiming that there is a "Bad Command". I would have included the output from the terminal, but they've used a control that apparently doesn't allow text selection. Any help you could provide would be great.
ResponderEliminarI think you missed the load command, typing "l" and [Enter] before 'Transmit file" You can see it at
ResponderEliminarhttp://support.robotis.com/en/techsupport_eng.htm#software/embeded_c/cm510_cm700/programming/bootloader/program_install.htm
Thank you, that was indeed the problem. Works as advertised now. Thanks again.
ResponderEliminarI think that you would need this example:
ResponderEliminar[sourcecode language="c"]
private static int getSensorValueCommand(byte[] buffer, byte function, byte port)
{
int pos = 0;
buffer[pos++] = 0xff; // header
buffer[pos++] = 0xff; // header
buffer[pos++] = idCM510; // CM510 ID=200
buffer[pos++] = 0x04; // length
buffer[pos++] = 0x02; // instruction 2 = read
buffer[pos++] = function; // function = 1
buffer[pos++] = port; // port
byte checksum = Util.checkSumatory(buffer, pos);
buffer[pos++] = checksum;
return pos;
}
[/sourcecode]
Hi Jose,
ResponderEliminarthanks for all the Bioloid samples on your site! I am trying to control dynamixels via CM-510 from my PC (via a serial link to USB2Dynamixel connected to PC). I wonder if I need a "special" firmware for this or if the standard Robotis firmware has a "toss mode"? Do you I need to reflash teh firmware to have this toss mode or not?
Thanks!
Hi, Nikolai
ResponderEliminarThe standard Robotis firmware already has the Toss Mode, then you can connect your PC to the CM-510 (or CM-5) with the serial cable. If you don't havea serial port in your PC you can use the USB2Dynamixel as USB to serial converter, REMEMBER to change the USB2Dynamixel little switch!
But if you have a USB2Dynamixel you only need the CM-510 for powering your Dynamixels, using the USB2Dynamixel for sending the commands to them :)
Hi, the link for the firmware is dead. Any chance of update? ;) Thanks!
ResponderEliminarHi, it's TossModeJCA.zip,
ResponderEliminarSorry, byethost is awful!
Thanks, you were pretty fast on this one! I'll study this carefully. Sorry to have bothered you this much these days... :) But still can't solve my update rate issues (is it normal I cannot go beyond 10Hz for writing instructions?) :D
ResponderEliminarI think you can go far beyond 10Hz!
ResponderEliminar