blob: c73115fb90cc5090dc961e41a7cc43184c10c02f [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);
James Kuszmaul73d68882024-04-07 21:26:17 -070055 // Estimate of the retention roller current.
56 note_current:double (id: 4);
57 // Turret offset applied due to retention roller current.
58 current_turret_offset:double (id: 5);
Maxwell Hendersoned970292024-02-02 20:08:08 -080059}
60
Niko Sohmers5006fc42024-03-01 17:14:22 -080061// Enum representing where the superstructure
62// is currently trying to send the note.
63enum NoteStatus : ubyte {
64 NONE = 0,
65 CATAPULT = 1,
66 AMP = 2,
67 TRAP = 3,
68}
69
Maxwell Hendersonbf04fb62024-01-19 17:56:07 -080070table ShooterStatus {
71 // Estimated angle and angular velocitiy of the turret.
Filip Kujawa102a9b22024-02-18 09:40:23 -080072 turret:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 0);
Maxwell Hendersonbf04fb62024-01-19 17:56:07 -080073
74 // Estimated angle and angular velocitiy of the catapult.
Filip Kujawa102a9b22024-02-18 09:40:23 -080075 catapult:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 1);
Maxwell Hendersonbf04fb62024-01-19 17:56:07 -080076
77 // Estimated angle and angular velocitiy of the altitude.
Filip Kujawa102a9b22024-02-18 09:40:23 -080078 altitude:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 2);
Maxwell Hendersoned970292024-02-02 20:08:08 -080079
Niko Sohmersc4d2c502024-02-19 19:35:35 -080080 catapult_state: CatapultState (id: 3);
81
82 // Status of the aimer
83 aimer:AimerStatus (id: 4);
Niko Sohmerscc3aa452024-03-03 17:20:04 -080084
James Kuszmauldf3a3cb2024-03-15 22:03:37 -070085 // True if auto-aiming.
86 auto_aiming:bool (id: 5);
87
88 turret_in_range:bool (id: 6);
89 altitude_in_range:bool (id: 7);
90 altitude_above_min_angle:bool (id: 8);
Maxwell Hendersonbf04fb62024-01-19 17:56:07 -080091}
92
Niko Sohmers78f71352024-02-02 16:47:40 -080093// Contains status of transfer rollers
Filip Kujawa102a9b22024-02-18 09:40:23 -080094enum TransferRollerStatus : ubyte {
Niko Sohmers78f71352024-02-02 16:47:40 -080095 NONE = 0,
96 TRANSFERING_IN = 1,
97 TRANSFERING_OUT = 2,
James Kuszmaul6cae7d72024-03-01 21:29:56 -080098 EXTEND_MOVING = 3,
Niko Sohmers78f71352024-02-02 16:47:40 -080099}
100
Filip Kujawa102a9b22024-02-18 09:40:23 -0800101// Contains status of extend rollers
Filip Kujawa102a9b22024-02-18 09:40:23 -0800102enum ExtendRollerStatus: ubyte {
Filip Kujawa7a799602024-02-23 12:27:47 -0800103 // Means the rollers are not moving.
104 IDLE = 0,
105 // Means we're transfer from the transfer rollers into the extend rollers.
106 TRANSFERING_TO_EXTEND = 1,
107 // Means we are transfering from the extend to the catapult.
108 TRANSFERING_TO_CATAPULT = 2,
109 // Means we're trying to score in the amp/trap
110 SCORING_IN_AMP = 3,
111 SCORING_IN_TRAP = 4,
112}
113
114// Contains the status of the extend subsystem
115enum ExtendStatus : ubyte {
116 // Means we are near 0 and ready to transfer a game piece.
117 RETRACTED = 0,
118 // Means we are moving to some goal.
119 MOVING = 1,
120 // Means we are currently at the catapult.
121 CATAPULT = 2,
122 // Means we are at the amp position.
123 AMP = 3,
124 // Means we are at the trap positon.
125 TRAP = 4,
Filip Kujawa102a9b22024-02-18 09:40:23 -0800126}
127
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800128table Status {
129 // All subsystems know their location.
130 zeroed:bool (id: 0);
131
132 // If true, we have aborted. This is the or of all subsystem estops.
133 estopped:bool (id: 1);
Niko Sohmers58e64c82024-01-14 12:49:54 -0800134
Filip Kujawa7a799602024-02-23 12:27:47 -0800135 state : SuperstructureState (id: 2);
136
Filip Kujawa102a9b22024-02-18 09:40:23 -0800137 // Status of the rollers
Filip Kujawa7a799602024-02-23 12:27:47 -0800138 intake_roller:IntakeRollerStatus (id: 3);
Niko Sohmers58e64c82024-01-14 12:49:54 -0800139
140 // Estimated angle and angular velocitiy of the intake.
Filip Kujawa7a799602024-02-23 12:27:47 -0800141 intake_pivot:frc971.control_loops.AbsoluteEncoderProfiledJointStatus (id: 4);
Niko Sohmers78f71352024-02-02 16:47:40 -0800142
Filip Kujawa102a9b22024-02-18 09:40:23 -0800143 // Status of transfer rollers
Filip Kujawa7a799602024-02-23 12:27:47 -0800144 transfer_roller:TransferRollerStatus (id: 5);
Filip Kujawa57507152024-01-31 20:09:25 -0800145
146 // Estimated angle and angular velocitiy of the climber.
James Kuszmaul73d68882024-04-07 21:26:17 -0700147 // Deprecated now because climber no longer has an encoder
Niko Sohmers4d93d4c2024-03-24 14:48:26 -0700148 // and climber status is not used
149 climber:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 6, deprecated);
Niko Sohmers11017112024-02-18 16:03:58 -0800150
151 // Status of the subsytems involved in the shooter
Filip Kujawa7a799602024-02-23 12:27:47 -0800152 shooter:ShooterStatus (id: 7);
Filip Kujawa102a9b22024-02-18 09:40:23 -0800153
154 // Estimated angle and angular velocitiy of the extend.
Filip Kujawa7a799602024-02-23 12:27:47 -0800155 extend:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 8);
Filip Kujawa102a9b22024-02-18 09:40:23 -0800156
157 // State of the extender rollers
Filip Kujawa7a799602024-02-23 12:27:47 -0800158 extend_roller:ExtendRollerStatus (id: 9);
Niko Sohmersac4d8872024-02-23 13:55:47 -0800159
160 // The status of if the turret and intake is colliding
Filip Kujawa7a799602024-02-23 12:27:47 -0800161 collided: bool (id: 10);
162
163 extend_status:ExtendStatus (id: 11);
James Kuszmaul0281e152024-02-26 22:26:16 -0800164
165 // Indicates that the extend is in position to allow a game piece to
166 // be transfered into it.
167 extend_ready_for_transfer:bool (id: 12);
168
169 // Indicates that the turret is in position to avoid the extend.
Niko Sohmers5006fc42024-03-01 17:14:22 -0800170 turret_ready_for_extend_move:bool (id: 13, deprecated);
171
172 uncompleted_note_goal:NoteStatus = NONE (id: 14);
Niko Sohmers2a251cd2024-03-02 19:16:15 -0800173
174 // Indicates if the extend is close enough to the retracted position to be
175 // considered ready to accept note from the transfer rollers.
176 extend_at_retracted:bool (id: 15);
177
178 // Indicates if the turret is at the position to accept the note from extend
179 turret_ready_for_load:bool (id: 16);
180
181 // Indicates if the altitude is at the position to accept the note from
182 // extend
183 altitude_ready_for_load:bool (id: 17);
184
185 // Indicates if the extend is at the position to load the catapult
186 extend_ready_for_catapult_transfer:bool (id: 18);
187
188 extend_beambreak:bool (id: 19);
189 catapult_beambreak:bool (id: 20);
Niko Sohmers2ac60c52024-03-16 18:44:54 -0700190 transfer_beambreak:bool (id: 22);
James Kuszmauldf3a3cb2024-03-15 22:03:37 -0700191
192 // Number of shots we have taken.
193 shot_count:uint32 (id:21);
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800194}
195
196root_type Status;