blob: 0420c2637a428b2ea28ef15a6271868d0691ff2e [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);
Maxwell Hendersonbf04fb62024-01-19 17:56:07 -080080}
81
Niko Sohmers78f71352024-02-02 16:47:40 -080082// Contains status of transfer rollers
Filip Kujawa102a9b22024-02-18 09:40:23 -080083enum TransferRollerStatus : ubyte {
Niko Sohmers78f71352024-02-02 16:47:40 -080084 NONE = 0,
85 TRANSFERING_IN = 1,
86 TRANSFERING_OUT = 2,
James Kuszmaul6cae7d72024-03-01 21:29:56 -080087 EXTEND_MOVING = 3,
Niko Sohmers78f71352024-02-02 16:47:40 -080088}
89
Filip Kujawa102a9b22024-02-18 09:40:23 -080090// Contains status of extend rollers
Filip Kujawa102a9b22024-02-18 09:40:23 -080091enum ExtendRollerStatus: ubyte {
Filip Kujawa7a799602024-02-23 12:27:47 -080092 // Means the rollers are not moving.
93 IDLE = 0,
94 // Means we're transfer from the transfer rollers into the extend rollers.
95 TRANSFERING_TO_EXTEND = 1,
96 // Means we are transfering from the extend to the catapult.
97 TRANSFERING_TO_CATAPULT = 2,
98 // Means we're trying to score in the amp/trap
99 SCORING_IN_AMP = 3,
100 SCORING_IN_TRAP = 4,
101}
102
103// Contains the status of the extend subsystem
104enum ExtendStatus : ubyte {
105 // Means we are near 0 and ready to transfer a game piece.
106 RETRACTED = 0,
107 // Means we are moving to some goal.
108 MOVING = 1,
109 // Means we are currently at the catapult.
110 CATAPULT = 2,
111 // Means we are at the amp position.
112 AMP = 3,
113 // Means we are at the trap positon.
114 TRAP = 4,
Filip Kujawa102a9b22024-02-18 09:40:23 -0800115}
116
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800117table Status {
118 // All subsystems know their location.
119 zeroed:bool (id: 0);
120
121 // If true, we have aborted. This is the or of all subsystem estops.
122 estopped:bool (id: 1);
Niko Sohmers58e64c82024-01-14 12:49:54 -0800123
Filip Kujawa7a799602024-02-23 12:27:47 -0800124 state : SuperstructureState (id: 2);
125
Filip Kujawa102a9b22024-02-18 09:40:23 -0800126 // Status of the rollers
Filip Kujawa7a799602024-02-23 12:27:47 -0800127 intake_roller:IntakeRollerStatus (id: 3);
Niko Sohmers58e64c82024-01-14 12:49:54 -0800128
129 // Estimated angle and angular velocitiy of the intake.
Filip Kujawa7a799602024-02-23 12:27:47 -0800130 intake_pivot:frc971.control_loops.AbsoluteEncoderProfiledJointStatus (id: 4);
Niko Sohmers78f71352024-02-02 16:47:40 -0800131
Filip Kujawa102a9b22024-02-18 09:40:23 -0800132 // Status of transfer rollers
Filip Kujawa7a799602024-02-23 12:27:47 -0800133 transfer_roller:TransferRollerStatus (id: 5);
Filip Kujawa57507152024-01-31 20:09:25 -0800134
135 // Estimated angle and angular velocitiy of the climber.
Filip Kujawa7a799602024-02-23 12:27:47 -0800136 climber:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 6);
Niko Sohmers11017112024-02-18 16:03:58 -0800137
138 // Status of the subsytems involved in the shooter
Filip Kujawa7a799602024-02-23 12:27:47 -0800139 shooter:ShooterStatus (id: 7);
Filip Kujawa102a9b22024-02-18 09:40:23 -0800140
141 // Estimated angle and angular velocitiy of the extend.
Filip Kujawa7a799602024-02-23 12:27:47 -0800142 extend:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 8);
Filip Kujawa102a9b22024-02-18 09:40:23 -0800143
144 // State of the extender rollers
Filip Kujawa7a799602024-02-23 12:27:47 -0800145 extend_roller:ExtendRollerStatus (id: 9);
Niko Sohmersac4d8872024-02-23 13:55:47 -0800146
147 // The status of if the turret and intake is colliding
Filip Kujawa7a799602024-02-23 12:27:47 -0800148 collided: bool (id: 10);
149
150 extend_status:ExtendStatus (id: 11);
James Kuszmaul0281e152024-02-26 22:26:16 -0800151
152 // Indicates that the extend is in position to allow a game piece to
153 // be transfered into it.
154 extend_ready_for_transfer:bool (id: 12);
155
156 // Indicates that the turret is in position to avoid the extend.
Niko Sohmers5006fc42024-03-01 17:14:22 -0800157 turret_ready_for_extend_move:bool (id: 13, deprecated);
158
159 uncompleted_note_goal:NoteStatus = NONE (id: 14);
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800160}
161
162root_type Status;