blob: 7eb10f5470a54248824c378bcd19f9bd3d55f7f1 [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
Austin Schuh4ee60422017-02-05 16:49:52 -08007 // The 6 joystick axes.
8 double[6] 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 {
Tyler Chatowc92b4872019-02-23 21:42:11 -080015 Joystick[6] joysticks;
Austin Schuh374fd172014-10-25 17:57:54 -070016
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 Schuhc231df42018-03-21 20:43:24 -070023 // 2018 scale and switch positions.
24 // TODO(austin): Push these out to a new message?
25 bool switch_left;
26 bool scale_left;
27
Austin Schuh374fd172014-10-25 17:57:54 -070028 // If this is true, then this message isn't actually from the control
29 // system and so should not be trusted as evidence that the button inputs
30 // etc are actually real and should be acted on.
31 // However, most things should ignore this so that sending fake messages is
Brian Silverman699f0cb2015-02-05 19:45:01 -050032 // useful for testing. The only difference in behavior should be motors not
33 // actually turning on.
Austin Schuh374fd172014-10-25 17:57:54 -070034 bool fake;
brians343bc112013-02-10 01:53:46 +000035};
36
Brian Silverman699f0cb2015-02-05 19:45:01 -050037// This queue is checked by all control loops to make sure that the
brians343bc112013-02-10 01:53:46 +000038// joystick code hasn't died.
Brian Silverman699f0cb2015-02-05 19:45:01 -050039queue JoystickState joystick_state;
brians343bc112013-02-10 01:53:46 +000040
Brian Silverman699f0cb2015-02-05 19:45:01 -050041message RobotState {
42 // The PID of the process reading sensors.
43 // This is here so control loops can tell when it changes.
44 int32_t reader_pid;
45
46 // True when outputs are enabled.
47 // Motor controllers keep going for a bit after this goes to false.
48 bool outputs_enabled;
49 // Indicates whether something is browned out (I think motor controller
50 // outputs). IMPORTANT: This is NOT !outputs_enabled. outputs_enabled goes to
51 // false for other reasons too (disabled, e-stopped, maybe more).
52 bool browned_out;
53
54 // Whether the two sensor rails are currently working.
55 bool is_3v3_active;
56 bool is_5v_active;
57 // The current voltages measured on the two sensor rails.
58 double voltage_3v3;
59 double voltage_5v;
60
61 // The input voltage to the roboRIO.
62 double voltage_roborio_in;
63
64 // From the DriverStation object, aka what FMS sees and what shows up on the
65 // actual driver's station.
66 double voltage_battery;
67};
68
69// Messages are sent out on this queue along with reading sensors. It contains
70// global robot state and information about whether the process reading sensors
71// has been restarted, along with all counters etc it keeps track of.
brians343bc112013-02-10 01:53:46 +000072queue RobotState robot_state;