Gripper Operation and Programming
Table 3-2. Gripper functions
/*************************************************************
*Gripper functions
*States are sfGRIPUP, sfGRIPDOWN, sfGRIPMIDDLE, sfGRIPOFF,
*and sfGRIPMOVING
*sfGRIPMOVING occurs only during transitions between states
*sfGRIPOFF can be set by the user, which means no state control
*sfGRIPOFF is set by the robot to indicate a timeout (6
*seconds) if a state is not achieved
*
**************************************************************/
/* states */
#define sfGRIPOFF 0 #define sfGRIPUP 1 #define sfGRIPMOVING 2 #define sfGRIPMIDDLE 4 #define sfGRIPDOWN 5 #define sfCOMGRIPPER 33
/* 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 switch, 0 if hit */ |
#define sfGRIPMIDBIT | 0x02 | /* carry switch, 0 if hit */ | |
#define sfGRIPBOTBIT |
| 0x04 | /*open limit switch, 0 if hit */ |
#define sfGRIPINIRBIT | 0x08 | /* inner break beam, 1 is beam break */ | |
#define sfGRIPOUTIRBIT | 0x10 | /* outer break beam, 1 is beam break */ | |
#define sfGRIPBUMPBIT | 0x20 | /* gripper bumpers, 0 is bump */ | |
#define sfGRIPMOMBIT |
| 0x40 | /* momentary switch, 0 is pressed */ |
#define sfGRIPSPSTBIT |
| 0x80 | /* SPST switch, 0 is up */ |
14