Pioneer Module Mobile User Manual

Page 17

Advertising
background image

Gripper & Experimenter’s Module

13

The revised PSOS 4.2 (and later) sfCOMDIGOUT command has a two-byte

argument: The high byte is a mask of those output bits you want to change, and the low
byte is the bit pattern for the bits to change. This way, you don’t need to know the state
of the port(s) you want to change; just the state in which you want them to be, and you
won’t change the state of any of the other ports.

The Saphira function, sfRobotCom2Bytes, packages the sfCOMDIGOUT command

and values for you. For example:

sfRobotCom2Bytes(sfCOMDIGOUT, 0x20, 0x00)

resets bit 5 (OD0=0), and leaves everything else alone.

Accordingly, make the Gripper go up:

sfRobotCom2Bytes(sfCOMDIGOUT, 0x3, 0x3)

Go down:

sfRobotCom2Bytes(sfCOMDIGOUT, 0x3, 0x2)

And stop:

sfRobotCom2Bytes(sfCOMDIGOUT, 0x2, 0x00)

You have to monitor the various Gripper state switches to determine if and when it

achieves a particular state—fully down with paddles open, for instance—when setting the
Gripper’s control I/O ports directly (see below).

4.4.2 State Commands

A more intelligent means of controlling the Gripper is through PSOS

sfCOMGRIPPER command and state parameters. These automatically manage the
Gripper so to achieve some pre-defined state. PSOS also monitors and reports the
Gripper’s progress towards that state, saving you some coding time and effort. And the
state commands use a timeout feature to protect against unfortunate stalls or hang-ups.

To operate the Gripper this way, you simply issue a state command to the robot. You

don’t need to, but you may monitor the Gripper’s progress towards the state via bits 0
and 2 of the digout part of the server information packet (“sfROBOT.digoutput”). During
transitions, the state returned by the robot is set to sfGRIPMOVING. After successfully
achieving a state, the state returned is that state. If there is a time-out (6 seconds) without
achieving the state, the return state is set to sfGRIPOFF.

The various states and values are included in the script at the end of this chapter and

that you may including in your own C programs.

There also are several Saphira convenience functions defined for gripper states:

int sfGripperGetState (void)

Returns the robot gripper state setpoint

void sfGripperSetState (int state)

Sets the robot gripper state setpoint

Advertising