Saphira client command support, Programming p2os, Establishing a client-server connection—sync – Pioneer 2 / PeopleBot User Manual

Page 41: Autoconfiguration, Opening the servers—open, Rogramming, P2os, D in table 4

Advertising
background image

ActivMedia Robotics

for negative integers; see below). The argument is an integer, a string, or nothing,

depending on the command.

Saphira Client Command Support

Saphira, as well as ARIA, all support P2OS client commands with useful library functions.
You can find prototypes in $(SAPHIRA)/handler/include/saphira.h and
saphira.pro

. Saphira’s P2OS command names have the prefix sfCOM. Not all P2OS

command names are supported in Saphira. See the Saphira Software Manual.

For example, to enable the motors from the Colbert interaction window in the Saphira
client GUI, type:

sfRobotComInt(sfCOMENABLE,1);

Or to have your Pioneer 2 play a tune (albeit rather tinny), type:

sfRobotComStrn(sfCOMSAY,"\1\6\2\105",4);

Programming P2OS

You may create your own P2OS interface, or use the convenience functions available

through the various applications-development software that come with your ActivMedia
robot.

Establishing a Client-Server Connection—SYNC

Before exerting any control, a client application must first establish a connection to the

robot server via the Host RS-232 serial port. Over that established communication link, the

client then sends commands to and receives operating information from the server.

When first started, P2OS is in a special wait (“noconn”) state, listening for communication
packets to establish a client-server connection. To establish a connection, the client

application must send a series of three synchronization packets through the Host
communication port, containing SYNC0, SYNC1, and SYNC2 command bytes, in
succession, and retrieve the server responses.

When in wait mode, P2OS echoes packets back to the client. The client should listen for
the returned packets and only issue the next synchronization packet after it has received

the appropriate echo.

Autoconfiguration

P2OS automatically sends robot-configuration information back to the client in the last
synchronization packet (SYNC2) echoed when establishing a connection. After the
SYNC2 byte, there are three NULL-terminated strings that comprise the robot’s name,
class

, and subclass. You may uniquely name your Pioneer 2 with the p2oscf

configuration tool we provide with the robot. The class and subclass also are
parameters stored in the robot's FLASH, but are constants normally set at the factory and

not changed thereafter. (See next chapter for details.)

The Pioneer class string is simply Pioneer; the subclass depends on your robot model;
P2DX

or P2AT, for example. Clients may use these identifying parameters to self-

configure their own operating parameters. ARIA, for instance, loads the robot’s related
parameters file found in a special robot params directory.

Opening the Servers—OPEN

Once you’ve established a communication link, the client should send the OPEN
command to the server, which causes the ActivMedia robot controller to perform a few

35

Advertising