Pioneer Module Mobile Robotics User Manual


 
22
/* gripper control bits (DIGOUTPUT) */
#define sfGRIPSTATEMASK 0x05 /* picks out state bits in DIGOUTPUT */
#define sfGRIPMOTORBIT 0x02 /* motor bit, 0 is off, 1 is on */
#define sfGRIPDIRBIT 0x01 /* direction bit, 0 is down, 1 is up */
#define sfSPEAKERBIT 0x04
#define sfRIGHTLEDBIT 0x08 /* 0 is off, 1 is on */
#define sfLEFTLEDBIT 0x10
/* gripper sense bits (DIGINPUT) */
#define sfGRIPTOPBIT 0x01 /* top limit, 0 if hit */
#define sfGRIPMIDBIT 0x02 /* mid-level, 0 if hit */
#define sfGRIPBOTBIT 0x04 /* bottom limit, 0 if hit */
#define sfGRIPINIRBIT 0x08 /* inner IR, 0 is beam break */
#define sfGRIPOUTIRBIT 0x10 /* outer IR */
#define sfGRIPBUMPBIT 0x20 /* gripper bumpers, 0 is bump */
#define sfGRIPMOMBIT 0x40 /* momentary switch, 0 is pressed */
#define sfGRIPSPSTBIT 0x80 /* SPST switch, 0 is up */
int /* returns the robot gripper state setpoint */
sfGripperGetState(void)
{
if (flakey.digoutput & sfGRIPMOTORBIT)
return sfMOVING;
else
return flakey.digoutput & sfGRIPSTATEMASK;
}
void /* sets robot gripper state setpoint */
sfGripperSetState(int state)
{
sfRobotComInt(sfCOMGRIPPER, state & sfGRIPSTATEMASK);
}
void /* sfLEFT, sfRIGHT, sfON, sfOFF */
sfGripperSetLed(int which, int state)
{
switch(which)
{
case sfLEFT:
which = sfLEFTLEDBIT;
break;
(continued)