The ActivMedia Robot Communication Protocol is the serial packet protocol used to communicate with and command the robot hardware on most ActivMedia robots such as the AmigoBot and the Pioneer. Specifically, robots using the AmigOS and P2OS operating systems use the protocol described by this document.
Using the ActivMedia Robot Communication Protocol allows you to control the motion and operation of an ActivMedia robot from any device that has a serial port and can properly form the packets. For example, this means that you can directly control an AmigoBot or Pioneer robot from a BasicStamp or BasicX, an Atmel AVR processor, a PC, a handheld device (like a Palm Pilot) and many other devices.
When commanding the robot using this protocol, you can:
It is also possible (but not necessary) to receive packets from the robot to get information such as:
As previously mentioned, ActivMedia robots are controlled via a serial port on the robot. This serial port must be connected to a controller which issues the robot movement commands. The controller can be any device which also has a serial port and is capable of properly forming the packets. Example controllers might include PCs, AVR & PIC processors, BasicStamps, BasicX processors, handheld PCs, etc.
All robot packets have the following elements and structure:
Field: |
Header |
Length |
Data1 |
Data2 |
..... |
DataN |
Checksum |
||
Size: |
2 bytes |
1 byte |
N bytes |
2 bytes |
|||||
Value: |
0xFA |
0xFB |
N+2 |
user data |
CSH |
CSL |
The checksum is calculated according to the following rules:
The result of these steps is your packet's checksum. Place the checksum result into your packet with the high byte first and the low byte second [CSH,CSL]. The checksum allows the robot to verify that your packet is valid and error-free. You must calculate the checksum properly otherwise the robot will ignore your packet.
A complete packet with a command with no arguments:
Field: |
Header |
Length |
Data1 |
Checksum |
||
Command# |
||||||
Size: |
2 bytes |
1 byte |
1 byte |
2 bytes |
||
Value:: |
0xFA |
0xFB |
3 |
command byte |
CSH |
CSL |
A complete packet with a command with an integer argument:
Field: |
Header |
Length |
Data1 |
Data2 |
Data3 |
Data4 |
Checksum |
||
Command# |
ArgType=integer |
Argument
(integer) |
|||||||
Size: |
2 bytes |
1 byte |
1 byte |
1 byte |
2 bytes |
2 bytes |
|||
Value:: |
0xFA |
0xFB |
6 |
command byte |
0x3B |
ArgIntL |
ArgIntH |
CSH |
CSL |
A complete packet with a command with a string argument:
Field: |
Header | Length |
Data1 | Data2 | Data3 | ..... |
Data3+n | Checksum |
||
Command# |
ArgType=string |
Argument
(string) |
||||||||
Size: |
2 bytes | 1 byte |
1 byte |
1 byte |
n bytes |
2 bytes |
||||
Value:: |
0xFA | 0xFB | 4+n |
command byte |
0x2B |
string data |
CSH |
CSL |
The table below provides a list of typically-used commands, their required arguments, and a description of their function:
Cmd# |
Command Name | ArgType |
Description |
0 |
PULSE | None |
Resets connection watchdog timer |
1 |
OPEN | None |
Open connection and start controller |
2 |
CLOSE | None |
Close connection |
4 |
ENABLE | int |
Enable(1)/Disable(0) Motors |
5 |
SETA | int (signed) |
Sets translation acceleration/deceleration in mm/sec^2 |
6 |
SETV | int |
Sets maximum translation velocity in mm/sec |
7 |
SETO | none |
Resets robot's internal position representation to 0,0,0 (origin) |
10 |
SETRV | int |
Sets maximum rotational velocity in deg/sec |
11 |
VEL | int (signed) |
Move forward (+) or reverse (-) at speed in mm/sec |
12 |
HEAD | int |
Turn to absolute heading, 0-359 degrees |
13 |
DHEAD | int (signed) |
Turn relative to current heading, +/- degrees |
21 |
RVEL | int (signed) |
Rotate at +/- degrees/sec |
23 |
SETRA | int |
Sets rotational acceleration/deceleration in deg/sec^2 |
28 |
SONAR | int |
Enable(1)/Disable(0) Sonars |
29 |
STOP | none |
Stops robot (motors remain enabled) |
32 |
VEL2 | int |
Command independent wheel velocities: |
55 |
E_STOP | none |
Emergency Stop (stops motors immediately, overrides deceleration) |
[an error occurred while processing this directive] |
Download this example code: Example usage, above [arrobottest_basicx.bas] |