
Pioneer LX User's Guide, Rev. A
Page 113 of 125
Chapter 10: Communication Packet Protocol
Chapter 10: Communication Packet Protocol
All MobileRobots mobile robot controllers implement the same Pioneer protocol and are com-
patible. All versions of MARCOS firmware are backwards-compatible with previous versions.
The protocol is a bidirectional byte stream, in which sequences of byte packets represent
individual commands (when sent from client software to the robot controller), or Server Infor-
mation Packets, or SIPs or simply packets, (when sent from the robot controller back the client
software). Packets consist of five main elements: a two-byte header, a one-byte count of the
number of subsequent packet bytes, a one-byte command or packet type identifier followed by
packet data, and finally a two-byte checksum.
Field
Size
(byte-
s)
Value
Description
header
2
0xFA,
0xFB
Packet header; same for client and server
byte count
1
...
Number of command/argument bytes plus Check-
sum’s two bytes, but not including Byte Count itself
or the header bytes. Maximum of 249.
packet type or
command iden-
tifier
1
0 - 255
Packet type or command identifier (see below for
lists).
packet data
...
...
Packet or command data (if any)
checksum
2
...
Packet integrity checksum
10.1General Packet Format
Packet data is divided into one or more value fields. The meaning and sequence of fields are
specific to each packet or command type. Each field has a data type which determines the size
of that field (in bytes). Integer data values contained in a packet may be signed and unsigned,
and are 16-bit (2-byte) integers, least-significant byte first. Single-byte values are one 8-bit byte.
Strings may be either length-prefixed or NULL terminated (depending on packet type).
10.1 Packet Checksum
Calculate the client-server packet Checksum by successively adding data byte pairs (most-sig-
nificant byte first) to a running checksum (initially zero), disregarding sign and overflow. If
there are an odd number of data bytes, the last byte is XORed to the low-order byte of the check-
sum.
NOTE: The checksum integer is at the end of the packet, with its bytes in the reverse order of
that used for data; that is, b
0
is the high byte and b
1
is the low byte.
// packetBuf is a character buffer char[] containing one data packet
// read from the robot
int i;
unsigned char n;
int c = 0;
i = 3;
n = packetBuf[2] - 2; // data length
while (n > 1)
Содержание Pioneer LX
Страница 1: ...User s Guide Rev A November 2013...
Страница 16: ......
Страница 32: ......
Страница 36: ......
Страница 48: ......
Страница 60: ......
Страница 82: ......
Страница 103: ...Pioneer LX User s Guide Rev A Page 103 of 125 Chapter 8 Maintenance Figure 8 16 Top of Laser Rangefinder...
Страница 108: ......
Страница 125: ...10 Colrumbia Drive Amherst NH 03450 USA Phone 1 603 881 7960 www mobilerobots com...