GT RoboCup SSL
Soccer software, robot firmware
status.h
1 #pragma once
2 
3 #include <stdint.h>
4 
5 extern unsigned int robot_id;
6 
7 // If nonzero, we are on a 2008 base:
8 // - Motors run backwards (outside gears)
9 // - No encoders
10 // - No kicker voltage monitor (use KDONE instead)
11 // - No chipper
12 extern int base2008;
13 
14 // Failure flags
15 enum {
16  // FPGA did not configure: FPGA bad, SPI flash bad, or SPI flash contents
17  // bad
18  Fail_FPGA_Config = 0x00000001,
19 
20  // FPGA logic failed sanity check: faulty FPGA code
21  Fail_FPGA_Logic = 0x00000002,
22 
23  // FPGA logic probably works but reports incompatible version: SPI flash not
24  // in sync with ARM flash
25  Fail_FPGA_Version = 0x00000004,
26 
27  // Can't talk to radio at all: bad radio or SPI contention
28  Fail_Radio_Interface = 0x00000010,
29 
30  // Radio interrupt line is stuck low: probable solder bridge
31  Fail_Radio_Int_Low = 0x00000020,
32 
33  // Radio interrupt line is stuck high: probable solder bridge
34  Fail_Radio_Int_High = 0x00000040,
35 
36  // Battery too low for driving
37  Fail_Undervoltage = 0x00000100,
38 
39  // Supply voltage too high (battery resistance or braking current too high?)
40  Fail_Overvoltage = 0x00000200,
41 
42  // Motor fuse is blown
43  Fail_Fuse = 0x00000400,
44 
45  // Ball sensor detector is open
46  Fail_Ball_Det_Open = 0x00001000,
47 
48  // Ball sensor detector is shorted
49  Fail_Ball_Det_Short = 0x00002000,
50 
51  // Ball sensor emitter is open
52  Fail_Ball_LED_Open = 0x00004000,
53 
54  // Ball sensor dazzled
55  Fail_Ball_Dazzled = 0x00008000,
56 
57  // Gyro/IMU processor
58  Fail_Gyro = 0x00010000,
59 
60  // Accelerometer
61  Fail_Accelerometer = 0x00020000,
62 
63  // Kicker voltage monitor not responding
64  Fail_Kicker_I2C = 0x00100000,
65 
66  // Kicker failed to charge (probably shorted IGBTs)
67  Fail_Kicker_Charge = 0x00200000,
68 };
69 
70 // Failure categories
71 #define Fail_FPGA (Fail_FPGA_Config | Fail_FPGA_Logic | Fail_FPGA_Version)
72 #define Fail_Radio \
73  (Fail_Radio_Interface | Fail_Radio_Int_Low | Fail_Radio_Int_High)
74 #define Fail_Power (Fail_Undervoltage | Fail_Overvoltage | Fail_Fuse)
75 #define Fail_Ball \
76  (Fail_Ball_Det_Open | Fail_Ball_Det_Short | Fail_Ball_LED_Open | \
77  Fail_Ball_Dazzled)
78 #define Fail_IMU (Fail_Gyro | Fail_Accelerometer)
79 #define Fail_Kicker (Fail_Kicker_I2C | Fail_Kicker_Charge)
80 
81 // Motor numbers
82 // Drive motors 0-3 are labelled M1-M4 on the board.
83 enum {
84  Motor_Back_Left = 0,
85  Motor_Front_Left = 1,
86  Motor_Front_Right = 2,
87  Motor_Back_Right = 3,
88  Motor_Dribbler = 4
89 };
90 
91 extern unsigned int failures;
92 
93 // Bits 0-4 correspond to motors 0-4 (see Motor_* above).
94 extern uint8_t current_motor_faults;
95 
96 // Latched motor faults. These are only cleared on reset or with the "fail"
97 // command.
98 extern uint8_t motor_faults;
99 
100 // kicker_status bits
101 enum {
102  Kicker_Charged = 0x01,
103  Kicker_Lockout = 0x02,
104  Kicker_Charging = 0x04,
105  Kicker_Enabled = 0x08,
106  Kicker_Override = 0x10,
107  Kicker_Chipping = 0x20,
108  Kicker_I2C_OK = 0x40
109 };