milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 1 | include "frc971/control_loops/control_loops.fbs"; |
| 2 | include "frc971/control_loops/profiled_subsystem.fbs"; |
| 3 | |
| 4 | namespace y2022.control_loops.superstructure; |
| 5 | |
Ravago Jones | 5da0635 | 2022-03-04 20:26:24 -0800 | [diff] [blame] | 6 | // Contains which intake has a ball |
| 7 | enum IntakeState : ubyte { |
| 8 | NO_BALL, |
| 9 | INTAKE_FRONT_BALL, |
| 10 | INTAKE_BACK_BALL, |
| 11 | } |
| 12 | |
| 13 | // State of the superstructure state machine |
| 14 | enum SuperstructureState : ubyte { |
| 15 | // Before a ball is intaked, when neither intake beambreak is triggered |
| 16 | IDLE, |
| 17 | // Transferring ball with transfer rollers. Moves turret to loading position. |
| 18 | TRANSFERRING, |
| 19 | // Loading the ball into the catapult |
| 20 | LOADING, |
| 21 | // The ball is loaded into the catapult |
| 22 | LOADED, |
| 23 | // Waiting for the turret to be at shooting goal and then telling the |
| 24 | // catapult to fire. |
| 25 | SHOOTING, |
| 26 | } |
| 27 | |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 28 | table Status { |
| 29 | // All subsystems know their location. |
| 30 | zeroed:bool (id: 0); |
| 31 | |
| 32 | // If true, we have aborted. This is the or of all subsystem estops. |
| 33 | estopped:bool (id: 1); |
Ravago Jones | 5da0635 | 2022-03-04 20:26:24 -0800 | [diff] [blame] | 34 | // The state of the superstructure |
| 35 | |
| 36 | state:SuperstructureState (id: 10); |
| 37 | // Intaking state |
| 38 | intake_state:IntakeState (id: 11); |
| 39 | // Whether the flippers are open for shooting |
| 40 | flippers_open:bool (id: 12); |
| 41 | // Whether the flippers failed to open and we are retrying |
| 42 | reseating_in_catapult:bool (id: 13); |
| 43 | // Whether the catapult was told to fire, |
| 44 | // meaning that the turret and flippers are ready for firing |
| 45 | // and we were asked to fire. Different from fire flag in goal. |
| 46 | fire:bool (id: 14); |
Griffin Bui | 67abb91 | 2022-01-22 16:16:21 -0800 | [diff] [blame] | 47 | |
Siddhant Kanwar | 0e37f59 | 2022-02-21 19:26:50 -0800 | [diff] [blame] | 48 | // Subsystem statuses |
| 49 | climber:frc971.control_loops.RelativeEncoderProfiledJointStatus (id: 2); |
Henry Speiser | 55aa3ba | 2022-02-21 23:21:12 -0800 | [diff] [blame] | 50 | |
| 51 | // Estimated angles and angular velocities of the intakes. |
| 52 | intake_front:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 3); |
| 53 | intake_back:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 4); |
| 54 | |
| 55 | turret:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 5); |
Austin Schuh | 39f26f6 | 2022-02-24 21:34:46 -0800 | [diff] [blame] | 56 | |
| 57 | catapult:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 6); |
| 58 | |
| 59 | solve_time:double (id: 7); |
| 60 | mpc_active:bool (id: 8); |
Austin Schuh | 80fc275 | 2022-02-25 13:33:56 -0800 | [diff] [blame] | 61 | |
| 62 | // The number of shots we have taken. |
| 63 | shot_count:int32 (id: 9); |
milind-u | 086d726 | 2022-01-19 20:44:18 -0800 | [diff] [blame] | 64 | } |
| 65 | |
Austin Schuh | 39f26f6 | 2022-02-24 21:34:46 -0800 | [diff] [blame] | 66 | root_type Status; |