Archive for: November 2011

Reading Dynamixel AX-12+ position

This entry is part 2 of 5 in the series Bioloid C++ tutorial

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.

This method create the command to read the AX-12+ 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;
}

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]);
	}

	printf("nid=<%i> pos=<%i> length=<%i>n", idAX12, pos, n);
	if (pos<0 || pos > 1023)
		ret=-2;
	else
		ret=pos;

	return ret;
}

Practical C++ programming tutorial for Bioloid robots

This entry is part 1 of 5 in the series Bioloid C++ tutorial

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. Here you can find several combinations of hardware, firmware and programming tools.

Here the Visual Studio C++ zipped project. And if you use this firmware you also can query sensor port values with this example:

Read more

Software souls

Everybody has dreams that makes him wake up full of energy and  motivation. We born with it or may be it grows up inside us. Mine is software for personal robotics. Software that blows live, a personality, to your robotics creatures.

ROS (Robot Operating System)

ROS (Robot Operating System)

Fawkes robotics framework

Fawkes robotics framework

Fire station

Read more

AntOne 3.5 Robotis Bioloid hexapod

AntOne is a project which goal is create interesting and simple behaviours to an hexapod using the Bioloid Premium kit and programmed using C#

Read more

NXT Acer Explorer

NXT Acer Explorer

%d bloggers like this: