Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 1 | namespace aos; |
| 2 | |
Lee Mracek | db8bde0 | 2022-01-08 02:54:21 -0500 | [diff] [blame] | 3 | enum MatchType : byte { kNone, kPractice, kQualification, kElimination } |
| 4 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 5 | table Joystick { |
| 6 | // A bitmask of the butotn state. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame] | 7 | buttons:ushort (id: 0); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 8 | |
| 9 | // The 6 joystick axes. |
| 10 | // TODO: Should have size of 6 |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame] | 11 | axis:[double] (id: 1); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 12 | |
| 13 | // The POV axis. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame] | 14 | pov:int (id: 2); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 15 | } |
| 16 | |
James Kuszmaul | a880673 | 2020-02-14 19:45:35 -0800 | [diff] [blame] | 17 | enum Alliance : byte { kRed, kBlue, kInvalid } |
| 18 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 19 | // This message is checked by all control loops to make sure that the |
| 20 | // joystick code hasn't died. It is published on "/aos" |
| 21 | table JoystickState { |
| 22 | //TODO: should have fixed size. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame] | 23 | joysticks:[Joystick] (id: 0); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 24 | |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame] | 25 | test_mode:bool (id: 1); |
| 26 | fms_attached:bool (id: 2); |
| 27 | enabled:bool (id: 3); |
| 28 | autonomous:bool (id: 4); |
| 29 | team_id:ushort (id: 5); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 30 | |
| 31 | // 2018 scale and switch positions. |
| 32 | // TODO(austin): Push these out to a new message? |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame] | 33 | switch_left:bool (id: 6); |
| 34 | scale_left:bool (id: 7); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 35 | |
| 36 | // If this is true, then this message isn't actually from the control |
| 37 | // system and so should not be trusted as evidence that the button inputs |
| 38 | // etc are actually real and should be acted on. |
| 39 | // However, most things should ignore this so that sending fake messages is |
| 40 | // useful for testing. The only difference in behavior should be motors not |
| 41 | // actually turning on. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame] | 42 | fake:bool (id: 8); |
James Kuszmaul | a880673 | 2020-02-14 19:45:35 -0800 | [diff] [blame] | 43 | |
| 44 | // Color of our current alliance. |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame] | 45 | alliance:Alliance (id: 9); |
James Kuszmaul | a880673 | 2020-02-14 19:45:35 -0800 | [diff] [blame] | 46 | |
| 47 | // String corresponding to the game data string |
Ravago Jones | fb6a7a5 | 2020-11-14 13:47:46 -0800 | [diff] [blame] | 48 | game_data:string (id: 10); |
Lee Mracek | db8bde0 | 2022-01-08 02:54:21 -0500 | [diff] [blame] | 49 | |
| 50 | // Driver station location. |
| 51 | location:ubyte (id: 11); |
| 52 | |
| 53 | match_number:int (id: 12); |
| 54 | replay_number:int (id: 13); |
| 55 | match_type:MatchType (id: 14); |
| 56 | event_name:string (id: 15); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | root_type JoystickState; |