// // definitions.h // // General type defitions should be stored in here to facilitate access to multiple files. // // Motor commands //typedef enum {NONE, STOP, FWD_HI, FWD_MED, FWD_LO, ARC_L_LO, ARC_R_LO, ARC_L_MED, ARC_R_MED, ARC_L_HI, ARC_R_HI, REV_LO, REV_MED, TURN_L, TURN_R} motor_cmd; typedef struct { unsigned char enable; // Is Behaviour Enabled? unsigned char active; // Is Behaviour Firing? unsigned char priority; // Currently assigned behavioural priority int output_l; // desired command for Left motor int output_r; // desired command for Right motor unsigned char precision; // Enhanced precision mode for angles. (permits the passing of non-normalized values.) unsigned char type; } BehaviourInfo; // Declare Rotate new message type with data typedef struct { MessageControlBlock mcb; int angle; // INPUT: Requested angle of rotation unsigned char type; // INPUT: Absolute or Relative rotation? unsigned char scan; // INPUT: Keep an eye for the candle as we rotate? unsigned char status; // OUTPUT: Did we find the candle? } RotateMessage; // Declare Forward message type with data typedef struct { MessageControlBlock mcb; int lenght; // INPUT: Direction/distance to travel? (0 for continuous) unsigned char ignore_door; // INPUT: Should we report door or just ignore it? unsigned char status; // OUTPUT: Why did we return? (i.e. Obstacle in front, moved enough, door frame?) } ForwardMessage; // Declare Follow message type with data typedef struct { MessageControlBlock mcb; unsigned char side; // INPUT: Which side to follow on? unsigned char ignore_door; // INPUT: Should we report door or just ignore it? unsigned char status; // OUTPUT: Why did we return? (i.e. Obstacle in front, end of wall, door frame?) } FollowMessage; // Declare Align message type with data typedef struct { MessageControlBlock mcb; unsigned char type; // INPUT: Which side to align to? unsigned char status; // OUTPUT: What was the result (TRUE if aligned, FALSE if failed) } AlignMessage; // Declare GoAt message type with data typedef struct { MessageControlBlock mcb; int x; // INPUT int y; // INPUT unsigned int theta; // INPUT: Desired Coordinates } GoAtMessage; // Declare Extinguish message type with data typedef struct { MessageControlBlock mcb; unsigned char extinguished; // OUTPUT: Candle out? } ExtinguishMessage; // Declare Search message type with data typedef struct { MessageControlBlock mcb; unsigned char status; // OUTPUT: Was the candle found? unsigned char side; // INPUT: Which side to scan on? (for Room #4 case) } SearchMessage; // Declare Arbitrator message type with data typedef struct { MessageControlBlock mcb; unsigned char id; BehaviourInfo info; } ArbitrateMessage; // Declare the run-time configuration structure typedef struct { unsigned char dummy; // Just in case of EEPROM corruption unsigned char f_p; unsigned char f_d; unsigned char Kp; unsigned char Ki; unsigned char Kd; unsigned char line_threshold; unsigned char scm_exposure_h; unsigned char scm_exposure_l; unsigned char scm_threshold; unsigned char scm_min_size; } ConfigData;