blob: bfa8f3f7233738f62b14e1f4dc17355dca9bb0f3 [file] [log] [blame]
milind-u086d7262022-01-19 20:44:18 -08001include "frc971/control_loops/control_loops.fbs";
2include "frc971/control_loops/profiled_subsystem.fbs";
3
4namespace y2022.control_loops.superstructure;
5
Ravago Jones5da06352022-03-04 20:26:24 -08006// Contains which intake has a ball
7enum IntakeState : ubyte {
8 NO_BALL,
9 INTAKE_FRONT_BALL,
10 INTAKE_BACK_BALL,
11}
12
13// State of the superstructure state machine
14enum SuperstructureState : ubyte {
15 // Before a ball is intaked, when neither intake beambreak is triggered
Milind Upadhyay803bbf02022-03-11 17:56:26 -080016 IDLE = 0,
Ravago Jones5da06352022-03-04 20:26:24 -080017 // Transferring ball with transfer rollers. Moves turret to loading position.
Milind Upadhyay803bbf02022-03-11 17:56:26 -080018 TRANSFERRING = 1,
Ravago Jones5da06352022-03-04 20:26:24 -080019 // Loading the ball into the catapult
Milind Upadhyay803bbf02022-03-11 17:56:26 -080020 LOADING = 2,
Ravago Jones5da06352022-03-04 20:26:24 -080021 // The ball is loaded into the catapult
Milind Upadhyay803bbf02022-03-11 17:56:26 -080022 LOADED = 3,
Ravago Jones5da06352022-03-04 20:26:24 -080023 // Waiting for the turret to be at shooting goal and then telling the
24 // catapult to fire.
Milind Upadhyay803bbf02022-03-11 17:56:26 -080025 SHOOTING = 4,
Ravago Jones5da06352022-03-04 20:26:24 -080026}
27
James Kuszmaul84083f42022-02-27 17:24:38 -080028table AimerStatus {
29 // The current goal angle for the turret auto-tracking, in radians.
30 turret_position:double (id: 0);
31 // The current goal velocity for the turret, in radians / sec.
32 turret_velocity:double (id: 1);
33 // The current distance to the target, in meters.
34 target_distance:double (id: 2);
35 // The current "shot distance." When shooting on the fly, this may be
36 // different from the static distance to the target.
37 shot_distance:double (id: 3);
38}
39
milind-u086d7262022-01-19 20:44:18 -080040table Status {
41 // All subsystems know their location.
42 zeroed:bool (id: 0);
43
44 // If true, we have aborted. This is the or of all subsystem estops.
45 estopped:bool (id: 1);
Ravago Jones5da06352022-03-04 20:26:24 -080046 // The state of the superstructure
47
48 state:SuperstructureState (id: 10);
49 // Intaking state
50 intake_state:IntakeState (id: 11);
James Kuszmaul40526952022-03-13 15:56:38 -070051 // Whether the front/rear intakes currently are holding balls.
52 front_intake_has_ball:bool (id: 18);
53 back_intake_has_ball:bool (id: 19);
Milind Upadhyay1612bbb2022-04-16 17:10:32 -070054 // Whether we just shot a ball and are transitioning a second one
55 transitioning_second_ball:bool (id: 24);
Ravago Jones5da06352022-03-04 20:26:24 -080056 // Whether the flippers are open for shooting
57 flippers_open:bool (id: 12);
58 // Whether the flippers failed to open and we are retrying
59 reseating_in_catapult:bool (id: 13);
Milind Upadhyay9d68b132022-04-01 10:58:18 -070060 // Whether the turret/catapult is collided with the intake
61 collided:bool(id: 23);
Henry Speiser77747b72022-03-06 17:18:29 -080062 // Whether the turret is ready for firing
63 ready_to_fire:bool (id: 20);
Henry Speisera9c49a22022-04-01 15:22:35 -070064 // Whether the robot is moving too fast to shoot
65 moving_too_fast:bool (id: 21);
Ravago Jonesd51af7a2022-03-26 21:44:20 -070066 // True if the robot has detected that it is holding
67 // the wrong color ball and is now discarding it.
68 discarding_ball:bool (id: 22);
Ravago Jones5da06352022-03-04 20:26:24 -080069 // Whether the catapult was told to fire,
70 // meaning that the turret and flippers are ready for firing
71 // and we were asked to fire. Different from fire flag in goal.
72 fire:bool (id: 14);
Griffin Bui67abb912022-01-22 16:16:21 -080073
Siddhant Kanwar0e37f592022-02-21 19:26:50 -080074 // Subsystem statuses
75 climber:frc971.control_loops.RelativeEncoderProfiledJointStatus (id: 2);
Henry Speiser55aa3ba2022-02-21 23:21:12 -080076
77 // Estimated angles and angular velocities of the intakes.
78 intake_front:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 3);
79 intake_back:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 4);
80
81 turret:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 5);
Austin Schuh39f26f62022-02-24 21:34:46 -080082
83 catapult:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 6);
84
85 solve_time:double (id: 7);
Austin Schuh41472552022-03-13 18:09:41 -070086 mpc_horizon:uint8 (id: 8);
Ravago Jones3283ce02022-03-09 19:31:29 -080087 shot_position:double (id: 16);
88 shot_velocity:double (id: 17);
Austin Schuh80fc2752022-02-25 13:33:56 -080089
90 // The number of shots we have taken.
91 shot_count:int32 (id: 9);
James Kuszmaul84083f42022-02-27 17:24:38 -080092
93 aimer:AimerStatus (id: 15);
milind-u086d7262022-01-19 20:44:18 -080094}
95
Austin Schuh39f26f62022-02-24 21:34:46 -080096root_type Status;