blob: cd3e65bc3e6b5b6942503b6d21bc8af610b7e4a7 [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
Maxwell Hendersonbf04fb62024-01-19 17:56:07 -080057table ShooterStatus {
58 // Estimated angle and angular velocitiy of the turret.
Filip Kujawa102a9b22024-02-18 09:40:23 -080059 turret:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 0);
Maxwell Hendersonbf04fb62024-01-19 17:56:07 -080060
61 // Estimated angle and angular velocitiy of the catapult.
Filip Kujawa102a9b22024-02-18 09:40:23 -080062 catapult:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 1);
Maxwell Hendersonbf04fb62024-01-19 17:56:07 -080063
64 // Estimated angle and angular velocitiy of the altitude.
Filip Kujawa102a9b22024-02-18 09:40:23 -080065 altitude:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 2);
Maxwell Hendersoned970292024-02-02 20:08:08 -080066
Niko Sohmersc4d2c502024-02-19 19:35:35 -080067 catapult_state: CatapultState (id: 3);
68
69 // Status of the aimer
70 aimer:AimerStatus (id: 4);
Maxwell Hendersonbf04fb62024-01-19 17:56:07 -080071}
72
Niko Sohmers78f71352024-02-02 16:47:40 -080073// Contains status of transfer rollers
Filip Kujawa102a9b22024-02-18 09:40:23 -080074enum TransferRollerStatus : ubyte {
Niko Sohmers78f71352024-02-02 16:47:40 -080075 NONE = 0,
76 TRANSFERING_IN = 1,
77 TRANSFERING_OUT = 2,
James Kuszmaul6cae7d72024-03-01 21:29:56 -080078 EXTEND_MOVING = 3,
Niko Sohmers78f71352024-02-02 16:47:40 -080079}
80
Filip Kujawa102a9b22024-02-18 09:40:23 -080081// Contains status of extend rollers
Filip Kujawa102a9b22024-02-18 09:40:23 -080082enum ExtendRollerStatus: ubyte {
Filip Kujawa7a799602024-02-23 12:27:47 -080083 // Means the rollers are not moving.
84 IDLE = 0,
85 // Means we're transfer from the transfer rollers into the extend rollers.
86 TRANSFERING_TO_EXTEND = 1,
87 // Means we are transfering from the extend to the catapult.
88 TRANSFERING_TO_CATAPULT = 2,
89 // Means we're trying to score in the amp/trap
90 SCORING_IN_AMP = 3,
91 SCORING_IN_TRAP = 4,
92}
93
94// Contains the status of the extend subsystem
95enum ExtendStatus : ubyte {
96 // Means we are near 0 and ready to transfer a game piece.
97 RETRACTED = 0,
98 // Means we are moving to some goal.
99 MOVING = 1,
100 // Means we are currently at the catapult.
101 CATAPULT = 2,
102 // Means we are at the amp position.
103 AMP = 3,
104 // Means we are at the trap positon.
105 TRAP = 4,
Filip Kujawa102a9b22024-02-18 09:40:23 -0800106}
107
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800108table Status {
109 // All subsystems know their location.
110 zeroed:bool (id: 0);
111
112 // If true, we have aborted. This is the or of all subsystem estops.
113 estopped:bool (id: 1);
Niko Sohmers58e64c82024-01-14 12:49:54 -0800114
Filip Kujawa7a799602024-02-23 12:27:47 -0800115 state : SuperstructureState (id: 2);
116
Filip Kujawa102a9b22024-02-18 09:40:23 -0800117 // Status of the rollers
Filip Kujawa7a799602024-02-23 12:27:47 -0800118 intake_roller:IntakeRollerStatus (id: 3);
Niko Sohmers58e64c82024-01-14 12:49:54 -0800119
120 // Estimated angle and angular velocitiy of the intake.
Filip Kujawa7a799602024-02-23 12:27:47 -0800121 intake_pivot:frc971.control_loops.AbsoluteEncoderProfiledJointStatus (id: 4);
Niko Sohmers78f71352024-02-02 16:47:40 -0800122
Filip Kujawa102a9b22024-02-18 09:40:23 -0800123 // Status of transfer rollers
Filip Kujawa7a799602024-02-23 12:27:47 -0800124 transfer_roller:TransferRollerStatus (id: 5);
Filip Kujawa57507152024-01-31 20:09:25 -0800125
126 // Estimated angle and angular velocitiy of the climber.
Filip Kujawa7a799602024-02-23 12:27:47 -0800127 climber:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 6);
Niko Sohmers11017112024-02-18 16:03:58 -0800128
129 // Status of the subsytems involved in the shooter
Filip Kujawa7a799602024-02-23 12:27:47 -0800130 shooter:ShooterStatus (id: 7);
Filip Kujawa102a9b22024-02-18 09:40:23 -0800131
132 // Estimated angle and angular velocitiy of the extend.
Filip Kujawa7a799602024-02-23 12:27:47 -0800133 extend:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 8);
Filip Kujawa102a9b22024-02-18 09:40:23 -0800134
135 // State of the extender rollers
Filip Kujawa7a799602024-02-23 12:27:47 -0800136 extend_roller:ExtendRollerStatus (id: 9);
Niko Sohmersac4d8872024-02-23 13:55:47 -0800137
138 // The status of if the turret and intake is colliding
Filip Kujawa7a799602024-02-23 12:27:47 -0800139 collided: bool (id: 10);
140
141 extend_status:ExtendStatus (id: 11);
James Kuszmaul0281e152024-02-26 22:26:16 -0800142
143 // Indicates that the extend is in position to allow a game piece to
144 // be transfered into it.
145 extend_ready_for_transfer:bool (id: 12);
146
147 // Indicates that the turret is in position to avoid the extend.
148 turret_ready_for_extend_move:bool (id: 13);
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800149}
150
151root_type Status;