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 | |
Niko Sohmers | 58e64c8 | 2024-01-14 12:49:54 -0800 | [diff] [blame] | 6 | // Contains if intake is intaking |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 7 | enum IntakeRollerStatus : ubyte { |
Niko Sohmers | 58e64c8 | 2024-01-14 12:49:54 -0800 | [diff] [blame] | 8 | NONE = 0, |
| 9 | SPITTING = 1, |
| 10 | INTAKING = 2, |
| 11 | } |
| 12 | |
Niko Sohmers | c4d2c50 | 2024-02-19 19:35:35 -0800 | [diff] [blame^] | 13 | enum CatapultState: ubyte { |
Maxwell Henderson | ed97029 | 2024-02-02 20:08:08 -0800 | [diff] [blame] | 14 | // Means we are waiting for a game piece |
Niko Sohmers | c4d2c50 | 2024-02-19 19:35:35 -0800 | [diff] [blame^] | 15 | READY = 0, |
Maxwell Henderson | ed97029 | 2024-02-02 20:08:08 -0800 | [diff] [blame] | 16 | // Means we have a game piece |
| 17 | LOADED = 1, |
| 18 | // Means we are firing a game piece |
| 19 | FIRING = 2, |
Niko Sohmers | c4d2c50 | 2024-02-19 19:35:35 -0800 | [diff] [blame^] | 20 | // We are retracting the bucket to do it again. |
| 21 | RETRACTING = 3, |
| 22 | } |
| 23 | |
| 24 | table AimerStatus { |
| 25 | // The current goal angle for the turret auto-tracking, in radians. |
| 26 | turret_position:double (id: 0); |
| 27 | // The current goal velocity for the turret, in radians / sec. |
| 28 | turret_velocity:double (id: 1); |
| 29 | // The current distance to the target, in meters. |
| 30 | target_distance:double (id: 2); |
| 31 | // The current "shot distance." When shooting on the fly, this may be |
| 32 | // different from the static distance to the target. |
| 33 | shot_distance:double (id: 3); |
Maxwell Henderson | ed97029 | 2024-02-02 20:08:08 -0800 | [diff] [blame] | 34 | } |
| 35 | |
Maxwell Henderson | bf04fb6 | 2024-01-19 17:56:07 -0800 | [diff] [blame] | 36 | table ShooterStatus { |
| 37 | // Estimated angle and angular velocitiy of the turret. |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 38 | turret:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 0); |
Maxwell Henderson | bf04fb6 | 2024-01-19 17:56:07 -0800 | [diff] [blame] | 39 | |
| 40 | // Estimated angle and angular velocitiy of the catapult. |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 41 | catapult:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 1); |
Maxwell Henderson | bf04fb6 | 2024-01-19 17:56:07 -0800 | [diff] [blame] | 42 | |
| 43 | // Estimated angle and angular velocitiy of the altitude. |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 44 | altitude:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 2); |
Maxwell Henderson | ed97029 | 2024-02-02 20:08:08 -0800 | [diff] [blame] | 45 | |
Niko Sohmers | c4d2c50 | 2024-02-19 19:35:35 -0800 | [diff] [blame^] | 46 | catapult_state: CatapultState (id: 3); |
| 47 | |
| 48 | // Status of the aimer |
| 49 | aimer:AimerStatus (id: 4); |
Maxwell Henderson | bf04fb6 | 2024-01-19 17:56:07 -0800 | [diff] [blame] | 50 | } |
| 51 | |
Niko Sohmers | 78f7135 | 2024-02-02 16:47:40 -0800 | [diff] [blame] | 52 | // Contains status of transfer rollers |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 53 | enum TransferRollerStatus : ubyte { |
Niko Sohmers | 78f7135 | 2024-02-02 16:47:40 -0800 | [diff] [blame] | 54 | NONE = 0, |
| 55 | TRANSFERING_IN = 1, |
| 56 | TRANSFERING_OUT = 2, |
| 57 | } |
| 58 | |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 59 | // Contains status of extend rollers |
| 60 | // HAS_GAME_PIECE means we have a game piece |
| 61 | // EMPTY means we don't have a game piece |
| 62 | enum ExtendRollerStatus: ubyte { |
| 63 | HAS_GAME_PIECE = 0, |
| 64 | EMPTY = 1 |
| 65 | } |
| 66 | |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 67 | table Status { |
| 68 | // All subsystems know their location. |
| 69 | zeroed:bool (id: 0); |
| 70 | |
| 71 | // If true, we have aborted. This is the or of all subsystem estops. |
| 72 | estopped:bool (id: 1); |
Niko Sohmers | 58e64c8 | 2024-01-14 12:49:54 -0800 | [diff] [blame] | 73 | |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 74 | // Status of the rollers |
| 75 | intake_roller:IntakeRollerStatus (id: 2); |
Niko Sohmers | 58e64c8 | 2024-01-14 12:49:54 -0800 | [diff] [blame] | 76 | |
| 77 | // Estimated angle and angular velocitiy of the intake. |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 78 | intake_pivot:frc971.control_loops.AbsoluteEncoderProfiledJointStatus (id: 3); |
Niko Sohmers | 78f7135 | 2024-02-02 16:47:40 -0800 | [diff] [blame] | 79 | |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 80 | // Status of transfer rollers |
| 81 | transfer_roller:TransferRollerStatus (id: 4); |
Filip Kujawa | 5750715 | 2024-01-31 20:09:25 -0800 | [diff] [blame] | 82 | |
| 83 | // Estimated angle and angular velocitiy of the climber. |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 84 | climber:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 5); |
Niko Sohmers | 1101711 | 2024-02-18 16:03:58 -0800 | [diff] [blame] | 85 | |
| 86 | // Status of the subsytems involved in the shooter |
Filip Kujawa | 102a9b2 | 2024-02-18 09:40:23 -0800 | [diff] [blame] | 87 | shooter:ShooterStatus (id: 6); |
| 88 | |
| 89 | // Estimated angle and angular velocitiy of the extend. |
| 90 | extend:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 7); |
| 91 | |
| 92 | // State of the extender rollers |
| 93 | extend_roller:ExtendRollerStatus (id: 8); |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 94 | } |
| 95 | |
| 96 | root_type Status; |