brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 1 | package aos; |
| 2 | |
Austin Schuh | 374fd17 | 2014-10-25 17:57:54 -0700 | [diff] [blame] | 3 | struct Joystick { |
| 4 | // A bitmask of the button state. |
| 5 | uint16_t buttons; |
| 6 | |
Austin Schuh | 4ee6042 | 2017-02-05 16:49:52 -0800 | [diff] [blame] | 7 | // The 6 joystick axes. |
| 8 | double[6] axis; |
Austin Schuh | fee2e60 | 2015-03-08 18:26:05 -0700 | [diff] [blame] | 9 | |
| 10 | // The POV axis. |
| 11 | int32_t pov; |
Austin Schuh | 374fd17 | 2014-10-25 17:57:54 -0700 | [diff] [blame] | 12 | }; |
| 13 | |
Brian Silverman | 699f0cb | 2015-02-05 19:45:01 -0500 | [diff] [blame] | 14 | message JoystickState { |
Austin Schuh | 374fd17 | 2014-10-25 17:57:54 -0700 | [diff] [blame] | 15 | Joystick[4] joysticks; |
| 16 | |
| 17 | bool test_mode; |
| 18 | bool fms_attached; |
| 19 | bool enabled; |
| 20 | bool autonomous; |
| 21 | uint16_t team_id; |
Brian Silverman | 699f0cb | 2015-02-05 19:45:01 -0500 | [diff] [blame] | 22 | |
Austin Schuh | c231df4 | 2018-03-21 20:43:24 -0700 | [diff] [blame^] | 23 | // 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 Schuh | 374fd17 | 2014-10-25 17:57:54 -0700 | [diff] [blame] | 28 | // 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 Silverman | 699f0cb | 2015-02-05 19:45:01 -0500 | [diff] [blame] | 32 | // useful for testing. The only difference in behavior should be motors not |
| 33 | // actually turning on. |
Austin Schuh | 374fd17 | 2014-10-25 17:57:54 -0700 | [diff] [blame] | 34 | bool fake; |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 35 | }; |
| 36 | |
Brian Silverman | 699f0cb | 2015-02-05 19:45:01 -0500 | [diff] [blame] | 37 | // This queue is checked by all control loops to make sure that the |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 38 | // joystick code hasn't died. |
Brian Silverman | 699f0cb | 2015-02-05 19:45:01 -0500 | [diff] [blame] | 39 | queue JoystickState joystick_state; |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 40 | |
Brian Silverman | 699f0cb | 2015-02-05 19:45:01 -0500 | [diff] [blame] | 41 | message 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. |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 72 | queue RobotState robot_state; |