Pioneer 2 User Manual

Page 42

Advertising
background image

Pioneer 2 Operating System

36

Extended Packets

P2OS 1.4 introduces several new Server Information Packets to better support the Pioneer 2 robotics
community. On request from the client by a related P2OS command (see Table 6-5), the P2OS server will
package and send one or a continuous stream of packet types to the client over the host serial
communication line.

Packet Processing

It is up to the client to handle all packet types. Extended packets get intermingled with the standard SIP that
P2OS sends every 100 or 50 milliseconds. Please consult the respective client application programming
manuals for details.

The P2OS extended packets are packaged similarly to the standard Server Information Packet, including
header (0xFA, 0xFB) and the checksum. The difference, besides the number and included data, of course,
is a different packet type (Status byte). Accordingly, the client processor should simply examine the packet
type byte and process each packet accordingly.

A sample packet processor is included with the Saphira distribution—packet.c in the

apps

/ directory.

Configuration Packets

Send the CONFIG command number 18 with any integer argument to request P2OS send back a special
server information packet containing the robot's operational parameters. The CONFIG SIP packet type is
32 (0x20). Table 7.2 in the next chapter gives details about the configuration data.

Encoder Packets

By issuing the ENCODER command number 19 with a non-zero integer argument, you initiate a
continuous stream of ENCODERpac (type 144) SIPs. One ENCODERpac is sent every 100 or 50
milliseconds, depending on the standard packet cycle rate (sInfoCycle; see next Chapter). Discontinue the
packets by sending the ENCODER command number 19 with the argument = 0.

The P2OS extended Encoder packet contents are described in Table 6-7.

Table 6-7. P2OS Encoder Server Information Packet Contents

Name

Data Type

Description

Header

integer

Exactly 0xFA, 0xFB

Byte Count

byte

Number of data bytes + 2

Left Encoder

integer

Least significant portion and the

integer

most significant portion comprise the
current 4-byte raw encoder count from the left
drive wheel

Right Encoder

ineger

Least significant portion and the

integer

most significant portion comprise the
current 4-byte raw encoder count from the left
drive wheel

Checksum

integer

Checksum for packet integrity

AUX Serial Packets

The new P2OS 1.4 implements two-way communications through the AUX serial port on the Pioneer 2
microcontroller. With earlier versions of P2OS, you are able to send a string of data (a command or
otherwise) from the HOST port-connected client to an AUX port-connected serial device (TTY2 command
number 42), but you could not get data back from that device.

With P2OS 1.4 and later, use the P2OS command number 43 (GETAUX) to request feedback from the
AUX port. It tells P2OS to retrieve a given number of bytes (command argument value) from the serial
device attached to the AUX port, and to package and send those incoming data in a special SERAUXpac
(type 176; 0xB0) SIP back to the client via the common HOST serial port.

Advertising