blob: d4f64f87e572392fc8824e166d2fa643c37787f0 [file] [log] [blame]
Alex Perrycb7da4b2019-08-28 19:35:56 -07001include "frc971/control_loops/control_loops.fbs";
James Kuszmauleeb98e92024-01-14 22:15:32 -08002include "frc971/control_loops/state_feedback_loop.fbs";
Alex Perrycb7da4b2019-08-28 19:35:56 -07003
4namespace frc971.control_loops;
5
6table ProfiledJointStatus {
7 // Is the subsystem zeroed?
Ravago Jonesfb6a7a52020-11-14 13:47:46 -08008 zeroed:bool (id: 0);
Alex Perrycb7da4b2019-08-28 19:35:56 -07009
10 // The state of the subsystem, if applicable. -1 otherwise.
11 // TODO(alex): replace with enum.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080012 state:int (id: 1);
Alex Perrycb7da4b2019-08-28 19:35:56 -070013
14 // If true, we have aborted.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080015 estopped:bool (id: 2);
Alex Perrycb7da4b2019-08-28 19:35:56 -070016
17 // Position of the joint.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080018 position:float (id: 3);
Alex Perrycb7da4b2019-08-28 19:35:56 -070019 // Velocity of the joint in units/second.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080020 velocity:float (id: 4);
Alex Perrycb7da4b2019-08-28 19:35:56 -070021 // Profiled goal position of the joint.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080022 goal_position:float (id: 5);
Alex Perrycb7da4b2019-08-28 19:35:56 -070023 // Profiled goal velocity of the joint in units/second.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080024 goal_velocity:float (id: 6);
Alex Perrycb7da4b2019-08-28 19:35:56 -070025 // Unprofiled goal position from absoulte zero of the joint.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080026 unprofiled_goal_position:float (id: 7);
Alex Perrycb7da4b2019-08-28 19:35:56 -070027 // Unprofiled goal velocity of the joint in units/second.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080028 unprofiled_goal_velocity:float (id: 8);
Alex Perrycb7da4b2019-08-28 19:35:56 -070029
30 // The estimated voltage error.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080031 voltage_error:float (id: 9);
Alex Perrycb7da4b2019-08-28 19:35:56 -070032
33 // The calculated velocity with delta x/delta t
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080034 calculated_velocity:float (id: 10);
Alex Perrycb7da4b2019-08-28 19:35:56 -070035
36 // Components of the control loop output
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080037 position_power:float (id: 11);
38 velocity_power:float (id: 12);
39 feedforwards_power:float (id: 13);
Alex Perrycb7da4b2019-08-28 19:35:56 -070040
41 // State of the estimator.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080042 estimator_state:frc971.EstimatorState (id: 14);
Alex Perrycb7da4b2019-08-28 19:35:56 -070043}
44
45table HallProfiledJointStatus {
46 // Is the subsystem zeroed?
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080047 zeroed:bool (id: 0);
Alex Perrycb7da4b2019-08-28 19:35:56 -070048
49 // The state of the subsystem, if applicable. -1 otherwise.
50 // TODO(alex): replace with enum.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080051 state:int (id: 1);
Alex Perrycb7da4b2019-08-28 19:35:56 -070052
53 // If true, we have aborted.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080054 estopped:bool (id: 2);
Alex Perrycb7da4b2019-08-28 19:35:56 -070055
56 // Position of the joint.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080057 position:float (id: 3);
Alex Perrycb7da4b2019-08-28 19:35:56 -070058 // Velocity of the joint in units/second.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080059 velocity:float (id: 4);
Alex Perrycb7da4b2019-08-28 19:35:56 -070060 // Profiled goal position of the joint.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080061 goal_position:float (id: 5);
Alex Perrycb7da4b2019-08-28 19:35:56 -070062 // Profiled goal velocity of the joint in units/second.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080063 goal_velocity:float (id: 6);
Alex Perrycb7da4b2019-08-28 19:35:56 -070064 // Unprofiled goal position from absoulte zero of the joint.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080065 unprofiled_goal_position:float (id: 7);
Alex Perrycb7da4b2019-08-28 19:35:56 -070066 // Unprofiled goal velocity of the joint in units/second.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080067 unprofiled_goal_velocity:float (id: 8);
Alex Perrycb7da4b2019-08-28 19:35:56 -070068
69 // The estimated voltage error.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080070 voltage_error:float (id: 9);
Alex Perrycb7da4b2019-08-28 19:35:56 -070071
72 // The calculated velocity with delta x/delta t
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080073 calculated_velocity:float (id: 10);
Alex Perrycb7da4b2019-08-28 19:35:56 -070074
75 // Components of the control loop output
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080076 position_power:float (id: 11);
77 velocity_power:float (id: 12);
78 feedforwards_power:float (id: 13);
Alex Perrycb7da4b2019-08-28 19:35:56 -070079
80 // State of the estimator.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080081 estimator_state:frc971.HallEffectAndPositionEstimatorState (id: 14);
Alex Perrycb7da4b2019-08-28 19:35:56 -070082}
83
84table PotAndAbsoluteEncoderProfiledJointStatus {
85 // Is the subsystem zeroed?
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080086 zeroed:bool (id: 0);
Alex Perrycb7da4b2019-08-28 19:35:56 -070087
88 // The state of the subsystem, if applicable. -1 otherwise.
89 // TODO(alex): replace with enum.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080090 state:int (id: 1);
Alex Perrycb7da4b2019-08-28 19:35:56 -070091
92 // If true, we have aborted.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080093 estopped:bool (id: 2);
Alex Perrycb7da4b2019-08-28 19:35:56 -070094
95 // Position of the joint.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080096 position:float (id: 3);
Alex Perrycb7da4b2019-08-28 19:35:56 -070097 // Velocity of the joint in units/second.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080098 velocity:float (id: 4);
Alex Perrycb7da4b2019-08-28 19:35:56 -070099 // Profiled goal position of the joint.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800100 goal_position:float (id: 5);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700101 // Profiled goal velocity of the joint in units/second.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800102 goal_velocity:float (id: 6);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700103 // Unprofiled goal position from absoulte zero of the joint.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800104 unprofiled_goal_position:float (id: 7);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700105 // Unprofiled goal velocity of the joint in units/second.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800106 unprofiled_goal_velocity:float (id: 8);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700107
108 // The estimated voltage error.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800109 voltage_error:float (id: 9);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700110
111 // The calculated velocity with delta x/delta t
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800112 calculated_velocity:float (id: 10);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700113
114 // Components of the control loop output
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800115 position_power:float (id: 11);
116 velocity_power:float (id: 12);
117 feedforwards_power:float (id: 13);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700118
119 // State of the estimator.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800120 estimator_state:frc971.PotAndAbsoluteEncoderEstimatorState (id: 14);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700121}
122
123table IndexProfiledJointStatus {
124 // Is the subsystem zeroed?
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800125 zeroed:bool (id: 0);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700126
127 // The state of the subsystem, if applicable. -1 otherwise.
128 // TODO(alex): replace with enum.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800129 state:int (id: 1);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700130
131 // If true, we have aborted.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800132 estopped:bool (id: 2);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700133
134 // Position of the joint.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800135 position:float (id: 3);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700136 // Velocity of the joint in units/second.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800137 velocity:float (id: 4);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700138 // Profiled goal position of the joint.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800139 goal_position:float (id: 5);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700140 // Profiled goal velocity of the joint in units/second.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800141 goal_velocity:float (id: 6);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700142 // Unprofiled goal position from absoulte zero of the joint.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800143 unprofiled_goal_position:float (id: 7);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700144 // Unprofiled goal velocity of the joint in units/second.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800145 unprofiled_goal_velocity:float (id: 8);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700146
147 // The estimated voltage error.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800148 voltage_error:float (id: 9);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700149
150 // The calculated velocity with delta x/delta t
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800151 calculated_velocity:float (id: 10);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700152
153 // Components of the control loop output
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800154 position_power:float (id: 11);
155 velocity_power:float (id: 12);
156 feedforwards_power:float (id: 13);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700157
158 // State of the estimator.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800159 estimator_state:frc971.IndexEstimatorState (id: 14);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700160}
161
162table AbsoluteEncoderProfiledJointStatus {
163 // Is the subsystem zeroed?
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800164 zeroed:bool (id: 0);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700165
166 // The state of the subsystem, if applicable. -1 otherwise.
167 // TODO(alex): replace with enum.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800168 state:int (id: 1);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700169
170 // If true, we have aborted.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800171 estopped:bool (id: 2);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700172
173 // Position of the joint.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800174 position:float (id: 3);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700175 // Velocity of the joint in units/second.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800176 velocity:float (id: 4);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700177 // Profiled goal position of the joint.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800178 goal_position:float (id: 5);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700179 // Profiled goal velocity of the joint in units/second.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800180 goal_velocity:float (id: 6);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700181 // Unprofiled goal position from absoulte zero of the joint.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800182 unprofiled_goal_position:float (id: 7);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700183 // Unprofiled goal velocity of the joint in units/second.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800184 unprofiled_goal_velocity:float (id: 8);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700185
186 // The estimated voltage error.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800187 voltage_error:float (id: 9);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700188
189 // The calculated velocity with delta x/delta t
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800190 calculated_velocity:float (id: 10);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700191
192 // Components of the control loop output
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800193 position_power:float (id: 11);
194 velocity_power:float (id: 12);
195 feedforwards_power:float (id: 13);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700196
197 // State of the estimator.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800198 estimator_state:frc971.AbsoluteEncoderEstimatorState (id: 14);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700199}
200
Ravago Jones937587c2020-12-26 17:21:09 -0800201table AbsoluteAndAbsoluteEncoderProfiledJointStatus {
202 // Is the subsystem zeroed?
203 zeroed:bool (id: 0);
204
205 // The state of the subsystem, if applicable. -1 otherwise.
206 // TODO(alex): replace with enum.
207 state:int (id: 1);
208
209 // If true, we have aborted.
210 estopped:bool (id: 2);
211
212 // Position of the joint.
213 position:float (id: 3);
214 // Velocity of the joint in units/second.
215 velocity:float (id: 4);
216 // Profiled goal position of the joint.
217 goal_position:float (id: 5);
218 // Profiled goal velocity of the joint in units/second.
219 goal_velocity:float (id: 6);
220 // Unprofiled goal position from absoulte zero of the joint.
221 unprofiled_goal_position:float (id: 7);
222 // Unprofiled goal velocity of the joint in units/second.
223 unprofiled_goal_velocity:float (id: 8);
224
225 // The estimated voltage error.
226 voltage_error:float (id: 9);
227
228 // The calculated velocity with delta x/delta t
229 calculated_velocity:float (id: 10);
230
231 // Components of the control loop output
232 position_power:float (id: 11);
233 velocity_power:float (id: 12);
234 feedforwards_power:float (id: 13);
235
236 // State of the estimator.
237 estimator_state:frc971.AbsoluteAndAbsoluteEncoderEstimatorState (id: 14);
238}
239
Tyler Chatow3c47f3c2020-01-29 20:45:23 -0800240table RelativeEncoderProfiledJointStatus {
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800241 // Is the subsystem zeroed?
242 zeroed:bool (id: 0);
243
Tyler Chatow3c47f3c2020-01-29 20:45:23 -0800244 // The state of the subsystem, if applicable. -1 otherwise.
245 // TODO(alex): replace with enum.
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800246 state:int (id: 1);
Tyler Chatow3c47f3c2020-01-29 20:45:23 -0800247
248 // If true, we have aborted.
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800249 estopped:bool (id: 2);
Tyler Chatow3c47f3c2020-01-29 20:45:23 -0800250
251 // Position of the joint.
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800252 position:float (id: 3);
Tyler Chatow3c47f3c2020-01-29 20:45:23 -0800253 // Velocity of the joint in units/second.
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800254 velocity:float (id: 4);
Tyler Chatow3c47f3c2020-01-29 20:45:23 -0800255 // Profiled goal position of the joint.
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800256 goal_position:float (id: 5);
Tyler Chatow3c47f3c2020-01-29 20:45:23 -0800257 // Profiled goal velocity of the joint in units/second.
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800258 goal_velocity:float (id: 6);
Tyler Chatow3c47f3c2020-01-29 20:45:23 -0800259 // Unprofiled goal position from absoulte zero of the joint.
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800260 unprofiled_goal_position:float (id: 7);
Tyler Chatow3c47f3c2020-01-29 20:45:23 -0800261 // Unprofiled goal velocity of the joint in units/second.
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800262 unprofiled_goal_velocity:float (id: 8);
Tyler Chatow3c47f3c2020-01-29 20:45:23 -0800263
264 // The estimated voltage error.
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800265 voltage_error:float (id: 9);
Tyler Chatow3c47f3c2020-01-29 20:45:23 -0800266
267 // The calculated velocity with delta x/delta t
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800268 calculated_velocity:float (id: 10);
Tyler Chatow3c47f3c2020-01-29 20:45:23 -0800269
270 // Components of the control loop output
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800271 position_power:float (id: 11);
272 velocity_power:float (id: 12);
273 feedforwards_power:float (id: 13);
Tyler Chatow3c47f3c2020-01-29 20:45:23 -0800274
275 // State of the estimator.
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800276 estimator_state:frc971.RelativeEncoderEstimatorState (id: 14);
Tyler Chatow3c47f3c2020-01-29 20:45:23 -0800277}
278
Alex Perrycb7da4b2019-08-28 19:35:56 -0700279table StaticZeroingSingleDOFProfiledSubsystemGoal {
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800280 unsafe_goal:double (id: 0);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700281
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800282 profile_params:frc971.ProfileParameters (id: 1);
James Kuszmaul4fb29762020-02-20 19:37:41 -0800283
284 // Sets the goal velocity of the subsystem.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800285 goal_velocity:double (id: 2);
James Kuszmaul4fb29762020-02-20 19:37:41 -0800286
287 // If set to true, then we will ignore the profiling on this joint and pass
288 // the goal + goal velocity directly to the control loop.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -0800289 ignore_profile:bool (id: 3);
Alex Perrycb7da4b2019-08-28 19:35:56 -0700290}
James Kuszmauleeb98e92024-01-14 22:15:32 -0800291
292// Stores everything but the zeroing information for a single-dof subsystem.
293// Because the subsystem will be templated on the zeroing information, it is
294// passed in separately (see types in //frc971/zeroing:constants.fbs).
295table StaticZeroingSingleDOFProfiledSubsystemCommonParams {
296 zeroing_voltage:double (id: 0);
297 operating_voltage:double (id: 1);
298 zeroing_profile_params:frc971.ProfileParameters (id: 2);
299 default_profile_params:frc971.ProfileParameters (id: 3);
300 range:frc971.Range (id: 4);
301 loop:[frc971.control_loops.fbs.StateFeedbackLoopCoefficients] (id: 5);
302}