blob: 74fe5d04ed109ccbb735f4b49aa9d7243eee11c9 [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;
9};
10
Brian Silverman699f0cb2015-02-05 19:45:01 -050011message JoystickState {
Austin Schuh374fd172014-10-25 17:57:54 -070012 Joystick[4] joysticks;
13
14 bool test_mode;
15 bool fms_attached;
16 bool enabled;
17 bool autonomous;
18 uint16_t team_id;
Brian Silverman699f0cb2015-02-05 19:45:01 -050019
Austin Schuh374fd172014-10-25 17:57:54 -070020 // If this is true, then this message isn't actually from the control
21 // system and so should not be trusted as evidence that the button inputs
22 // etc are actually real and should be acted on.
23 // However, most things should ignore this so that sending fake messages is
Brian Silverman699f0cb2015-02-05 19:45:01 -050024 // useful for testing. The only difference in behavior should be motors not
25 // actually turning on.
Austin Schuh374fd172014-10-25 17:57:54 -070026 bool fake;
brians343bc112013-02-10 01:53:46 +000027};
28
Brian Silverman699f0cb2015-02-05 19:45:01 -050029// This queue is checked by all control loops to make sure that the
brians343bc112013-02-10 01:53:46 +000030// joystick code hasn't died.
Brian Silverman699f0cb2015-02-05 19:45:01 -050031queue JoystickState joystick_state;
brians343bc112013-02-10 01:53:46 +000032
Brian Silverman699f0cb2015-02-05 19:45:01 -050033message RobotState {
34 // The PID of the process reading sensors.
35 // This is here so control loops can tell when it changes.
36 int32_t reader_pid;
37
38 // True when outputs are enabled.
39 // Motor controllers keep going for a bit after this goes to false.
40 bool outputs_enabled;
41 // Indicates whether something is browned out (I think motor controller
42 // outputs). IMPORTANT: This is NOT !outputs_enabled. outputs_enabled goes to
43 // false for other reasons too (disabled, e-stopped, maybe more).
44 bool browned_out;
45
46 // Whether the two sensor rails are currently working.
47 bool is_3v3_active;
48 bool is_5v_active;
49 // The current voltages measured on the two sensor rails.
50 double voltage_3v3;
51 double voltage_5v;
52
53 // The input voltage to the roboRIO.
54 double voltage_roborio_in;
55
56 // From the DriverStation object, aka what FMS sees and what shows up on the
57 // actual driver's station.
58 double voltage_battery;
59};
60
61// Messages are sent out on this queue along with reading sensors. It contains
62// global robot state and information about whether the process reading sensors
63// has been restarted, along with all counters etc it keeps track of.
brians343bc112013-02-10 01:53:46 +000064queue RobotState robot_state;