Saphira 5.3 Manual PDF
Saphira 5.3 Manual PDF
Saphira 5.3 Manual PDF
Saphira
Software Manual
Under international copyright laws, this manual or any portion may not be copied or on any way
duplicated without the expressed written consent of ActivMedia, Inc.
The Saphira libraries and software on disk which are available for network download are solely owned
and copyrighted by SRI International (formerly Stanford Research Institute). Developers and users are
authorized by revocable license to develop and operate Saphira-based custom software for personal,
research, and educational use only. Duplication, distribution, reverse-engineering, or commercial
application of the software without the expressed written consent of SRI International is explicitly
forbidden.
The various names and logos for products used in this manual are registered trademarks or trademarks
of their respective companies. Mention of any third-party hardware or software constitutes neither an
endorsement nor a recommendation.
ii
Saphira Software Manual
Contents
LIST OF TABLES VII
3. THE SIMULATOR 23
iii
3.1. Starting the Simulator 23
3.2. Parameter File 24
3.3. World Description File 25
3.4. Simulator Menus 25
3.4.1. Load (Files) Menu 25
3.4.2. Connect Menu 25
3.4.3. Display Menu (Grow, Shrink and Wake) 26
3.4.4. Recenter Menu 26
3.4.5. Exit Menu 26
3.4.6. Information Area 26
3.5. Mouse Actions 26
5. SAPHIRA SERVERS 41
5.1. Communication Packet Protocol 41
5.1.1. Packet Data Types 42
5.1.2. Packet Checksum 42
5.1.3. Packet Errors 43
5.2. Client Commands 43
5.2.1. Client Command Argument Types 44
5.2.2. Saphira Client Command Support 44
5.3. Server Information Packets 45
5.4. Start Up and Shut Down 47
5.4.1. Synchronization—sfCOMSYNC 47
5.4.2. Autoconfiguration 47
5.4.3. Opening the Servers—sfCOMOPEN 48
5.4.4. Keeping the Beat—sfCOMPULSE 48
5.4.5. Closing the Connection—sfCOMCLOSE 48
5.4.6. Movement Commands 48
5.5. Robot in Motion 49
5.5.1. Position Integration 49
5.6. Sonars 50
iv
Saphira Software Manual
7. SAPHIRA BEHAVIORS 73
7.1. Behaviors and Fuzzy Control 73
7.2. Behavior Grammar 73
7.3. Behavior Grammar in BNF 73
7.4. Behavior Executive 74
7.5. Fuzzy variables. 75
7.5.1. Fuzzy variable creation functions 75
7.5.2. Fuzzy variable combination functions 75
7.6. Implementing Behaviors 76
7.6.1. Input parameters 76
7.6.2. Update function 76
7.6.3. Init function 76
7.6.4. Rules 76
7.6.5. Behavior schema 77
7.7. Invoking Behaviors 77
7.8. Pre-Defined Saphira Behaviors 78
9. SAPHIRA VISION 89
9.1. Channel modes 89
v
9.2. Vision Packets 89
9.3. Sample Vision Application 90
INDEX 101
vi
Saphira Software Manual
List of Tables
Table 2-1. Keyboard-enabled Saphira drive and behaviors* 17
Table 3-1. Example drive error tolerance values for a parameters file 25
Table 5-1 Main elements of PSOS communication packet protocol 42
Table 5-2 Communication packet data types 42
Table 5-3 Client command communication packet 44
Table 5-4 PSOS 4.2 supported client commands 45
Table 5-5 Saphira server information data packet (minimum contents) 46
Table 5-6. Port types and names for clinet/server connections 47
Table 5-7. Robot configuration information 48
Table 5-8. Server motion command types 48
Table 5-9. Motion command arguments 49
Table 6-1 Optional states for various Saphira display functions 52
Table 6-2 Definition of the sfRobot structure 55
Table 6-3. Saphira multiprocessing reserved process state values 58
Table 6-4. Saphira colors 70
Table 7-1. Valid Saphira behavior arguments 78
Table 7-2. Valid behavior closure state values 78
Table 7-3. Avoid collision behavior parameters 79
Table 7-4. Stop collision behavior parameters 79
Table 7-5. Keep off behavior parameters 80
Table 7-6. Go to position behavior parameters 80
Table 7-7. Attend at position behavior parameters 80
Table 7-8. Follow lane behavior parameters 81
Table 7-9. Follow corridor behavior parameters 81
Table 7-10. Follow door behavior parameters 82
Table 7-11. Turn to parameters 82
vii
List of Figures
Figure 2-1 Saphira System Architecture. 8
Figure 2-2 Saphira Control Architecture. 10
Figure 2-3 Saphira client LPS in local mode. 14
Figure 2-4 Saphira Behaviors window (Linux/Motif version) 18
Figure 2-5 Keep Off behavior display expanded 19
Figure 2-6 Behavior window for Keep-Off 19
Figure 2-7 A sample Saphira Processes window 20
Figure 2-8 An example Saphira Intentions window 21
Figure 3-1 A sample window of the simulator 24
Figure 4-1. Concurrent execution of Saphira OS and user asynchronous tasks. 29
Figure 5-1 Saphira client-robot server architecture 41
Figure 5-2 Trapezoidal turning velocity profile 49
Figure 5-3 Saphira-aware server internal coordinate system 50
Figure 6-1. Saphira’s LPS coordinate system 62
Figure 6-2. Sensitivity rectangle for the sfOccBox functions 64
Figure 6-3 Sensitivity rectangle for sfOccPlane functions 65
Figure 7-1. The straight-up function 75
viii
Saphira Software Manual
1
1: Saphira Software and Resources
1 We do not recommend using Macintosh for Saphira development at this time because the native
operating system (System 7.5) does not fully support multitasking which is essential for Saphira
operation.
2
Saphira Software Manual
The uncompressed Saphira software typically requires 20 megabytes of hard-disk drive storage space.
IMPORTANT NOTICE!
All Saphira operations require that the environment variable SAPHIRA be set to the top-level directory,
e.g., /usr/local/saphira/ver53 on a Unix system (note there is no final slash), or c:\saphira\ver53
on an MS Windows system. If you do not set this variable correctly, Saphira clients and the simulator will
fail to work, or fail to work properly! Please set this as soon as you install the distribution.
If you have a previous installation of Saphira, your SAPHIRA environment variable will be set to the
old toplevel directory. YOU MUST RESET IT to the toplevel directory of the new distribution. All new
clients will complain and fail to execute until you do.
Unix systems should use one of the following methods, preferably in the user’s .cshrc or other default
shell script parameter file.
export SAPHIRA=/usr/local/saphira/ver53 (bash shell)
setenv SAPHIRA /usr/local/saphira/ver53 (csh shell)
In Windows 95 and NT 3.51, assuming the top-level Saphira directory is c:\saphira\ver53, add the
following line to the C:\AUTOEXEC.BAT file:
SET SAPHIRA=C:\saphira\ver53
Finally, in Windows NT 4.0, go to Start/Settings/System, and click on the Environment tab. Add the
SAPHIRA variable in either the user or system-wide settings.
3
1: Saphira Software and Resources
We detail Saphira client operation in the following chapter. For now, we leave it to you to find the
manual drive keys and take your robot for a joyride (hints: arrows move and the spacebar stops the
motors).
The groups currently are unmoderated, so please confine your comments and inquiries to those concerning
robot operation and programming.
1.6.3. SRI Saphira Web Pages
Saphira is under continuing active development at SRI International. SRI maintains a set of web pages
with more information about Saphira, including
• tutorials and other documentation on various parts of Saphira
4
Saphira Software Manual
1.6.5. Acknowledgments
The Saphira system reflects the work of many people at SRI, starting with Stan Rosenschein, Leslie
Kaelbling, and Stan Reifel, who built and programmed Flakey in the mid 1980’s. Major contributions have
been made by Alessandro Saffiotti, Karen Myers, Enrique Ruspini, Didier Guzzoni, and many others.
5
Saphira Software Manual
7
2: Saphira System Overview
User micro-tasks
Control routines
User
async
State reflector routines
Packet communications
Synchronous micro-tasking OS
TTY or TCP/IP
connection
2.1.1. Micro-tasking OS
The Saphira architectures are built on top of a synchronous, interrupt-driven OS. Micro-tasks are finite-
state machines (FSMs) that are registered with the OS. Each 100 ms, the OS cycles through all registered
FSMs, and performs one step in each of them. Because these steps are performed at fixed time intervals,
all the FSMs operate synchronously, that is, they can depend on the state of the whole system being
updated and stable before they are called: it’s not necessary to worry about state values changing while the
FSM is executing. FSMs can also take advantage of the fixed cycle time to provide precise timing delays,
which are often useful in robot control. Because of the 100 ms cycle, the architecture supports reactive
control of the robot in response to rapidly changing environmental conditions.
The micro-tasking OS involves some limitations: each micro-task must accomplish its job within a
small amount of time, and relinquish control to the micro-task OS. But with the computational capability
of today’s computers, where a 100 MHz Pentium processor is an average microprocessor, even
complicated processing such as the probability calculations for sonar processing can be done in
milliseconds.
The use of a micro-tasking OS also helps to distribute the problem of controlling the robot over many
small, incremental routines. It is often easier to design and debug a complex robot control system by
implementing small tasks, debugging them, and them combining them to achieve greater competence.
2.1.2. User Routines
User routines are of two kinds. The first kind is a micro-task, like the Saphira library routines, that runs
synchronously every Saphira cycle. In effect, the user micro-task is an extension of the library routines,
8
Saphira Software Manual
and can access the system architecture at any level. Typically the lowest level that user routines will work
at is with the state reflector, which is an abstract view of the robot internal state.
Saphira and user micro-tasks are written in the C language, and all operate within the same executing
thread, so they share variables and data structures. User micro-tasks have full access to all the information
typically used by Saphira routines.
Although user micro-tasks can be coded directly as FSMs in the C language, it’s often more convenient
to use the Activity Language to describe FSMs. The activity language has a rich set of control concepts,
and a user-friendly syntax, that makes writing control programs much easier. A translator converts activity
language programs into FSMs.
Since they are invoked every 100 ms, micro-tasks must partition their work into small segments that can
comfortably operate within this limit, e.g., checking some part of the robot state and issuing a motor
command. For more complicated tasks such as planning, more time may be required, and this is where the
second kind of user routine is important. Asynchronous routines are separate threads of execution that
share a common address space with the Saphira library routines, but are independent of the 100 ms Saphira
cycle. The user may start as many of these separate execution threads as desired, subject to limitations of
the host operating system. The Saphira system has priority over any user threads; thus, time-consuming
operations like planning can coexist with the Saphira system architecture, without affecting the real-time
nature of robot control.
Finally, because all Saphira routines are in a library, user programs that link to these routines only need
to include those routines they will actually use. So a Saphira client executable can be a compact program,
even though the Saphira library itself contains facilities for many different kinds of robot programs.
9
2: Saphira System Overview
TCP/IP link to
other agents
Agent
Interface
Display
routines Procedural
Reasoning
Global Map System
Registration
routines Local Fuzzy control
Perceptual
Space
Sensor interp Direct motion
routines control
State Reflector
10
Saphira Software Manual
together into a map and saved for later use. The GMS is not displayed as a separate structure, but its
artifacts appear in the LPS display window.
11
2: Saphira System Overview
Now pull down the Connect menu and select the appropriate connection port: simulator, for the
simulator (or a local server), a serial communications port to which you have run a tether cable or optional
serial modem, or TCP for a network-based or radio-Ethernet connection. Saphira initiates the client/server
synchronization sequence and displays a message when it has connected with the server.
If there is a problem connecting with either the simulator or robot server, the communication
connection will fail, and a message describing the problem will appear in Saphira’s main window
information area. Some typical causes for failure with either the simulator or the actual robot and their
solutions include:
9 Make sure the physical robot’s Saphira-compatible server software is properly installed and
running and that no other Saphira client is connected to it.
9 Make sure the simulator is running and there is no other Saphira client or simulator server running
on the same machine.
9 In rare cases, the communications pipe may be blocked, and can only be cleared by rebooting the
machine. This can occur if either the server or client exits abnormally from a previous connection,
without shutting it down properly.
9 Make sure that the communications tether or radio modem is plugged into the correct serial port
with the correct cable.
9 Remove the serial tether cable from the robot’s serial port if you use the radio modem.
4 Some early versions of UNIX and Linux Pioneer and Saphira software must dynamically link with Motif
GUI libraries to operate.
12
Saphira Software Manual
9 Make sure the client radio modem is within range of robot, is on the correct channel, and has a
strong link signal.
9 Make sure the serial port is not in use by another application.
Once connected, the Saphira client will display information about the state of the robot, and allow you
to command the robot from the menu and keyboard.
13
2: Saphira System Overview
14
Saphira Software Manual
2.3.4. Menus
There are seven pulldown menus in the main client window.5 These let you control the display of
information in the LPS and related subwindows, manage communication to the server, and load and save
parameter and map files:
15
2: Saphira System Overview
16
Saphira Software Manual
KEY ACTION
i, ↑ Increment forward velocity
m, ↓ Decrement forward velocity
j, ← Incremental left turn
l, → Incremental right turn
k, space All stop
g Constant Velocity on/OFF
c Obstacle Avoidance ON/off
* These keys work only when the main Saphira window is active.
The sample Saphira client we provide defines a set of keyboard actions for robot motion, and for
turning some behaviors on and off. In a user application, the function sfProcessKey lets you intercept
keystrokes and initiate your own “hot-key” actions.
17
2: Saphira System Overview
Keep Off
18
Saphira Software Manual
It’s often useful to view an individual behavior’s activity in more detail. Individual behavior windows
can be opened by shift-clicking on the behavior name (UNIX systems) or left-clicking just to the right of
the name (MS Windows). Figure 2-6 shows a typical behavior window while active. The invocation
19
2: Saphira System Overview
20
Saphira Software Manual
21
Saphira Software Manual
3. The Simulator
The simulator is a very useful alternative to a physical robot for developing robotics programs.
Although there is nothing like real world conditions to humble the most ambitious robotics project, the
simulator does have the distinct advantage of having a single-step mode in which you can reenact every
detail of your programs, including a robotics fatality.
And, too, the simulator has realistic error models for the sonar sensors and wheel encoders so that, in
general, if a client program works with the simulator, it will work on the physical robot. The simulator also
lets you construct a simple world in which the simulated robot navigates. You can even change the robot’s
operating characteristics to simulate your own robot designs. And since the packet interface of the
simulator is the same as the physical robot, no changes to the client program are required in switching
between the two.
The disadvantage of the simulator is that the environment model is an abstraction of the real world,
with simple 2-D linear segments in place of the complex geometrical objects the real robot will encounter
in the real world. For example, the simulator assumes all objects are sensor-high, so it can’t simulate a door
stop—something the real robot will have to overcome to traverse rooms in a real building.
23
3: The Simulator
24
Saphira Software Manual
Three important parameters control the amount of error in the simulated robot’s motion (Table 3-1).
Consult the listing in Section 10 for more details.
Table 3-1. Example drive error tolerance values for a parameters file
25
3: The Simulator
26
Saphira Software Manual
27
4: Creating Saphira Clients
The Saphira library headers, as well as other relevant system and graphics headers, are loaded by the
saphira.h file. The callbacks are defined to start up Saphira or user micro-tasks when the client
connects to or disconnects from the robot. The main function is the entry to the client; it registers the
callbacks, and then starts up the Saphira micro-tasker with the call to sfStartup. The argument of 0 to
this function means that control does not return to the main program: all processing is done using micro-
tasks, and the client exits when the Exit item is chosen from the File menu.
Programming in MSVC is similar, except that the form of the main function changes to MS Windows
programming standards.
#include “saphira.h” /* header file for Saphira library */
28
Saphira Software Manual
For most robot programming, all operations can be handled in micro-tasks. If a more compute-
intensive task must be done concurrently, then sfStartup should be called with an argument of 1, which
means that the Saphira micro-tasking OS is started, and immediately returns control to the main program.
Main Saphira
thread OS
sfStartup
Execute
100 ms micro-tasks
User
async
routines Execute
200 ms micro-tasks
Execute
300 ms micro-tasks
29
4: Creating Saphira Clients
#############################################################
# November 1996
#
# Makefile for Saphira applications
#
#############################################################
SRCD = ./
OBJD = ./
INCD = $(SAPHIRA)/handler/include/
LIBD = $(SAPHIRA)/handler/obj/
BIND = ./
CFLAGS = -g -D$(CONFIG)
CC = gcc
INCLUDE = -I$(INCD) -I$(X11D)include
#############################################################
all: $(BIND)lowlev
touch all
The first part of the makefile defines variables that are useful in compilation and linking. Note that the
SAPHIRA environment variable must be defined as the top level of the Saphira distribution (with no final
slash). The handler/include directory contains header files, and handler/obj has the libraries.
Next, the file handler/include/os.h is read in. This file determines the operating system type
and sets some system library variables appropriately, for X windows and Motif. It also sets the CONFIG
variable to the particular OS of the machine, which is important for handling some of the system routines
correctly. For most OS’s, the Motif (MOTIFD) , X11 (X11D) and system libraries (LLIBS) are set
correctly, but there may be cases in which they are not. In this event, go into the os.h file and change the
definitions under your OS.
One peculiarity of os.h is that it relies on the conditional preprocessing facilities of gnu make
(gmake). Not all native makes support this facility. If you get errors during the preprocessing phase of
the compilation from os.h, switch to gmake.
The compile command makes lowlev.o from the lowlev.c file. It is important that the variable -
D$(CONFIG) is passed to the compiler, because this tells the header files what particular variant of Unix
is being used. The include directories are the Saphira header directory and the X11 directory.
The link command takes the object file generated by the compile command and links it with the Saphira
library and system libraries to form the executable. The Saphira library is indicated by -lsf. This is the
library that opens a graphics window and has all the user interface functions. If you don’t want a window,
use the -lsfx library. The LLIBS variable indicates other system libraries that may be needed by this
particular Unix system.
The executable is deposited in the same directory as the source file, and can be invoked by typing its
name at the shell prompt.
30
Saphira Software Manual
31
4: Creating Saphira Clients
void patrol(void)
{
switch(process_state) {
case INIT:
case 20:
sfSetPosition(2000);
process_state = 21;
break;
case 21:
if (sfDonePosition(100))
process_state = 22;
break;
…
}}
void myStartupFn(void)
{
sfSetDisplayState(sfGLOBAL, TRUE); /* use the global view */
}
void myConnectFn(void)
{
sfInitBasicProcs(); /* start up comm processes */
sfSetMaxVelocity(200); /* robot moves at this speed */
sfInitProcess(patrol,"patrol");
}
32
Saphira Software Manual
The program waits in a while loop until the user connects to a robot, then starts to issue a series of
direct motion commands. The motion commands are synchronized using the sfDoneXXX functions to
wait for completion, and sfPause to wait for a time interval.
Finally, it closes the connection to the robot and exits. When the main program exits, the Saphira OS is
also automatically exited. If you want to keep the micro-task OS operating, then just start a while loop
whose body is sfPause(1000).
Note that the packet communication and state reflection micro-tasks are initiated in the connect
callback (myConnectFn). It’s important to do this, since the direct motion commands rely on state
reflection to control the robot.
33
4: Creating Saphira Clients
#include "saphira.h"
void myStartupFn(void)
{
sfSetDisplayState(sfGLOBAL, TRUE); /* use the global view */
}
void myConnectFn(void)
{
sfInitBasicProcs(); /* start up comm processes */
}
34
Saphira Software Manual
#include "saphira.h"
sfSetVelocity(0); /* stop */
sfPause(4000);
sfDisconnectFromRobot(); /* we're gone... */
}
else
printf("Can't connect!!\n");
}
35
4: Creating Saphira Clients
/*
* The Saphira application: all the basic processes loaded
* plus registration and map-making processes
* Behaviors: avoid-obstacle, keep-off, constant-velocity, stop
* Intentions: follow-it
*/
#include "saphira.h"
void myConnectFn(void);
void myStartupFn(void);
int myKeyFn(int ch); /* any user key processing here */
int myButtonFn(int x, int y, int b);
void myStartupFn(void)
{
sfSetDisplayState(sfDISPLAY, 2); /* set it to 5 Hz */
}
The user micro-task (test_control_proc) is very simple: it starts up several behaviors and one PRS
intention, then puts itself into a suspended state. You can change the state of the invoked behaviors,
intentions, and processes from Saphira’s Function menu (see previous chapter). All of the behaviors
used in this function are available as part of the Saphira library.
36
Saphira Software Manual
void test_control_proc(void)
{
switch(process_state)
{
case INIT:
sfPreferredTurnDir = sfLEFTTURN;
sfInitBehavior(sfConstantVelocity, 3, False,
sfFLOAT, 300.0,
sfEND);
sfInitBehavior(sfStop, 4, False,
sfEND);
sfInitBehavior(sfAvoidCollision, 0, False,
sfFLOAT, 3.0, /* front sensitivity */
sfFLOAT, 3.0, /* side sensitivity */
sfFLOAT, sfSHARPLY, /* turn gain */
sfFLOAT, 100.0, /* standoff */
sfEND);
sfInitBehavior(sfKeepOff, 1, False,
sfFLOAT, 100.0, /* caution speed */
sfFLOAT, 0.25, /* sensitivity */
sfEND);
sfInitIntention(sfFindAndFollow, "follow corr", 0, sfEND);
sfSetProcessState(sfFindProcess("follow corr"),
sfINTERRUPT);
process_state = SUSPEND;
break;
case RESUME:
sfMessage("Resumed");
break;
}
}
The Saphira main window system passes keystrokes to your process via the callback registered with
sfKeyProcFn. This callback should return 0 if the you want the default key action: moving the robot
when the user presses one of the movement keys, for example. Otherwise, the function should return 1 to
signal that it has handled the keypress. If you don’t want to perform any special keyboard actions, you
don’t have to register a callback.
37
4: Creating Saphira Clients
Similarly, mouse clicks are sent to the callback registered with sfButtonProcFn. Again, returning 0
from the callback means the default action is invoked; returning 1 means the callback handled the mouse
click.
int myButtonFn(int x, int y, int b)
{
return 0; /* don't do default handling */
}
…
return 1;
}
return 0; /* return 0 if we don't process it */
}
The example keypress callback above uses API calls for finding active behaviors, changing their state,
and printing messages to the user. These calls are all documented in the following chapter. The mouse
callback simply returns 0, invoking the default mouse click action. Note that the mouse callback could
have been omitted; it’s simply here to illustrate how a mouse callback is invoked.
#include "saphira.h"
38
Saphira Software Manual
while (i<100)
{
if (sfWaitClientPacket(1000)) /* wait 1 sec for packet */
{
i++;
sfProcessClientPacket(sfReadClientByte());
}
if (i % 10 == 0)
{
sfRobotCom(PULSE_COM); /* keep asking */
sfRobotComInt(VEL_COM, 300); /* keep it going */
printf("%d packets received\n", i);
printf("X: %f Y: %f\n", sfRobot.x, sfRobot.y);
}
}
In the main function, the client starts by opening a connection to the robot, and then tells it to move
forward at 300 millimeters per second. The robot sends an information packet to the client every 100
milliseconds; the main client loop collects 100 server packets, parsing each into the state reflector
structures. After the packets, the client stops the robot, disconnects from the server, and ends execution.
39
Saphira Software Manual
5. Saphira Servers
In the Saphira client/server model, the robot server works to manage all the low-level details of the
robot’s systems, including operating the drives, firing the sonars and collecting echoes, and so on, on
command from and reporting to a separate client application, such as Saphira. With Pioneer, this is the
Pioneer Server Operating System (PSOS. The capabilities of the Pioneer robot server, and its connection
to the client, are shown in Figure 5-1.
41
5: Saphira Servers
42
Saphira Software Manual
int
calc_chksum(unsigned char *ptr) /* ptr is array of bytes, first is data count
*/
{
int n;
int c = 0;
n = *(ptr++);
n -= 2; /* don't use chksum word */
while (n > 1) {
c += (*(ptr)<<8) | *(ptr+1);
c = c & 0xffff;
n -= 2;
ptr += 2;
}
if (n > 0) c = c ^ (int)*(ptr++);
return(c);
}
43
5: Saphira Servers
44
Saphira Software Manual
45
5: Saphira Servers
46
Saphira Software Manual
In future versions, server information packets may contain additional, appended data fields. To remain
compatible, have your client application accept the entire data packet, even though it may use only a few
selected fields.
5.4.1. Synchronization—sfCOMSYNC
When first started, the Saphira-aware server, including the simulator, is in a “wait” state listening for
communication packets over its designated port. (See your robot operating manual for details about your
robot’s servers.) To establish a connection, the client application sends a series of three synchronization
packets through the host communication port—sfSYNC0, sfSYNC1, and sfSYNC2, in succession. The
server responds to each, forming a succession of identical synchronization packets. The client should listen
for the returned packets and only issue the next synchronization packet after it has received the echo.
A string may be used for unusual port names—if there is a serial communications card with extra tty
ports, for instance. With Macintosh, it’s best to use the modem port, if it’s available, rather than the
printer port.
5.4.2. Autoconfiguration
The Saphira-aware servers (PSOS v4.1 or later, for example) send configuration information back to the
client in the last sync packet (sfSYNC2). After the sync byte, there are 3 null-terminated strings that
represent the robot name, robot class, and robot subclass (Table 5-7). You can read these strings with the
Saphira function sfReadClientString. The following table shows what these strings are for different robots.
47
5: Saphira Servers
The parameter file that is appropriate for a robot can be found in the Saphira params directory. The
name of the parameter file will be the same as the lowercase version of the subclass string (if it exists) or
the class string.
48
Saphira Software Manual
The arguments for these commands are given in Table 5-9 below. The heading commands are with
respect to the robot’s internal coordinate system (see the section below).
short turn,
max velocity max velocity
not reached
rotational
velocity
accel decel
time
start position position
position achieved achieved
49
5: Saphira Servers
The orientation commands sfCOMHEAD and sfCOMDHEAD turn the robot with respect to its internal
dead-reckoned angle (Figure 5-3). On startup, the robot is at the origin (0,0), pointing towards the positive
x-axis at 0 degrees. Absolute angles vary between 0 and 360 degrees. As the robot moves, it will update
this internal position based on dead-reckoning. The x,y position is always positive, and rolls over at about
3,000 millimeters. So, if the is at position (400,2900) and moves +400 millimeters along the y-axis and -
600 millimeters along the x-axis, its new position will be (2800, 300).
+X
Front
+90 +Y +270
+180
Figure 5-3 Saphira-aware server internal coordinate system
5.6. Sonars
When opened by the appropriate client command (see sfCOMOPEN above), the Saphira-aware robot
server automatically coordinates and begins firing the robot sonars in a pre-defined default sequence, and
sends the results to the client via the server information packet. Details about the configuration and firing
sequence of the sonars are found in the robot’s operation manual.
Use the sfCOMPOLLING command to change the polling sequence of the sonars:
sfRobotComStr(sfCOMPOLLING, str)
where str is a null-terminated string of bytes at most 12 bytes long. Each byte is 1 + sonar number. For
example, the string
"\001\002\001\006"
starts the sonar polling sequence 0, 1, 0, 5. Note that sonar numbers can be repeated. If the string is
empty, all sonars are turned off.
50
Saphira Software Manual
51
6: Guide to the Saphira API
52
Saphira Software Manual
void sfInitBasicProcs(void)
.Starts up a set of basic communication, display, motor, and sensor control processes. Among other
activities, these processes implement the client state reflector. The processes invoked are:
pulse_proc communication pulse every 1 second
motor_proc coordinates keyboard and behavior motor commands
clamp_proc rotates the world around the robot
sonar_proc adds new sonar readings to the sonar buffer
wake_proc draws a wake of the robot’s motion
draw_proc updates Saphira display window
process_waiting_packets parses information packets from robot server
Drawing, wake, and clamping processes are affected by variables that users can set from Saphira’s main
window’s Display menu.
void sfInitControlProcs(void)
Starts up a process for evaluating all active behaviors. If you want to run without using the fuzzy
behavior controller, by using the direct motion functions, then don’t initiate this process.
execute_current_behaviors evaluates behaviors and outputs a motor
control
53
6: Guide to the Saphira API
This section describes the robot and sonar information structures; the next one, the direct motion
commands that affect the control structures.
struct robot sfRobot
The sfRobot structure holds basic information reflected from the robot server. Table 6-2 below shows
the values of the various fields in this structure; the definition is in handler/include/struct.h.
All of the values in the sfRobot structure are reflected from the robot server back to the client,
providing information about the robot’s state. In this way, it is possible to tell if a command has been
executed. For example, the digoutput field reflects the actual value of the digital output bits set on the
robot.
The interpretation of some of the values in the structure is robot-dependent, e.g., the bumpers field
reflects motor stall information for the Pioneer robots. The Saphira library provides some convenience
functions for interpreting these fields; see the following subsections.
Table 6-2 Definition of the sfRobot structure
sfRobot field Units Description
x, y, th mm, mm, radians robot’s location in
robot coords;
always (0, 0, 0)
ax, ay, ath mm, mm, radians robot’s global
location
tv, mtv mm/sec current and max
velocity
rv, mrv deg/sec current and max
rotational velocity
leftv, rightv mm/sec left and right wheel
velocities
status int robot status:
STATUS_STOPPED robot stopped
STATUS_MOVING robot moving
STATUS_NOT_CONNECTED client not connected
STATUS_NO_HIGH_POWER robot motors stalled
battery 1/10 volt battery power
bumpers int bumper state
ptu usecs pan/tilt unit (servo)
heading
diginput int digital input state
digoutput int digital output state
analog 0-255 [0V-5V] analog input voltage
motor_packet_count counts per second packet
sonar_packet_count communication
vision_packet_count information
54
Saphira Software Manual
then the right wheel or right side of the robot is affected. However, you can’t rely absolutely on this
behavior, as sometimes both motors will stall even when the obstacle is on one side or the other. Motor
stall information is returned in the bumpers field.
int sfStalledMotor (int which)
Return 1 if the motor which is stalled, and 0 if it isn’t. The argument which is sfLEFT or sfRIGHT.
6.3.2. Sonar buckets
The current range reading of a sonar sensors is held in an sdata structure, defined below. The
structures for all the sonars are in an array called sbucket, e.g., sbucket[2] is the sdata structure for
sonar number 2.
Fields in the sdata structure indicate the robot’s position when the sonar was fired, the range of the
sonar reading, and the position in robot coordinates of the point on the sonar axis at the range of the
reading. The field snew is set to 0xFFFF when a new reading is received; the client program can poll this
field to ascertain if the reading is new, and set it to 0 to indicate that it has been read.
A value of 5000 for the sonar range indicates that no echo was received after the sonar fired and waited
for a return.
Some convenience functions for accessing current sonar readings are described below.
Sonar readings are accumulated over short periods of time into a set of buffers in the LPS; see below in
the section on the LPS.
typedef struct /* sonar data collection buffer */
{
float fx, fy, fth; /* robot position when sonar read */
float afx, afy, afth; /* absolute position when sonar read */
float x, y; /* sonar reading in flakey RW coords */
int range; /* sonar range reading in mm */
int snew; /* whether it's a new reading */
} sdata;
IMPORT extern sdata sbucket[]; /* holds one sdata per sonar, indexed by sonar
number */
55
6: Guide to the Saphira API
3. It has a position control mode which moves the robot a specified distance forward or backward.
Direct control of the two control channels (translation and rotation) is independent, and commands to
control them can be issued and will execute concurrently.
The direct motion functions require the state reflector to be operational, that is, the function
sfInitBasicProcs must be called.
void sfSetVelocity(int vel)
void sfSetRVelocity(int rvel)
Set the translational and rotational setpoints in the state reflector. If the state reflector is active, these
setpoints are transferred to the robot. Values for translational velocity are in mm/sec; for rotational
velocity, degrees/sec.
void sfSetHeading(int head)
void sfSetDHeading(int dhead)
The first function sets the absolute heading setpoint in the state reflector. The argument is in degrees,
from 0 to 359.
The second function increments or decrements the heading setpoint. The argument is in degrees, from -
180 to +180.
If the state reflector is active, the heading setpoint is transferred to the robot.
Void sfSetPosition(int dist)
void sfSetMaxVelocity(int vel)
The first function sets the distance setpoint in the state reflector. Argument is in mm, either positive
(forwards) or negative (backwards). If the state reflector is active, it sends motion commands to the robot
to move the required distance. The maximum velocity attained during motion is given by
sfSetMaxVelocity, in mm/sec.
int sfDonePosition(int dist)
int sfDoneHeading(int ang)
Checks whether a previously-issued direct motion command has completed. The argument indicates
how close the robot has to get to the commanded position or heading before it is considered completed.
Arguments are in mm for position, and degrees for heading. On a Pioneer robot, you should use at least
100 mm for the distance completion, and 10 degrees for angle. The robot may not move enough to trigger
the completion function otherwise. Note that, even though the robot may not achieve a given heading very
precisely if it is just turning in a circle, as it moves forward or backward it will track the heading better.
float sfTargetVel(void)
float sfTargetHead(void)
These functions return the current reflected values for the velocity and heading setpoints, respectively.
Values are in mm/sec and degrees.
56
Saphira Software Manual
State Explanation
sfINIT Initial state
sfSUSPEND Suspended state
sfRESUME Resumed state
sfINTERRUPT Interrupted state
-n Suspend this process for n cycles
Process cycle time is 100 milliseconds. On every cycle, Saphira calls each process with
process_state set to the current value for that process. The process may change its state by resetting
process_state. A process may suspend itself by setting the state to sfSUSPEND. Some other process
or your program must resume a suspended process (see below for relevant functions). A process may also
suspend itself for n cycles by setting process_state to -n, in which case it will resume after the
allotted time with state sfRESUME.
The sfINTERRUPT state indicates an interrupt request from another process or the user. Processes
should be written to respond to interrupts by saving needed information, then suspending until receipt of a
resume request. Many of Saphira’s predefined processes are written in this way.
The fixed cycle time of process invocation means that processes can have guaranteed response time for
critical tasks; a controller can issue a command every 100 millisecond, for example. Of course, response
time depends on the conformity of all processes: the combined execution time of all processes must never
exceed 100 milliseconds. If it does, the cycle time will exceed 100 milliseconds for all processes. Hence,
allow around 2-5 milliseconds compute time per process, and either divide large processes into smaller
pieces, each able to execute within the 2-5 millisecond time frame, or run them as concurrent threads.
Here is an example of a typical interpretation process function. It starts by setting up some
housekeeping variables, then proceeds to alternate door recognition with display of its results every second
or so.
57
6: Guide to the Saphira API
#define FD_FIND 20
#define FD_DISPLAY 21
void find_doors(void)
{
int found_one;
switch(process_state)
{
case sfINIT: /* Come here on startup */
found_one = 0;
{ ... }
process_state = FD_FIND;
break;
case sfRESUME: /* Come here after suspend */
process_state = FD_FIND;
break;
case sfINTERRUPT: /* Interrupt request */
found_one = 0;
process_state = sfSUSPEND;
break;
case FD_FIND: /* Looking for doors */
{ call recognition function }
process_state = FD_DISPLAY;
break;
case FD_DISPLAY: /* Now we display it */
if (found_one)
{ call display function }
process_state = -8; /* suspend for 8 ticks */
break;
}
}
58
Saphira Software Manual
59
6: Guide to the Saphira API
0
(1320,-350)
+X
Heading
control
+180
60
Saphira Software Manual
The first two functions, when given an argument greater than zero, set the front and side buffer limits to
that argument, respectively. If given an argument of zero, they clear their buffers, that is, set the valid
flags to 0. These buffer limits can also be set from the parameter file, and are initialized for a particular
robot on connection.
sfFrontMaxRange is the maximum range at which a front sonar reading is considered valid. It is
initially set to 2500 (2.5 meters). Setting this range higher will make the obstacle avoidance routines more
sensitive and subject to false readings; setting it lower will make them less sensitive.
61
6: Guide to the Saphira API
0
c x: 1000, c y : - 600
+X
h : 900
Front
w : 800
+90 +Y -90
+180
int sfOccPlane (int xy, int source, int d, int s1, int s2)
int sfOccPlaneRet (int xy, int source, int d, int s1, int s2, int *x, int
*y)
The plane functions are slightly different. Instead of looking at a centered rectangle, they consider an
infinite rectangle defined by three sides: a line perpendicular to the direction in question, and two side
boundaries.
Figure 6-3 shows the relevant areas for sfOccPlane(sfFRONT,sfFRONT,600,400,1200). The first
parameter indicates positive X direction for the placement of the rectangle. The second parameter indicates
the source of the sonar information: the front sonar buffer (sfFRONT), the side sonar buffer (sfSIDES), or
both (sfALL).
The rectangle is formed in the positive X direction, with the line X = 600 forming the bottom of the
rectangle. The left side is at Y = 400, the right at Y = -1200. The nearest sonar reading within these bounds
is at an X distance of 650, and that is returned.
62
Saphira Software Manual
0
+X s2 = -1200
s1 = 400
d = 600
Front return = 650
+90 +Y -90
6.6.3. Artifacts
Through Saphira, you can place a variety of artificial constructs within the geometry of the LPS and
have them registered automatically with respect to the robot's movement. Generally, these artifacts are the
result of sensor interpretation routines and represent points and surfaces in the real world. But they can also
be purely imaginary objects: for example, a goal point to achieve or the middle of a corridor.
Artifacts, like the robot, exist in both the LPS and the global map space. Their robot-relative
coordinates in the LPS (x, y, th) can be used to guide the robot locally, e.g., to face towards a goal point.
Their global coordinates (ax, ay, ath) represent position and orientation in the global space. As the robot
moves, Saphira continuously updates the LPS coordinates of all artifacts, to keep them in their relative
positions with respect to the robot. The global positions of artifacts doesn’t change, of course. But the
dead-reckoning used to update the robot’s global position as it moves contains errors, and the robot’s
global position gradually decays in accuracy. To bring it back into alignment with stationary artifacts,
registration routines use sensor information to align the robot with recognized objects. These functions are
described in a subsequent section.
You may add and delete artifacts in the LPS. There are two types of artifacts that users add. Map
artifacts are permanent artifacts representing walls, doorways, and so on in the office environment. Goal
artifacts are temporary artifacts placed in the LPS when a behavior is invoked. The artifact functions as an
input to the behavior: for example, there is a behavior to reach a goal position, and the goal is represented
as a point artifact in the LPS. These artifacts are usually deleted when the behavior is completed.
The system also maintains artifacts of different types. There is an artifact representing the origin of the
global coordinate system. There are various hypothesis artifacts representing hypothesized objects
extracted by the perceptual routines, and used by the registration routines.
63
6: Guide to the Saphira API
typedef enum
{
INVALID, POS, WALL, CORRIDOR, LANE, DOOR, JUNCTION, OFFICE, BREAK, OBJECT
} pt_type;
The point type consists of a directed point (position and direction), with an identifier, a type, a category,
and other parameters used by the system. X, Y coordinates are in millimeters, and direction is in radians
from π to −π. The type POS is used for goal positions in behaviors. Other types may add additional fields
to the basic point type, e.g., length and width for corridors.
typedef struct
{
float x, y, th; /* x,y,th position of point relative to robot
*/
pt_type type; /* type of point */
cat_type cat; /* category */
boolean snew; /* whether we just found it */
boolean viewable; /* whether it's valid */
int id;
float ax, ay, ath; /* global coords */
unsigned int matched; /* last time we matched */
unsigned int announced; /* last time we announced */
} point;
The orientation of a point is useful when defining various behaviors. For example, a doorway is
represented by a point at its center, a width, and a direction indicating which way is into the corridor.
point *sfCreateLocalPoint (float x, float y, float th)
point *sfCreateGlobalPoint (float x, float y, float th)
void sfSetLocalCoords (point *p)
void sfSetGlobalCoords (point *p)
The first two functions create new ARTIFACT points of type POS, based on the supplied coordinates.
For example, sfCreateLocalPoint(1000.0, 0.0, 0.0)creates a point 1 meter in front of the robot. Very useful
for behavior goal positions.
The second two functions reset the local or global coordinates from the other set, based on the robots
current position. These functions are useful after making a change in one set of coordinates.
In order to keep a point’s local coordinates updated within the LPS, it must be added to the pointlist
after it is created. The pointlist is a list of artifacts that Saphira updates when the robot moves. The
following functions add and delete members of the pointlist:
64
Saphira Software Manual
These are SYSTEM points representing the global origin (0,0,0) and the robot’s current position.
float sfNormAngle(float ang)
float sfNorm2Angle(float ang)
float sfNorm3Angle(float ang)
float sfAddAngle(float a1, float a2)
float sfSubAngle(float a1, float a2)
float sfAdd2Angle(float a1, float a2)
float sfSub2Angle(float a1, float a2)
These functions compute angles in the LPS. Normally, angles in the LPS are represented in radians
using floating-point numbers. Artifact angles are always normalized to the interval [0,2π ] .
sfNormAngle will put its argument into this range. The corresponding functions sfAddAngle and
sfSubAngle also normalize their results this way.
It is often convenient to give headings in terms of positive (counterclockwise) and negative (clockwise)
angles. The second normalization function, sfNorm2Angle, converts its argument to the range [ −π ,+π ] ,
so that the discontinuity in angle is directly behind the robot. The corresponding functions sfAdd2Angle
and sfSub2Angle also normalize their results this way.
Finally, it is sometimes useful to reflect all angles into the upper half-plane [−π 2, π 2] . The function
sfNorm3Angle will do this to its argument, by reflecting any angles in the lower half-plane around the
X-axis, e.g., +100 degrees is reflected to +80 degrees.
float sfPointPhi (point *p)
float sfPointDist (point *p)
float sfPointNormalDist (point *p)
float sfPointDistPoint(point *p1, point *p2)
float sfPointNormalDistPoint (point *p, point *q)
void sfPointBaricenter (point *p1, point *p2, point *p3)
The first three functions compute properties of points relative to the robot. The sfPointPhi function
returns the angle of the vector between the robot and the point p, in radians from π to -π. sfPointDist
returns the distance from the point to the robot. sfPointNormalDist returns the distance from the robot to
the line represented by the artifact point.
The second three functions compute properties of points. sfPointDistPoint returns the distance between
its arguments. sfPointNormalDistPoint returns the distance from point q to the line represented by artifact
point p. sfPointBaricenter sets point p3 to be the point midway between point p1 and p2.
void sfChangeVP (point *p1, point *p2, point *p3)
void sfUnchangeVP (point *p1, point *p2, point *p3);
float sfPointXo (point *p)
float sfPointYo (point *p)
65
6: Guide to the Saphira API
66
Saphira Software Manual
67
6: Guide to the Saphira API
;;
;; Map of a small portion of the SRI AIC
;;
The CORRIDOR lines define a series of corridor artifacts. The number in parentheses is the artifact id,
and it must be a positive integer. The first three coordinates are the X, Y, and θ position of the center of the
corridor in millimeters and degrees. The fourth coordinate is the length of the corridor, and the fifth is the
width.
DOOR entries are defined in much the same way, except that the third coordinate is the direction of the
normal of the door, which is useful for going in an out. The fourth coordinate is the width of the door.
The WALL entry does not have an id. The first two coordinates are the X, Y position of the center of the
wall; the third is the direction of the wall, and the fourth is its length. Wall segments are used where a
corridor is not appropriate: the walls of rooms or for large open areas, for example.
int sfLoadMapFile (char *name) (UNIX, MS Windows)
int sfLoadMapFile(char *name, int vref)(Macs)
The sfLoadMapFile function loads a map file name into Saphira and destroys any other map artifacts.
Returns 0 if successful; -1 if not.
68
Saphira Software Manual
7. Saphira Behaviors
Controlling the movement of the robot server is a difficult job. At the lowest level, proportional-
integral-differential (PID) control can make the wheels turn to move the robot at a fixed speed in a desired
direction. But there is a lot more to robot motion than this: The trajectory of the robot must satisfy
conflicting demands from the task and various maintenance policies. For example, in navigating from one
room to another in an office environment, the trajectory in large part is defined by goal positions at
corridor intersections. The robot should achieve these positions as quickly as possible, subject to safety and
power considerations. On a more local scale, the robot should avoid obstacles and respond to contingencies
such as closed doors or blocked corridors.
69
7: Saphira Behaviors
BEHAVIOR:=
“BeginBehavior” symbol
“Params” [PARAM_STMTS]
“Rules” [RULE_STMTS]
[“Init” C_STMTS]
“Update” [C_STMTS]
“Activity” [ACT_STMTS]
“EndBehavior”
/* behavior parameters */
PARAM_STMTS:=
{“sfINT” | “sfFLOAT” | “sfPTR”} symbol [PARAM_STMTS]
/* fuzzy expression */
FUZZY_EXP:=
symbol | float
| “Not” FUZZY_EXP
| FUZZY_EXP “And” FUZZY_EXP
| FUZZY_EXP “Or” FUZZY_EXP
| “(“ FUZZY_EXP “)”
MOD:=
“Very Slowly” | “Slowly” | “Moderately” | “Sharply”
| “Very Sharply”| symbol
MVAL:=
symbol | int | float
/* activity statements */
ACT_STMTS:=
{“Turn” | “Speed” | “Goal” | “Progress”} FUZZY_EXP
[ACT_STMTS]
70
Saphira Software Manual
1.0
0.0
-70.0 -30.0
The functions f_smaller, f_greater, and f_eq compare two numbers and return a fuzzy value based on
whether the first is smaller than, larger than, or equal to the second. The delta argument is the range over
which the fuzzy value will vary.
71
7: Saphira Behaviors
7.6.4. Rules
Each behavior rule is defined as a structure beh_rule, which consists of a name, and two indices into the
fuzzy state: the antecedent value for the rule, and the mean value of the output action. Each rule can
recommend only one action, which is the consequent value: one of Accel, Decel, Turn_left, or Turn_right:
typedef struct
{
char *name; /* name of the rule */
int *antecedent, /* activity of this rule */
*consequent, /* action to take */
*parameter; /* mean value of action */
} beh_rule;
For example rule definitions, see below. Note that the consequent value constants are external integers,
but they are not declared in the Saphira headers, so they must be declared in the application code.
behavior
constant_velocity =
{ "Constant Vel", cv_setup, cv_check_speed, 1,
2, { { "Speed-Up", &cv_too_slow ,
&Accel, &cv_speedup},
{ "Slow-Down", &cv_too_fast,
&Decel, &cv_slowdown}
}
};
The first argument is the name of the behavior; the second is the init function; the third is the update
function; and the fourth argument is the number of parameters. The number of rules is the fifth argument,
72
Saphira Software Manual
and the rules themselves are the sixth. Note that all global variables are referenced as pointers in the
behavior.
The maximum number of rules in a behavior is 10. The consequent values Accel and so on must be
declared as external integers.
Normally, only on behavior instance for a given behavior is allowed to run. sfInitBehavior check for
any currently-running instances, and if one is present, just replaces its parameters. There are cases where
you may want more than one instance with different parameters. The sfInitBehaviorDup function is similar
to sfInitBehavior, but does not check for duplicate behavior instantiations.
73
7: Saphira Behaviors
74
Saphira Software Manual
Parameter Effect
sfFLOAT Front sensitivity to obstacles. Value from 0.5 (not sensitive)
to 3.0 (very sensitive).
sfFLOAT Side sensitivity to obstacles. Value from 0.5 (not sensitive)
to 3.0 (very sensitive).
sfFLOAT Turning gain: controls how rapidly the robot turns away
from obstacles. Value from 4.0 (slow turn) to 10.0 (fast
turn).
sfFLOAT Standoff. Defines the avoidance “bubble” around the robot.
Value from flakey_radius (at the robot) to flakey_radius +
standoff (standoff mm from the robot).
sfPreferredTurnDir This global variable controls the default direction of turn
when the front is blocked. Values are sfLEFTTURN or
sfRIGHTTURN.
behavior *sfStopCollision
Slows the robot sharply to avoid immediate obstacles. This behavior differs from sfAvoidCollision in
that it doesn’t turn the robot; some other behavior must do that. Takes three parameters, listed in the Table
7-4.
Parameter Effect
sfFLOAT Front sensitivity to obstacles. Value from 0.5 (not sensitive)
to 3.0 (very sensitive).
sfFLOAT Side sensitivity to obstacles. Value from 0.5 (not sensitive)
to 3.0 (very sensitive).
sfFLOAT Standoff. Defines the avoidance “bubble” around the robot.
Value from flakey_radius (at the robot) to flakey_radius +
standoff (standoff mm from the robot).
behavior *sfKeepOff
Gently steers the robot around and away from distant objects. The behavior takes two parameters and
uses the global variable sfPreferredTurnDir, described in the Table 7-5. The priority for sfKeepOff should
always be less than (higher priority number) than that for sfAvoidObstacle when they are invoked together.
75
7: Saphira Behaviors
Parameter Effect
sfFLOAT Caution speed. Robot slows to this speed when more distant
obstacles are detected. Value in mm/sec.
sfFLOAT Sensitivity to obstacles. Value from 0.2 (not sensitive) to 2.0
(very sensitive).
sfPreferredTurnDir This global variable controls the default direction of turn
when the front is blocked. Values are sfLEFTTURN or
sfRIGHTTURN.
behavior *sfGoToPos
Sends the robot to a given point. Takes three parameters, described in Table 7-6.
Parameter Effect
sfFLOAT Speed (in mm/sec). Robot moves at this speed towards goal position.
sfPTR Goal position. Should be a pointer to a point artifact.
sfFLOAT Success radius (in mm). Defines how close the robot must be to the
goal position before the behavior goal is satisfied.
behavior *sfAttendAtPos
Moves the robot near a given goal position and points the robot towards the goal position. Takes three
parameters, described in Table 7-7.
Parameter Effect
sfFLOAT Speed. Robot moves at this speed towards goal position. Value in
mm/sec.
sfPTR Goal position. Should be a pointer to a point artifact.
sfFLOAT Success radius. Defines how close the robot must be to the goal
position before the behavior goal is satisfied. Value in mm.
behavior *sfFollow
Tells the robot to follows a lane, as represented by a lane artifact. The lane structure is a directed point
with a width, although the width is ignored in this behavior since there are explicit parameters for the
latitude the robot is allowed in the lane. There is also a goal point, representing a position in the lane that
the robot is to achieve.
When active, the behavior draws its lane as a set of dotted lines in the LPS. This behavior takes seven
parameters, described in Table 7-8. This behavior sets the sfPreferredTurnDir variable depending on how
the robot is misaligned with the lane.
76
Saphira Software Manual
Parameter Effect
sfPTR Lane. This is a point or lane artifact representing a line the robot is
to follow. Parameters below define allowed deviations from the line.
sfPTR Goal position. The robot moves along the lane in the direction of the
goal until it reaches it. Should be a pointer to a point artifact.
sfFLOAT Right edge (in mm). Distance the robot is allowed to wander from
the right side of the line.
sfFLOAT Left edge (in mm). Distance the robot is allowed to wander from the
left side of the line.
sfFLOAT Speed off lane (in mm/sec). How fast the robot travels when it is out
of the lane.
sfFLOAT Speed in lane (in mm/sec). How fast the robot travels when it is in
the lane.
sfFLOAT Turn ratio. How important it is to be near the center vs. aligned in
the right direction; 0.0: direction overrides; 1.0: center overrides.
behavior *sfFollowCorridor
Tells the robot to follow a corridor, as represented by a corridor artifact. The corridor structure is a
directed point with a width; the width is used to set up a lane down the center of the corridor for the robot
to follow. There is also a goal point, representing a position in the lane that the robot is to achieve.
When active, the behavior draws its lane as a set of dotted lines in the LPS. This behavior takes two
parameters, described in Table 7-9. This behavior sets the sfPreferredTurnDir variable depending on how
the robot is misaligned with the corridor.
Table 7-9. Follow corridor behavior parameters
Parameter Effect
sfPTR Corridor. This is a corridor artifact the robot is to follow. The path
of the robot is bounded by a lane set in from the sides of the
corridor.
sfPTR Goal position. The robot moves along the corridor in the direction of
the goal until it reaches it. This should be a pointer to a point
artifact.
behavior *sfFollowDoor
Tells the robot to go in a doorway, as represented by a door artifact. The direction is whether to go in or
out of the doorway; this could be decided automatically by the position of the robot, but isn’t because the
robot may already be on the correct side.
When active, the behavior draws its lane as a set of dotted lines in the LPS. This behavior takes two
parameters, described in Table 7-10. This behavior sets the sfPreferredTurnDir variable depending on how
the robot is misaligned with the lane through the doorway.
77
7: Saphira Behaviors
Parameter Effect
sfPTR Door. This is a door artifact the robot is to go in or out of. The path
of the robot is bounded by a narrow lane perpendicular to the door.
sfINT Direction (sfIN or sfOUT). “In” means into the room, “out” means
out of the room and into the corridor.
behavior *sfTurnTo
Turns the robot to point in the direction of a goal position. The robot always turns in the direction that
makes the smallest turn. Parameters are given in Table 7-11.
Parameter Effect
sfPTR Goal position. The robot turns until it points towards this goal.
Should be a pointer to a point artifact.
sfFLOAT Success angle (in radians). If the robot is within this angle of
pointing towards the goal, it will have succeeded.
sfFLOAT Turn speed. How fast the robot turns to the goal. Value of 0.5 is
slow speed, 2.0 is fast.
78
Saphira Software Manual
In this first part, we set up a global point that is used by the “follow corridor” behavior as a target, as
well as define some convenient names for the states of the intention. Note that these states are all 10 or
greater, meaning they are user defined.
79
8: Intentions and PRS lite
convenience function */
switch(process_state)
{
case sfINIT:
case sfRESUME:
add_point_check(&follow_target);
process_state = CHECK_CORRIDOR;
break;
The above code defines the initial and resumed states of the intention. We then add the target point to
the pointlist. Next, we set the process state to check for a corridor:
case CHECK_CORRIDOR:
if (current_environment != NULL &&
current_environment->type == CORRIDOR)
{
e = current_environment;
process_state = FOLLOW_CORRIDOR;
follow_target.x = 10000.0; follow_target.y = 0;
par = beh_alloc(7);
FOL_LANE(par) = current_environment;
FOL_TARGET(par) = &follow_target;
p = intend_beh(&follow_corridor,"follow it",0,par,2);
}
break;
Whenever the robot is in a corridor, the current_environment variable is set to an artifact representing
that corridor by the registration processes. If the robot is not in a corridor or other recognizable place, this
variable is NULL. The intention checks current_environment, and when it is not NULL it saves the
environment artifact and sets up the follow_corridor behavior. It does this by first constructing a target
point 10 meters in front of the robot (note how easy this is with robot-centered coordinates), and then by
invoking the intend_beh function. This is a special PRS-lite function that initializes a behavior and a
supervising intention at the same time. The argument 0 is a timeout condition (that is, no timeout), and the
argument 2 is the priority level of the behavior. The state is thereby changed to follow a corridor.
When the current environment changes, the behavior accomplishes its goal, or the robot is no longer
aligned towards the target, the intention sets the state of the follow_corridor intention to REMOVE, and
changes its own state.
case WAIT_REMOVE:
process_state = CHECK_CORRIDOR;
break;
The intention waits one cycle while the follow_corridor intention actually gets removed, and then it
goes back to waiting for a corridor environment.
80
Saphira Software Manual
8.1.4. Finished
case sfINTERRUPT: /* clean up here */
if (p) p->state = sfREMOVE;
process_state = sfSUSPEND;
break;
}
}
The INTERRUPT state is reached when the user or another intention requests an interrupt. The intention
responds by getting rid of any follow_corridor actions and then suspending.
81
8: Intentions and PRS lite
This function also sets the global variables sfRobotName, sfRobotClass, and sfRobotSubclass according
to the information returned from the robot; see the table below. Assuming the environment variable
SAPHIRA is set correctly, it will autoload the correct parameter file from the params directory, using first
the subclass if it exists, and then the class.
Table 8-3 Robot names and classes
(char *)sfRobotName See robot descriptions for information on how to set the
name. The simulator returns the name of the machine it is
running on.
(char *)sfRobotClass Robot classes are B14, B21, and Pioneer
(char *)sfRobotSubclass Subclasses are subtypes, e.g., in Pioneer-class robots the
subclass is the OS type, currently PSOS41.
82
Saphira Software Manual
83
Saphira Software Manual
9. Saphira Vision
Current versions of Saphira have both generic vision support and explicit support of the Fast Track
Vision System (FTVS), which is available as an option for the Pioneer 1 Mobile Robot. The FTVS is a
product from Newton Labs, Inc., adapted for Pioneer. The generic product name is the Cognachrome
Vision System. Details about the system, manuals, and development libraries can be found at Newton
Labs’ Web site: http://www.newtonlabs.com.
With Saphira, the FTVS intercepts packet communication from the client to robot server, interprets
some commands from the client, and sends new vision information packets back to the client. Saphira
includes support for setting some parameters of the vision system, but not for training the FTVS on new
objects, or for viewing the output of the camera. For this, please see the FTVS user manual about
operating modes. In the future, we intend to migrate some of the training functions to the Saphira client.
We also intend to have Saphira display raw and processed video.
Saphira also includes built-in support for interpreting vision packet results. If your robot has a vision
system, Saphira will automatically interpret vision packets and store the results as described below.
85
9: Saphira Vision
In BLOB_MODE, the x, y, and area slots are active. The x,y coordinates are the center of mass of
the blob in image coordinates, where the center of the image is 0, 0. For the lens shipped with the FTVS,
each pixel subtends approximately 1/3 degree:
#define DEG_TO_PIXELS 3.0 /* approximately 3 pixels per degree */
This constant lets a client convert from image pixel coordinates to angles. The area is the approximate
size of the blob in pixels. If the area is zero, no blob was found.
In BLOB_BB_MODE, the bounding box of the blob is also returned, with h and w being the height and
width of the box in pixels.
In LINE_MODE, the slots x, first, and num are active. The value x is the horizontal center of the
line. first is the first (bottom-most) row with a line segment, and num is the number of consecutive
rows with line segments. If no line was found, num is zero.
Global variables hold information for each channel, as follows:
extern struct vinfo sfVaInfo, sfVbInfo, sfVcInfo;
For example, to see if channel A is in BLOB_MODE, use
sfVaInfo.type == 0
86
Saphira Software Manual
87
Saphira Software Manual
+Y, 90 degrees
+X, 0 degrees
0,0
width 38000
height 30000
89
World Description File
;; Starting position
90
Saphira Software Manual
Behaviors
BEHCLOSURE sfFindBehavior(char *name) 78
BEHCLOSURE sfInitBehavior(behavior *b, int priority,
int running, ...) 77
BEHCLOSURE sfInitBehaviorDup(behavior *b, int priority,
int running, ...) 77
int sfBehaviorControl 74
void sfBehaviorOff(BEHCLOSURE b) 78
void sfBehaviorOn(BEHCLOSURE b) 78
void sfKillBehavior(BEHCLOSURE b) 78
void sfSetBehaviorState(BEHCLOSURE b, int state) 78
91
API Reference
behavior *sfGoToPos 80
behavior *sfKeepOff 80
behavior *sfStop 79
behavior *sfStopCollision 79
behavior *TurnTo 82
Fuzzy Variables
float down_straight(float x, float min, float max) 75
float f_and(float x, float y) 76
float f_eq(float x, float c, float delta) 75
float f_greater(float x, float c, float delta) 75
float f_not(float x) 76
float f_or(float x, float y) 76
float f_smaller(float x, float c, float delta) 75
float straight_up(float x, float min, float max) 75
Intentions
int finished(process *p) 85
process *intend_beh(behavior *b, char *name, int timeout,
beh_params params, int priority) 86
process *sfInitIntention(void (*fn)(void), char *name,
int timeout, ...) 85
Map File
int sfLoadMapFile(char *name) <Unix; MSW> 71
int sfLoadMapFile(char *name, int vref) <Mac> 71
Occupancy
int sfOccBox(int xy, int cx, int cy, int h, int w) 63
int sfOccBoxRet(int xy, int cx, int cy, int h, int w,
float *x, float *y) 63
int sfOccPlane(int xy, int source, int d, int s1, int s2) 64
int sfOccPlaneRet(int xy, int source, int d, int s1, int s2,
float *x, float *y) 64
92
Saphira Software Manual
Packet Functions
char *sfReadClientString(void) 88
int sfClientBytes(void) 88
int sfConnectToRobot(int port, char *name) 86
int sfHaveClientPacket(void) 87
int sfReadClientByte(void) 88
int sfReadClientSint(void) 88
int sfReadClientUsint(void) 88
int sfReadClientWord(void) 88
int sfWaitClientPacket(int ms) 87
void sfDisconnectFromRobot(void) 87
void sfProcessClientPacket(void) 87
void sfResetRobotVars(void) 87
void sfRobotCom(int com) 87
void sfRobotCom2Bytes(int b1, int b2) 87
void sfRobotComInt(int com, int arg) 87
void sfRobotComStr(int com, char *str) 87
void sfRobotComStrn(int com, char *str, int n) 87
Processes
process *sfFindProcess(char *name) 59
process *sfInitProcess(void *fn(void), char *name) 59
void sfInterruptProcess(process *p) 59
void sfInterruptSelf(void) 59
void sfResumeProcess(process *p 59
void sfSetProcessState(process *p, int state) 59
void sfSuspendProcess(process *p, int n) 59
void sfSuspendSelf(int n) 59
Processes; Predefined
void sfInitBasicProcs(void) 53
void sfInitControlProcs(void) 53
void sfInitInterpretationProcs(void) 53
void sfInitRegistrationProcs(void) 53
93
API Reference
Sensor Interpretation
wall sfLeftWallHyp 69
wall sfRightWallHyp 69
Sonars
float sfFrontMaxRange 63
void sfSetFrontBuffer(int n) 63
void sfSetSideBuffer(int n) 63
int sfSonarRange(int num) 56
int sfSonarNew(int num) 56
float sfSonarXCoord(int num) 56
float sfSonarYCoord(int num) 56
State Reflection
struct robot sfRobot 54
int sfStalledMotor(int which) 55
void sfTargetHead(void) 57
void sfTargetVel(void) 57
Vision
void draw_blobs(void) 90
void find_blob(void) 90
int found_blob(int channel, int delta) 90
sfRobotComStr(VISION_COM,"line_bottom_row=0") 89
sfRobotComStr(VISION_COM,"pioneer_X_mode=N") 89
void search_and_go_blob(void) 91
void setup_vision_system(void) 90
94
Saphira Software Manual
Index
init function 72
input parameters 72
A invoking 73
ActivMedia, Inc. 1 keep off 18, 75
API Predefined 74
artifacts 63 rules 72
Drawing and Color 66. See drawing and color schema 72
Fuzzy variables 71. See fuzzy variables sfBehaviorOff 74
General See API sfBehaviorOn 74
maps 67. See maps sfFindBehavior 74
Motor stall 54 sfKillBehavior 74
OS functions 51 sfSetBehaviorState 74
window mode See OS functions Stop Collision 75
argument types 44 Turn To 78
Artifacts 15, 63 update function 72
points and lines 64. See points and lines window 17
async sample client 32 Behaviors window 17
Asynchronous routines 9, 28 Behaviors: 73
Attend at position parameters 76
autoconfiguration 47 C
Avoid collision parameters 74
C++ programs 28
Channel modes 85
B checksum 42
bat 15 chroma.h 85
battery 15 Client
Behavior arguments 73 artifacts 15
behavior closure states 74 bat 15
Behavior executive 70 battery 15
Behavior grammar 69, 70 Behaviors window 17
behavior.beh 74 commands 43. See Client commands
Behaviors connect menu 16
sfInitBehavior 73 connect menu: See files menu. See connect menu
Behaviors control point 14
arguments 73 CPU 15
Attend At Position 76 display 13
Avoid Collision 74 display menu 16. See display menu
behavior.beh 74 files menu 16
closure states 74 functions menu 16
Constant Velocity 74 grow 16
Description 11 Information area 15
Follow Corridor 77 Intentions window 20
Follow Door 77 keyboard 16
Follow Lane 76 main window 13
Go To Position 76 messages 15
grammar 69, 70 MPac 15
implementing 71 obstacle sensitivity 15
95
Index
position 15 D
Processes window 19
shrink 16 data types 42
sonars 14 delete map 16
sonars menu 16. See sonars menu direct client example 31
SPac 15 Direct motion control 11, 55, 70
Starting 1 disconnect 16, 25
status 15 display
velocity 15 states 52
velocity vectors 15 display menu 16
VPac 15 local 16
Client commands occ grid 16
argument types 44 single step 16
communication rate 43 wake 16
composition 44 display states 52
General 43 down_straight 71
PSOS 44 draw_blobs 86
saphira.h 44 drawing and color
Client installation See Installation set_vector_buffer 67
Clients sfDrawCenteredRect 67
async example 32 sfDrawRect 67
direct example 31 sfSetLineColor 67
nowin example 35 sfSetLineType 67
packet example 38 sfSetLineWidth 67
saphira example 35 sfSetPatchColor 67
COMDHEAD 44
COMDIGOUT 44
Communication packets 41. See packets
E
communications rate 45 errors 43
COMOPEN 44 exit menu 26
COMORIGIN 44
compiling clients 27
MS Visual C++ 31 F
system requirements 27
f_and 71
Unix clients 29
f_eq 71
COMPOLLING 44
f_greater 71
Components
f_not 71
Optional 1
f_or 71
COMPTUPOS 44
f_smaller 71
COMPULSE 44
Fast Track Vision System 85
COMSETO 44
files menu
COMSTEP 44
delete map 16
COMTIMER 44
save map 16
COMVEL 44
find_blob 86
config.h 32
finished 81
configuration 48
Follow corridor parameters 77
connect 16
Follow door parameters 77
connect menu
Follow lane parameters 76
connect 16
Follow the corridor 80
disconnect 16, 25
found_blob 86
Connecting 12
FTP See Customer resources
CPU 15
functions menu 16
Customer resources
Fuzzy variables 71
FTP 4
combination functions 71
Newsgroups 4
down_straight 71
Support 5
f_eq 71
96
Saphira Software Manual
f_greater 71 M
f_or 71
f_smaller 71 main window 13
straight_up 71 majordomo See Customer resources
manual drive 16
G maps
file format 67
Go to position parameters 76 registration and creation 68
grow 16, 25 sfLoadMapFile 68
Gzip See Installation Menus See also Client
Saphira client 15
Simulator 25
H micro-tasking OS 7, 8, 28, 29
Handler micro-tasks7, 8, 9, 11, 19, 20, 28, 29, 31, 32, 33, 35, 36, 53, 57. See proce
include 27 motion setpoint 11, 55
Motor stall 54
sfStalledMotor 55
I mouse 37
mouse actions 37
Includes 27
MPac 15
information area 26
MS Visual C++ 31
information packet 45
myButtonFn 52
Installation 2
myKeyFn 52
intend_beh 82
Intention schemas 79
Intentions N
finished 81
Follow the corridor 80 Newton Labs, Inc 85
intend_beh 82 nowin example client 35
invoking behaviors 82
parameters 81 O
schemas 79
sfInitIntention 81 occ grid 16
window 20 occupancy
Intentions window 20 sfOccBox 61
sfOccBoxRet 61
sfOccPlaneRet 62
K occupancy: 62
Keep off behavior 18 Open Agent Architecture (OAA) 5, 10, 12
Keep off parameters 75 OS functions
keyboard 16, 37 sfIsConnected 51
keyboard actions 37 sfPause 51
Konolige, Dr. Kurt 1 OS functions
display states 52
myButtonFn 52
L myKeyFn 52
sfButtonProcFn 52
load menu
sfErrMessage 52
load param file 25
sfErrSMessage 52
load world file 25
sfKeyProcFn 52
load param file 25
sfMessage 52
load world file 25
sfOnConnectFn 51
local 16
sfOnDisconnectFn 51
Local Perceptual Space 59, 60
sfOnStartupFn 51
LPS 59. See Local Perceptual Space
sfScreenToWorldX 52
sfScreenToWorldY 52
sfSetDisplayState 51
97
Index
sfSMessage 52 sfPointNormalDist 65
sfStartup 51 sfPointNormalDistPoint 65
os.h 32 sfPointPhi 65
sfPointXo 66
sfPointXoPoint 66
P sfPointYo 66
packet client example 38 sfPointYoPoint 66
packet communication 7, 9, 31, 33, 54, 85 sfRemPoint 65
packet functions sfRobotOrigin 65
sfRobotCom2Bytes 83 sfSetGlobalCoords 64
packet functions sfSetLocalCoords 64
port types and names 82 sfSub2Angle 65
sfClientBytes 83 sfSubAngle 65
sfConnectToRobot 82 sfUnchangeVP 66
sfDisconnectFromRobot 83 port
sfHaveClientPacket 83 names 47
sfProcessClientPacket 83 types 47
sfReadClientByte 83 port types and names 82
sfReadClientSint 83 Predefined Behaviors 74
sfReadClientString 83 Procedural Reasoning System 10, 79
sfReadClientUsint 83 Procedural Reasoning System (PRSlite) 11
sfReadClientWord 83 Processes
sfResetRobotVars 83 sfFindProcess 58
sfRobotCom 83 sfInitProcess 58
sfRobotComInt 83 sfInterruptProcess 58
sfRobotComStr 83 sfInterruptSelf 58
sfRobotComStrn 83 sfResumeProcess 58
sfWaitClientPacket 83 sfSetProcessState 58
packets sfSuspendProcess 58
checksum 42 sfSuspendSelf 58
data types 42 state values 57
errors 43 window 19
protocols 41 Processes window 19
Parameter File 87 PRS-lite 79. See Intentions
parameter files 24 PSOS 41, 44
PCOMCLOSE 44
pioneer-users See Customer resources R
Pkzip See Installation
points and lines README 27
sfAdd2Angle 65 Real World Interface, Inc. 1
sfAddAngle 65 recenter menu 26
sfAddPoint 65 Registration 10, 11, 49, 53, 67
sfAddPointCheck 65 robot configuration 48
sfChangeVP 66 ROBOT_SOCKET 24
sfCreateGlobalPoint 64 RWI See Real World Interface, Inc.
sfCreateLocalPoint 64
sfFindArtifact 65
sfGlobalOrigin 65
S
sfMoveRobot 66 Saphira
sfNorm2Angle 65 API 51. See API
sfNorm3Angle 65 Behaviors 11, 69. See Behaviors
sfNormAngle 65 colors 67
sfPointBaricenter 65 compiling clients 27
sfPointDist 65 General description 1
sfPointDistPoint 65 Global Map Space (GMS) 10
sfPointMove 66 Intentions 79. See Intentions
98
Saphira Software Manual
maps 67 sfAttendAtPos 76
multiprocessing 57 sfAvoidCollision 74
Occupancy functions 61. See occupancy sfBehaviorControl 70
packet functions 82. See packet functions sfBehaviorOff 74
Path 3 sfBehaviorOn 74
processes 52, 57, 58. See Saphira processes sfButtonProcFn 52
PRS-lite See Intentions sfChangeVP 66
Quick start 3 sfClientBytes 83
Representation of space 10 sfCOMCLOSE 48
Robots 1 sfCOMDHEAD 48
Servers 41 sfCOMOPEN 48
vision 85 sfCOMPOLLING 50
Saphira behaviors 69 sfCOMPULSE 48
Saphira colors 67 sfCOMRVEL 48
SAPHIRA environment variable 3, 27, 30, 31, 82 sfCOMSETO 48
saphira example client 35 sfCOMSYNC 47
Saphira maps 67 sfCOMVEL 48
Saphira processes 52 sfCOMVEL2 48
52, 53 sfConnectToRobot 82
sfInitControlProcs 53 sfConstantVelocity 74
sfInitInterpretationProcs 53 sfCreateGlobalPoint 64
sfInitRegistrationProcs 53 sfCreateLocalPoint 64
Saphira vision 85 sfDisconnectFromRobot 83
saphira.c 27 sfDoneHeading 56
Saphira: Local Perceptual Space (LPS) 10 sfDonePosition 56
saphira-users See Customer resources sfDrawCenteredRect 67
save map 16 sfDrawRect 67
search_and_go_blob 86 sfErrMessage 52
sensor interpretation 53, 66 sfErrSMessage 52
Sensor interpretation routines 11 sfFindArtifact 65
Server sfFindBehavior 74
Information packet 45 sfFindProcess 58
Server information packet 45 sfFollow 76
SERVER_NAME 12 sfFollowCorridor 77
Servers 41 sfFollowDoor 77
autoconfiguration 47 sfFrontMaxRange 61
Pioneer Server Operating System 41 sfGlobalOrigin 65
ports 47. See ports sfGoToPos 76
position integration 49 sfHaveClientPacket 83
sfCOMCLOSE 48 52, 53
sfCOMDHEAD 48 sfInitBehavior 73
sfCOMOPEN 48 sfInitBehaviorDup 73
sfCOMPOLLING 50 sfInitControlProcs 53
sfCOMPULSE 48 sfInitIntention 81
sfCOMSETO 48 sfInitInterpretationProcs 53
sfCOMSYNC 47 sfInitProcess 58
sfCOMVEL 48 sfInitRegistrationProcs 53
shut down 47 sfInterruptProcess 58
sonars 50 sfInterruptSelf 58
start up 47 sfIsConnected 51
set_vector_buffer 67 sfKeepOff 75
setup_vision_system 86 sfKeyProcFn 52
sfAdd2Angle 65 sfKillBehavior 74
sfAddAngle 65 sfLeftWallHyp 66
sfAddPoint 65 sfLoadMapFile 68
sfAddPointCheck 65 sfMessage 52
99
Index
sfMoveRobot 66 sfSetRVelocity 56
sfNorm2Angle 65 sfSetSideBuffer 61
sfNorm3Angle 65 sfSetVelocity 56
sfNormAngle 65 sfSMessage 52
sfOccBox 61 sfStalledMotor 55
sfOccBoxRet 61 sfStartup 51
sfOccPlane 62 sfStopCollision 75
sfOccPlaneRet 62 sfSub2Angle 65
sfOnConnectFn 51 sfSubAngle 65
sfOnDisconnectFn 51 sfSuspendProcess 58
sfOnStartupFn 51 sfSuspendSelf 58
sfPause 51 sfTargetHead 56
sfPointBaricenter 65 sfTargetVel 56
sfPointDist 65 sfUnchangeVP 66
sfPointDistPoint 65 sfWaitClientPacket 83
sfPointMove 66 shrink 16, 25
sfPointNormalDist 65 shut down 47
sfPointNormalDistPoint 65 Simulator
sfPointPhi 65 connect menu 25. See connect menu
sfPointXo 66 Description 23
sfPointXoPoint 66 display menu 25
sfPointYo 66 exit menu 26
sfPointYoPoint 66 General description 1
sfProcessClientPacket 83 grow 25
sfReadClientByte 83 information area 26
sfReadClientSint 83 load menu 24, 25. See load menu
sfReadClientString 83 Menus 25
sfReadClientUsint 83 mouse actions 26
sfReadClientWord 83 parameter files 24
sfRemPoint 65 pioneer.exe 23
sfResetRobotVars 83 recenter menu 26
sfResumeProcess 58 ROBOT_SOCKET 24
sfRightWallHyp 66 shrink 25
sfRobot 54 socket 24
sfRobotCom 83 Starting 23
sfRobotCom2Bytes 83 wake 25
sfRobotComInt 83 Worlds 25
sfRobotComStr 83, 85 single step 16
sfRobotComStrn 83 Sonar buffers 59
sfRobotOrigin 65 sfFrontMaxRange 61
sfScreenToWorldX 52 sfSetFrontBuffer 61
sfScreenToWorldY 52 sfSetSideBuffer 61
sfSetBehaviorState 74 sonars 50
sfSetDHeading 56 sonars menu
sfSetDisplayState 51 clear buffer 16
sfSetFrontBuffer 61 sonars on 16
sfSetGlobalCoords 64 SPac 15
sfSetHeading 56 SRI International ii, 1, 4, 5, 7, 12, 27, 68, 79
sfSetLineColor 67 start up 47
sfSetLineType 67 startup callback 32
sfSetLineWidth 67 State reflection 53
sfSetLocalCoords 64 state reflector 9, 11, 31, 32, 38, 39, 45, 53, 55, 56, 59
sfSetMaxVelocity 56 sfRobot 54
sfSetPatchColor 67 Stop collision parameters 75
sfSetPosition 56 straight_up 71
sfSetProcessState 58 support See Customer resources
100
Saphira Software Manual
SYNC0 44 chroma.h 85
SYNC0 47 draw_blobs 86
SYNC1 44 find_blob 86
SYNC1 47 found_blob 86
SYNC2 44 packets 85
SYNC2 47 sample application 86
search_and_go_blob 86
setup_vision_system 86
T sfRobotComStr 85
TurnTo 78 Vision packets 85
VPac 15
U
W
Unix clients 29
user process 36 wake 16, 25
sample 36 World Description File 89
World files 25
V
Z
ver53 2. See also Installation
Vision 85 Zip See Installation
channel modes 85. See Vision:
101
Saphira Software Manual
103