blob: 3ecb65338ce9cf7f3386ebc1401fd38f81053271 [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 Silverman699f0cb2015-02-05 19:45:01 -050036message RobotState {
37 // The PID of the process reading sensors.
38 // This is here so control loops can tell when it changes.
39 int32_t reader_pid;
40
41 // True when outputs are enabled.
42 // Motor controllers keep going for a bit after this goes to false.
43 bool outputs_enabled;
44 // Indicates whether something is browned out (I think motor controller
45 // outputs). IMPORTANT: This is NOT !outputs_enabled. outputs_enabled goes to
46 // false for other reasons too (disabled, e-stopped, maybe more).
47 bool browned_out;
48
49 // Whether the two sensor rails are currently working.
50 bool is_3v3_active;
51 bool is_5v_active;
52 // The current voltages measured on the two sensor rails.
53 double voltage_3v3;
54 double voltage_5v;
55
56 // The input voltage to the roboRIO.
57 double voltage_roborio_in;
58
59 // From the DriverStation object, aka what FMS sees and what shows up on the
60 // actual driver's station.
61 double voltage_battery;
62};
63
64// Messages are sent out on this queue along with reading sensors. It contains
65// global robot state and information about whether the process reading sensors
66// has been restarted, along with all counters etc it keeps track of.
brians343bc112013-02-10 01:53:46 +000067queue RobotState robot_state;