blob: ab269bdf4524b9a1efd5c0608294c93400bf50dc [file] [log] [blame]
brians343bc112013-02-10 01:53:46 +00001package aos;
2
Austin Schuh374fd172014-10-25 17:57:54 -07003struct Joystick {
4 // A bitmask of the button state.
5 uint16_t buttons;
6
7 // The 4 joystick axes.
8 double[4] axis;
Austin Schuhfee2e602015-03-08 18:26:05 -07009
10 // The POV axis.
11 int32_t pov;
Austin Schuh374fd172014-10-25 17:57:54 -070012};
13
Brian Silverman699f0cb2015-02-05 19:45:01 -050014message JoystickState {
Austin Schuh374fd172014-10-25 17:57:54 -070015 Joystick[4] joysticks;
16
17 bool test_mode;
18 bool fms_attached;
19 bool enabled;
20 bool autonomous;
21 uint16_t team_id;
Brian Silverman699f0cb2015-02-05 19:45:01 -050022
Austin Schuh374fd172014-10-25 17:57:54 -070023 // If this is true, then this message isn't actually from the control
24 // system and so should not be trusted as evidence that the button inputs
25 // etc are actually real and should be acted on.
26 // However, most things should ignore this so that sending fake messages is
Brian Silverman699f0cb2015-02-05 19:45:01 -050027 // useful for testing. The only difference in behavior should be motors not
28 // actually turning on.
Austin Schuh374fd172014-10-25 17:57:54 -070029 bool fake;
brians343bc112013-02-10 01:53:46 +000030};
31
Brian Silverman699f0cb2015-02-05 19:45:01 -050032// This queue is checked by all control loops to make sure that the
brians343bc112013-02-10 01:53:46 +000033// joystick code hasn't died.
Brian Silverman699f0cb2015-02-05 19:45:01 -050034queue JoystickState joystick_state;
brians343bc112013-02-10 01:53:46 +000035
Brian Silverman425492b2015-12-30 15:23:55 -080036// Values retrieved from the PDP.
37struct PDPValues {
38 double voltage;
39 double temperature;
40 double power;
41 double[16] currents;
42};
43
Brian Silverman699f0cb2015-02-05 19:45:01 -050044message RobotState {
45 // The PID of the process reading sensors.
46 // This is here so control loops can tell when it changes.
47 int32_t reader_pid;
48
49 // True when outputs are enabled.
50 // Motor controllers keep going for a bit after this goes to false.
51 bool outputs_enabled;
52 // Indicates whether something is browned out (I think motor controller
53 // outputs). IMPORTANT: This is NOT !outputs_enabled. outputs_enabled goes to
54 // false for other reasons too (disabled, e-stopped, maybe more).
55 bool browned_out;
56
57 // Whether the two sensor rails are currently working.
58 bool is_3v3_active;
59 bool is_5v_active;
60 // The current voltages measured on the two sensor rails.
61 double voltage_3v3;
62 double voltage_5v;
63
64 // The input voltage to the roboRIO.
65 double voltage_roborio_in;
66
67 // From the DriverStation object, aka what FMS sees and what shows up on the
68 // actual driver's station.
69 double voltage_battery;
Brian Silvermanc7e8fdd2015-12-06 02:48:27 -050070
Brian Silverman425492b2015-12-30 15:23:55 -080071 PDPValues pdp;
Brian Silverman699f0cb2015-02-05 19:45:01 -050072};
73
74// Messages are sent out on this queue along with reading sensors. It contains
75// global robot state and information about whether the process reading sensors
76// has been restarted, along with all counters etc it keeps track of.
brians343bc112013-02-10 01:53:46 +000077queue RobotState robot_state;