blob: 8d74bfeaa90a1631ad19e84278afe7f35684097e [file] [log] [blame]
Maxwell Hendersonad312342023-01-10 12:07:47 -08001include "frc971/control_loops/control_loops.fbs";
Maxwell Hendersonbf1bcec2023-03-05 18:00:20 -08002include "y2023/vision/game_pieces.fbs";
Maxwell Hendersonad312342023-01-10 12:07:47 -08003include "frc971/control_loops/profiled_subsystem.fbs";
4
5namespace y2023.control_loops.superstructure;
6
milind-u37385182023-02-20 15:07:28 -08007enum ArmState : ubyte {
8 UNINITIALIZED = 0,
9 ZEROING = 1,
10 DISABLED = 2,
11 GOTO_PATH = 3,
12 RUNNING = 4,
13 ESTOP = 5,
14}
15
16table ArmStatus {
17 // State of the estimators.
18 proximal_estimator_state:frc971.PotAndAbsoluteEncoderEstimatorState (id: 0);
19 distal_estimator_state:frc971.PotAndAbsoluteEncoderEstimatorState (id: 1);
milind-u18a901d2023-02-17 21:51:55 -080020 roll_joint_estimator_state:frc971.PotAndAbsoluteEncoderEstimatorState (id: 18);
milind-u37385182023-02-20 15:07:28 -080021
22 // The node we are currently going to.
23 current_node:uint32 (id: 2);
24 // Distance (in radians) to the end of the path.
25 path_distance_to_go:float (id: 3);
26 // Goal position and velocity (radians)
27 goal_theta0:float (id: 4);
28 goal_theta1:float (id: 5);
milind-u18a901d2023-02-17 21:51:55 -080029 goal_theta2:float (id: 19);
milind-u37385182023-02-20 15:07:28 -080030 goal_omega0:float (id: 6);
31 goal_omega1:float (id: 7);
milind-u18a901d2023-02-17 21:51:55 -080032 goal_omega2:float (id: 20);
milind-u37385182023-02-20 15:07:28 -080033
34 // Current position and velocity (radians)
35 theta0:float (id: 8);
36 theta1:float (id: 9);
milind-u18a901d2023-02-17 21:51:55 -080037 theta2:float (id: 21);
milind-u37385182023-02-20 15:07:28 -080038
39 omega0:float (id: 10);
40 omega1:float (id: 11);
milind-u18a901d2023-02-17 21:51:55 -080041 omega2:float (id: 22);
milind-u37385182023-02-20 15:07:28 -080042
43 // Estimated voltage error for the two joints.
44 voltage_error0:float (id: 12);
45 voltage_error1:float (id: 13);
milind-u18a901d2023-02-17 21:51:55 -080046 voltage_error2:float (id: 23);
milind-u37385182023-02-20 15:07:28 -080047
milind-u3b91b752023-02-25 15:21:06 -080048 // Current arm position in meters for use with UI
49 arm_x:float (id: 24);
50 arm_y:float (id: 25);
51 // Circular index to handle theta wrapping
52 arm_circular_index:int (id: 26);
53
milind-u37385182023-02-20 15:07:28 -080054 // True if we are zeroed.
55 zeroed:bool (id: 14);
56
57 // True if the arm is zeroed.
58 estopped:bool (id: 15);
59
60 // The current state machine state.
61 state:ArmState (id: 16);
62
63 // The number of times the LQR solver failed.
64 failed_solutions:uint32 (id: 17);
65}
Maxwell Hendersonad312342023-01-10 12:07:47 -080066
Maxwell Henderson589cf272023-02-22 15:56:40 -080067// State of the superstructure state machine
68enum EndEffectorState : ubyte {
69 // Not doing anything
70 IDLE = 0,
71 // Intaking the game object into the end effector
72 INTAKING = 1,
73 // The game object is loaded into the end effector
74 LOADED = 2,
75 // Waiting for the arm to be at shooting goal and then telling the
76 // end effector to spit
77 SPITTING = 3,
78}
79
Maxwell Hendersonad312342023-01-10 12:07:47 -080080table Status {
81 // All subsystems know their location.
82 zeroed:bool (id: 0);
83
84 // If true, we have aborted. This is the or of all subsystem estops.
85 estopped:bool (id: 1);
Nikita Narang27610fc2023-02-08 19:40:31 -080086
milind-u37385182023-02-20 15:07:28 -080087 arm:ArmStatus (id: 2);
Nikita Narang27610fc2023-02-08 19:40:31 -080088
milind-u18a901d2023-02-17 21:51:55 -080089 wrist:frc971.control_loops.AbsoluteEncoderProfiledJointStatus (id: 3);
Maxwell Henderson589cf272023-02-22 15:56:40 -080090
91 end_effector_state:EndEffectorState (id: 4);
James Kuszmaulcf451fb2023-03-10 20:42:36 -080092
Maxwell Hendersonbf1bcec2023-03-05 18:00:20 -080093 game_piece:vision.Class (id: 5);
James Kuszmaulcf451fb2023-03-10 20:42:36 -080094
95 // Indicates the current lateral position of the game piece, in meters.
96 // This number will be zero when the game piece is centered, and positive if
97 // the arm + wrist are all at zero and the game piece is towards the back
98 // of the robot. This will typically mean that positive is to the robot's
99 // left
100 game_piece_position:double (id: 6);
Maxwell Hendersonad312342023-01-10 12:07:47 -0800101}
102
103root_type Status;