Gripper & Experimenter’s Module

void

sfRobotCom2Bytes(int com, int high, int low)

{

sfRobotComInt(com, ((high & 0xff)<<8) + (low & 0xff));

}

/*************************************************************

*Speaker functions -- play a tone string

*Format of string is L1 T1 L2 T2 .... Ln Tn

*where Li is length of tone i in 20ms increments

*

and Ti is tone half-cycle time in 150us increments

*

 

*Max length of string is 40 bytes (20 tones)

**************************************************************/

void

sfPlayToneString(char *str, int n)

{

if (n > 40) n = 40; sfRobotComStrn(sfCOMSAY, str, n);

}

/*************************************************************

*Gripper functions --- set and retrieve gripper state

*

*States are sfUP, sfDOWN, sfMIDDLE, sfOFF, and sfMOVING

*sfMOVING occurs only during transitions between states

*sfOFF can be set by the user, which means no state control

*sfOFF can be set by the robot to indicate a timeout

*

**************************************************************/

/* states */

 

#define sfGRIPOFF

0

#define sfGRIPUP

1

#define sfGRIPMOVING 2 #define sfGRIPMIDDLE 4 #define sfGRIPDOWN 5 #define sfCOMGRIPPER 33

(continued)

21

Page 25
Image 25
Pioneer Module Mobile manual Gripper & Experimenter’s Module