blob: 49d269020173b508ee4370d0aecad00b47e0a74e [file] [log] [blame]
Alex Perrycb7da4b2019-08-28 19:35:56 -07001namespace aos;
2
Lee Mracekdb8bde02022-01-08 02:54:21 -05003enum MatchType : byte { kNone, kPractice, kQualification, kElimination }
4
Alex Perrycb7da4b2019-08-28 19:35:56 -07005table Joystick {
6 // A bitmask of the butotn state.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -08007 buttons:ushort (id: 0);
Alex Perrycb7da4b2019-08-28 19:35:56 -07008
9 // The 6 joystick axes.
10 // TODO: Should have size of 6
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080011 axis:[double] (id: 1);
Alex Perrycb7da4b2019-08-28 19:35:56 -070012
13 // The POV axis.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080014 pov:int (id: 2);
Alex Perrycb7da4b2019-08-28 19:35:56 -070015}
16
James Kuszmaula8806732020-02-14 19:45:35 -080017enum Alliance : byte { kRed, kBlue, kInvalid }
18
Alex Perrycb7da4b2019-08-28 19:35:56 -070019// This message is checked by all control loops to make sure that the
20// joystick code hasn't died. It is published on "/aos"
21table JoystickState {
22 //TODO: should have fixed size.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080023 joysticks:[Joystick] (id: 0);
Alex Perrycb7da4b2019-08-28 19:35:56 -070024
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080025 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 Perrycb7da4b2019-08-28 19:35:56 -070030
31 // 2018 scale and switch positions.
32 // TODO(austin): Push these out to a new message?
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080033 switch_left:bool (id: 6);
34 scale_left:bool (id: 7);
Alex Perrycb7da4b2019-08-28 19:35:56 -070035
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 Jonesfb6a7a52020-11-14 13:47:46 -080042 fake:bool (id: 8);
James Kuszmaula8806732020-02-14 19:45:35 -080043
44 // Color of our current alliance.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080045 alliance:Alliance (id: 9);
James Kuszmaula8806732020-02-14 19:45:35 -080046
47 // String corresponding to the game data string
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080048 game_data:string (id: 10);
Lee Mracekdb8bde02022-01-08 02:54:21 -050049
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 Perrycb7da4b2019-08-28 19:35:56 -070057}
58
59root_type JoystickState;