Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 1 | include "frc971/control_loops/control_loops.fbs"; |
| 2 | include "frc971/control_loops/profiled_subsystem.fbs"; |
| 3 | |
| 4 | namespace y2024.control_loops.superstructure; |
| 5 | |
Filip Kujawa | 7a79960 | 2024-02-23 12:27:47 -0800 | [diff] [blame] | 6 | enum SuperstructureState : ubyte { |
| 7 | // Before a note has been intaked, the extend should be retracted. |
| 8 | IDLE = 0, |
James Kuszmaul | 0281e15 | 2024-02-26 22:26:16 -0800 | [diff] [blame] | 9 | // Intaking a note and transferring it to the extned through the |
Filip Kujawa | 7a79960 | 2024-02-23 12:27:47 -0800 | [diff] [blame] | 10 | // 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 Kuszmaul | 0281e15 | 2024-02-26 22:26:16 -0800 | [diff] [blame] | 14 | // The note is in the extend and the extend is moving towards a goal, |
Filip Kujawa | 7a79960 | 2024-02-23 12:27:47 -0800 | [diff] [blame] | 15 | // 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 Sohmers | 58e64c8 | 2024-01-14 12:49:54 -0800 | [diff] [blame] | 27 | // Contains if intake is intaking |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 28 | enum IntakeRollerStatus : ubyte { |
Niko Sohmers | 58e64c8 | 2024-01-14 12:49:54 -0800 | [diff] [blame] | 29 | NONE = 0, |
| 30 | SPITTING = 1, |
| 31 | INTAKING = 2, |
| 32 | } |
| 33 | |
Niko Sohmers | c4d2c50 | 2024-02-19 19:35:35 -0800 | [diff] [blame] | 34 | enum CatapultState: ubyte { |
Maxwell Henderson | ed97029 | 2024-02-02 20:08:08 -0800 | [diff] [blame] | 35 | // Means we are waiting for a game piece |
Niko Sohmers | c4d2c50 | 2024-02-19 19:35:35 -0800 | [diff] [blame] | 36 | READY = 0, |
Maxwell Henderson | ed97029 | 2024-02-02 20:08:08 -0800 | [diff] [blame] | 37 | // Means we have a game piece |
| 38 | LOADED = 1, |
| 39 | // Means we are firing a game piece |
| 40 | FIRING = 2, |
Niko Sohmers | c4d2c50 | 2024-02-19 19:35:35 -0800 | [diff] [blame] | 41 | // We are retracting the bucket to do it again. |
| 42 | RETRACTING = 3, |
| 43 | } |
| 44 | |
| 45 | table 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 Henderson | ed97029 | 2024-02-02 20:08:08 -0800 | [diff] [blame] | 55 | } |
| 56 | |
Maxwell Henderson | bf04fb6 | 2024-01-19 17:56:07 -0800 | [diff] [blame] | 57 | table ShooterStatus { |
| 58 | // Estimated angle and angular velocitiy of the turret. |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 59 | turret:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 0); |
Maxwell Henderson | bf04fb6 | 2024-01-19 17:56:07 -0800 | [diff] [blame] | 60 | |
| 61 | // Estimated angle and angular velocitiy of the catapult. |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 62 | catapult:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 1); |
Maxwell Henderson | bf04fb6 | 2024-01-19 17:56:07 -0800 | [diff] [blame] | 63 | |
| 64 | // Estimated angle and angular velocitiy of the altitude. |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 65 | altitude:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 2); |
Maxwell Henderson | ed97029 | 2024-02-02 20:08:08 -0800 | [diff] [blame] | 66 | |
Niko Sohmers | c4d2c50 | 2024-02-19 19:35:35 -0800 | [diff] [blame] | 67 | catapult_state: CatapultState (id: 3); |
| 68 | |
| 69 | // Status of the aimer |
| 70 | aimer:AimerStatus (id: 4); |
Maxwell Henderson | bf04fb6 | 2024-01-19 17:56:07 -0800 | [diff] [blame] | 71 | } |
| 72 | |
Niko Sohmers | 78f7135 | 2024-02-02 16:47:40 -0800 | [diff] [blame] | 73 | // Contains status of transfer rollers |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 74 | enum TransferRollerStatus : ubyte { |
Niko Sohmers | 78f7135 | 2024-02-02 16:47:40 -0800 | [diff] [blame] | 75 | NONE = 0, |
| 76 | TRANSFERING_IN = 1, |
| 77 | TRANSFERING_OUT = 2, |
James Kuszmaul | 6cae7d7 | 2024-03-01 21:29:56 -0800 | [diff] [blame^] | 78 | EXTEND_MOVING = 3, |
Niko Sohmers | 78f7135 | 2024-02-02 16:47:40 -0800 | [diff] [blame] | 79 | } |
| 80 | |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 81 | // Contains status of extend rollers |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 82 | enum ExtendRollerStatus: ubyte { |
Filip Kujawa | 7a79960 | 2024-02-23 12:27:47 -0800 | [diff] [blame] | 83 | // 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 |
| 95 | enum 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 Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 106 | } |
| 107 | |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 108 | table 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 Sohmers | 58e64c8 | 2024-01-14 12:49:54 -0800 | [diff] [blame] | 114 | |
Filip Kujawa | 7a79960 | 2024-02-23 12:27:47 -0800 | [diff] [blame] | 115 | state : SuperstructureState (id: 2); |
| 116 | |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 117 | // Status of the rollers |
Filip Kujawa | 7a79960 | 2024-02-23 12:27:47 -0800 | [diff] [blame] | 118 | intake_roller:IntakeRollerStatus (id: 3); |
Niko Sohmers | 58e64c8 | 2024-01-14 12:49:54 -0800 | [diff] [blame] | 119 | |
| 120 | // Estimated angle and angular velocitiy of the intake. |
Filip Kujawa | 7a79960 | 2024-02-23 12:27:47 -0800 | [diff] [blame] | 121 | intake_pivot:frc971.control_loops.AbsoluteEncoderProfiledJointStatus (id: 4); |
Niko Sohmers | 78f7135 | 2024-02-02 16:47:40 -0800 | [diff] [blame] | 122 | |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 123 | // Status of transfer rollers |
Filip Kujawa | 7a79960 | 2024-02-23 12:27:47 -0800 | [diff] [blame] | 124 | transfer_roller:TransferRollerStatus (id: 5); |
Filip Kujawa | 5750715 | 2024-01-31 20:09:25 -0800 | [diff] [blame] | 125 | |
| 126 | // Estimated angle and angular velocitiy of the climber. |
Filip Kujawa | 7a79960 | 2024-02-23 12:27:47 -0800 | [diff] [blame] | 127 | climber:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 6); |
Niko Sohmers | 1101711 | 2024-02-18 16:03:58 -0800 | [diff] [blame] | 128 | |
| 129 | // Status of the subsytems involved in the shooter |
Filip Kujawa | 7a79960 | 2024-02-23 12:27:47 -0800 | [diff] [blame] | 130 | shooter:ShooterStatus (id: 7); |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 131 | |
| 132 | // Estimated angle and angular velocitiy of the extend. |
Filip Kujawa | 7a79960 | 2024-02-23 12:27:47 -0800 | [diff] [blame] | 133 | extend:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 8); |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 134 | |
| 135 | // State of the extender rollers |
Filip Kujawa | 7a79960 | 2024-02-23 12:27:47 -0800 | [diff] [blame] | 136 | extend_roller:ExtendRollerStatus (id: 9); |
Niko Sohmers | ac4d887 | 2024-02-23 13:55:47 -0800 | [diff] [blame] | 137 | |
| 138 | // The status of if the turret and intake is colliding |
Filip Kujawa | 7a79960 | 2024-02-23 12:27:47 -0800 | [diff] [blame] | 139 | collided: bool (id: 10); |
| 140 | |
| 141 | extend_status:ExtendStatus (id: 11); |
James Kuszmaul | 0281e15 | 2024-02-26 22:26:16 -0800 | [diff] [blame] | 142 | |
| 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 Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 149 | } |
| 150 | |
| 151 | root_type Status; |