blob: fd19e8d4838ba3015ddd05392c2f71c2ab6897f7 [file] [log] [blame]
Niko Sohmers3860f8a2024-01-12 21:05:19 -08001include "frc971/control_loops/control_loops.fbs";
2include "frc971/control_loops/profiled_subsystem.fbs";
3
4namespace y2024.control_loops.superstructure;
5
Filip Kujawa7a799602024-02-23 12:27:47 -08006enum SuperstructureState : ubyte {
7 // Before a note has been intaked, the extend should be retracted.
8 IDLE = 0,
James Kuszmaul0281e152024-02-26 22:26:16 -08009 // Intaking a note and transferring it to the extned through the
Filip Kujawa7a799602024-02-23 12:27:47 -080010 // intake, transfer, and extend rollers.
11 INTAKING = 1,
12 // The note is in the extend and the extend is not moving.
13 LOADED = 2,
James Kuszmaul0281e152024-02-26 22:26:16 -080014 // The note is in the extend and the extend is moving towards a goal,
Filip Kujawa7a799602024-02-23 12:27:47 -080015 // either the catapult, amp, or trap.
16 MOVING = 3,
17 // For Catapult Path, the note is being transferred between the extend and the catapult.
18 LOADING_CATAPULT = 4,
19 // The note is either:
20 // 1. Loaded in the catapult and ready to fire
21 // 2. In the extend and the extend is at the amp or trap scoring position.
22 READY = 5,
23 // Fire goal recieved and the note is being fired from the catapult or being scored in the amp or trap.
24 FIRING = 6,
25}
26
Niko Sohmers58e64c82024-01-14 12:49:54 -080027// Contains if intake is intaking
Filip Kujawa102a9b22024-02-18 09:40:23 -080028enum IntakeRollerStatus : ubyte {
Niko Sohmers58e64c82024-01-14 12:49:54 -080029 NONE = 0,
30 SPITTING = 1,
31 INTAKING = 2,
32}
33
Niko Sohmersc4d2c502024-02-19 19:35:35 -080034enum CatapultState: ubyte {
Maxwell Hendersoned970292024-02-02 20:08:08 -080035 // Means we are waiting for a game piece
Niko Sohmersc4d2c502024-02-19 19:35:35 -080036 READY = 0,
Maxwell Hendersoned970292024-02-02 20:08:08 -080037 // Means we have a game piece
38 LOADED = 1,
39 // Means we are firing a game piece
40 FIRING = 2,
Niko Sohmersc4d2c502024-02-19 19:35:35 -080041 // We are retracting the bucket to do it again.
42 RETRACTING = 3,
43}
44
45table AimerStatus {
46 // The current goal angle for the turret auto-tracking, in radians.
47 turret_position:double (id: 0);
48 // The current goal velocity for the turret, in radians / sec.
49 turret_velocity:double (id: 1);
50 // The current distance to the target, in meters.
51 target_distance:double (id: 2);
52 // The current "shot distance." When shooting on the fly, this may be
53 // different from the static distance to the target.
54 shot_distance:double (id: 3);
Maxwell Hendersoned970292024-02-02 20:08:08 -080055}
56
Niko Sohmers5006fc42024-03-01 17:14:22 -080057// Enum representing where the superstructure
58// is currently trying to send the note.
59enum NoteStatus : ubyte {
60 NONE = 0,
61 CATAPULT = 1,
62 AMP = 2,
63 TRAP = 3,
64}
65
Maxwell Hendersonbf04fb62024-01-19 17:56:07 -080066table ShooterStatus {
67 // Estimated angle and angular velocitiy of the turret.
Filip Kujawa102a9b22024-02-18 09:40:23 -080068 turret:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 0);
Maxwell Hendersonbf04fb62024-01-19 17:56:07 -080069
70 // Estimated angle and angular velocitiy of the catapult.
Filip Kujawa102a9b22024-02-18 09:40:23 -080071 catapult:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 1);
Maxwell Hendersonbf04fb62024-01-19 17:56:07 -080072
73 // Estimated angle and angular velocitiy of the altitude.
Filip Kujawa102a9b22024-02-18 09:40:23 -080074 altitude:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 2);
Maxwell Hendersoned970292024-02-02 20:08:08 -080075
Niko Sohmersc4d2c502024-02-19 19:35:35 -080076 catapult_state: CatapultState (id: 3);
77
78 // Status of the aimer
79 aimer:AimerStatus (id: 4);
Niko Sohmerscc3aa452024-03-03 17:20:04 -080080
James Kuszmauldf3a3cb2024-03-15 22:03:37 -070081 // True if auto-aiming.
82 auto_aiming:bool (id: 5);
83
84 turret_in_range:bool (id: 6);
85 altitude_in_range:bool (id: 7);
86 altitude_above_min_angle:bool (id: 8);
Maxwell Hendersonbf04fb62024-01-19 17:56:07 -080087}
88
Niko Sohmers78f71352024-02-02 16:47:40 -080089// Contains status of transfer rollers
Filip Kujawa102a9b22024-02-18 09:40:23 -080090enum TransferRollerStatus : ubyte {
Niko Sohmers78f71352024-02-02 16:47:40 -080091 NONE = 0,
92 TRANSFERING_IN = 1,
93 TRANSFERING_OUT = 2,
James Kuszmaul6cae7d72024-03-01 21:29:56 -080094 EXTEND_MOVING = 3,
Niko Sohmers78f71352024-02-02 16:47:40 -080095}
96
Filip Kujawa102a9b22024-02-18 09:40:23 -080097// Contains status of extend rollers
Filip Kujawa102a9b22024-02-18 09:40:23 -080098enum ExtendRollerStatus: ubyte {
Filip Kujawa7a799602024-02-23 12:27:47 -080099 // Means the rollers are not moving.
100 IDLE = 0,
101 // Means we're transfer from the transfer rollers into the extend rollers.
102 TRANSFERING_TO_EXTEND = 1,
103 // Means we are transfering from the extend to the catapult.
104 TRANSFERING_TO_CATAPULT = 2,
105 // Means we're trying to score in the amp/trap
106 SCORING_IN_AMP = 3,
107 SCORING_IN_TRAP = 4,
108}
109
110// Contains the status of the extend subsystem
111enum ExtendStatus : ubyte {
112 // Means we are near 0 and ready to transfer a game piece.
113 RETRACTED = 0,
114 // Means we are moving to some goal.
115 MOVING = 1,
116 // Means we are currently at the catapult.
117 CATAPULT = 2,
118 // Means we are at the amp position.
119 AMP = 3,
120 // Means we are at the trap positon.
121 TRAP = 4,
Filip Kujawa102a9b22024-02-18 09:40:23 -0800122}
123
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800124table Status {
125 // All subsystems know their location.
126 zeroed:bool (id: 0);
127
128 // If true, we have aborted. This is the or of all subsystem estops.
129 estopped:bool (id: 1);
Niko Sohmers58e64c82024-01-14 12:49:54 -0800130
Filip Kujawa7a799602024-02-23 12:27:47 -0800131 state : SuperstructureState (id: 2);
132
Filip Kujawa102a9b22024-02-18 09:40:23 -0800133 // Status of the rollers
Filip Kujawa7a799602024-02-23 12:27:47 -0800134 intake_roller:IntakeRollerStatus (id: 3);
Niko Sohmers58e64c82024-01-14 12:49:54 -0800135
136 // Estimated angle and angular velocitiy of the intake.
Filip Kujawa7a799602024-02-23 12:27:47 -0800137 intake_pivot:frc971.control_loops.AbsoluteEncoderProfiledJointStatus (id: 4);
Niko Sohmers78f71352024-02-02 16:47:40 -0800138
Filip Kujawa102a9b22024-02-18 09:40:23 -0800139 // Status of transfer rollers
Filip Kujawa7a799602024-02-23 12:27:47 -0800140 transfer_roller:TransferRollerStatus (id: 5);
Filip Kujawa57507152024-01-31 20:09:25 -0800141
142 // Estimated angle and angular velocitiy of the climber.
Filip Kujawa7a799602024-02-23 12:27:47 -0800143 climber:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 6);
Niko Sohmers11017112024-02-18 16:03:58 -0800144
145 // Status of the subsytems involved in the shooter
Filip Kujawa7a799602024-02-23 12:27:47 -0800146 shooter:ShooterStatus (id: 7);
Filip Kujawa102a9b22024-02-18 09:40:23 -0800147
148 // Estimated angle and angular velocitiy of the extend.
Filip Kujawa7a799602024-02-23 12:27:47 -0800149 extend:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 8);
Filip Kujawa102a9b22024-02-18 09:40:23 -0800150
151 // State of the extender rollers
Filip Kujawa7a799602024-02-23 12:27:47 -0800152 extend_roller:ExtendRollerStatus (id: 9);
Niko Sohmersac4d8872024-02-23 13:55:47 -0800153
154 // The status of if the turret and intake is colliding
Filip Kujawa7a799602024-02-23 12:27:47 -0800155 collided: bool (id: 10);
156
157 extend_status:ExtendStatus (id: 11);
James Kuszmaul0281e152024-02-26 22:26:16 -0800158
159 // Indicates that the extend is in position to allow a game piece to
160 // be transfered into it.
161 extend_ready_for_transfer:bool (id: 12);
162
163 // Indicates that the turret is in position to avoid the extend.
Niko Sohmers5006fc42024-03-01 17:14:22 -0800164 turret_ready_for_extend_move:bool (id: 13, deprecated);
165
166 uncompleted_note_goal:NoteStatus = NONE (id: 14);
Niko Sohmers2a251cd2024-03-02 19:16:15 -0800167
168 // Indicates if the extend is close enough to the retracted position to be
169 // considered ready to accept note from the transfer rollers.
170 extend_at_retracted:bool (id: 15);
171
172 // Indicates if the turret is at the position to accept the note from extend
173 turret_ready_for_load:bool (id: 16);
174
175 // Indicates if the altitude is at the position to accept the note from
176 // extend
177 altitude_ready_for_load:bool (id: 17);
178
179 // Indicates if the extend is at the position to load the catapult
180 extend_ready_for_catapult_transfer:bool (id: 18);
181
182 extend_beambreak:bool (id: 19);
183 catapult_beambreak:bool (id: 20);
James Kuszmauldf3a3cb2024-03-15 22:03:37 -0700184
185 // Number of shots we have taken.
186 shot_count:uint32 (id:21);
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800187}
188
189root_type Status;