beautypg.com

Sonars, Input / output (i/o) – Pioneer 2 User Manual

Page 40

background image

Pioneer 2 Operating System

34

You may reset the internal coordinates to 0,0,0 with the SETO P2OS command.

Figure 6-3. Internal coordinate system for P2OS

Sonars

When opened by the appropriate client command (see “Opening the Servers,” above), P2OS automatically
begins firing Pioneer’s sonar in the predefined default sequence: 1

8 and 9-16, simultaneously when both

front and rear sonar are implemented. P2OS also begins sending the sonar ranging results to the client via
the server-information packet. Use the SONAR command to enable (argument is "1") or disable (argument
is "0") the sonar pinging.

For example:

sfRobotComInt(sfCOMSONAR,0); /* Stop the pinging when not needed */

Use the

POLLING

command to change the polling sequence of the sonar. Its argument is a null-terminated

string of up to 15 sonar numbers. Front sonars are numbered in octal notation \001 through \010, and the
rear sonar are octal numbers \011 through \100. You may repeat a sonar number and have it ping more than
once per sequence.

For example:

sfRobotComStr(sfCOMPOLLING,"\001\002\001\002\000"); /* ping front left only */

Note that if the string is empty, all sonars get turned off, even though you hadn't disabled the sonar with the
SONARS command.

Input / Output (I/O)

Your Pioneer 2 comes with a number of I/O ports that you may use for some of Pioneer’s accessories and
for your own custom attachments. See Appendix A, C166 Ports and Connections for port locations on the
Pioneer microcontroller. The various port states and reading appear in the SIP and may be manipulated
with P2OS client commands.

Digin, Timer, and ADSEL

The states of the eight digital input ports are mapped as a single byte, whose value is continuously updated
and reported in each standard SIP (Table 6-3). For example, examine Saphira's sfRobot structure value
digin:

sfSMessage("Digin is %i",sfRobot.digin);

When not connected, the digital input ports' values will vary and change without warning.

The digital input ports 4-7 (ID4-7) also may be used as A/D input ports. Accordingly, their digin states will
depend on whether or not the applied voltage exceeds the standard digital CMOS threshold voltage.

Use the client command ADSEL to select the A/D port that is to appear in the P2OS SIP analog value. The
default port is #5, the dedicated A/D port on the system. The P2OS SIP reports the currently selected
analog input port number.

0

+90

+180

+270

+X

+Y

Front