blob: 4ab267df0ff2196d438bc459e0bf18a6c450bf30 [file] [log] [blame]
James Kuszmauleeb98e92024-01-14 22:15:32 -08001include "frc971/math/matrix.fbs";
2
3namespace frc971.control_loops.fbs;
4
5// This file contains tables that represent the constants required
6// to initialize a control loop.
7// See frc971/control_loops/state_feedback_loop.h
8
9table StateFeedbackPlantCoefficients {
10 a:frc971.fbs.Matrix (id: 0);
11 b:frc971.fbs.Matrix (id: 1);
12 c:frc971.fbs.Matrix (id: 2);
13 d:frc971.fbs.Matrix (id: 3);
14 u_min:frc971.fbs.Matrix (id: 4);
15 u_max:frc971.fbs.Matrix (id: 5);
16 u_limit_coefficient:frc971.fbs.Matrix (id: 6);
17 u_limit_constant:frc971.fbs.Matrix (id: 7);
18 dt:uint64 (id: 8);
19 delayed_u:uint64 (id: 9);
James Kuszmaul9ea3ff92024-06-14 15:02:15 -070020 wrap_point:frc971.fbs.Matrix (id: 10);
James Kuszmauleeb98e92024-01-14 22:15:32 -080021}
22
23table StateFeedbackHybridPlantCoefficients {
24 a_continuous:frc971.fbs.Matrix (id: 0);
25 b_continuous:frc971.fbs.Matrix (id: 1);
26 c:frc971.fbs.Matrix (id: 2);
27 d:frc971.fbs.Matrix (id: 3);
28 u_min:frc971.fbs.Matrix (id: 4);
29 u_max:frc971.fbs.Matrix (id: 5);
30 u_limit_coefficient:frc971.fbs.Matrix (id: 6);
31 u_limit_constant:frc971.fbs.Matrix (id: 7);
32 delayed_u:uint64 (id: 8);
James Kuszmaul9ea3ff92024-06-14 15:02:15 -070033 wrap_point:frc971.fbs.Matrix (id: 9);
James Kuszmauleeb98e92024-01-14 22:15:32 -080034}
35
36table StateFeedbackControllerCoefficients {
37 k:frc971.fbs.Matrix (id: 0);
38 kff:frc971.fbs.Matrix (id: 1);
39}
40
41table StateFeedbackObserverCoefficients {
42 kalman_gain:frc971.fbs.Matrix (id: 0);
43 q:frc971.fbs.Matrix (id: 1);
44 r:frc971.fbs.Matrix (id: 2);
45 delayed_u:uint64 (id: 3);
46}
47
48table HybridKalmanCoefficients {
49 q_continuous:frc971.fbs.Matrix (id: 0);
50 r_continuous:frc971.fbs.Matrix (id: 1);
51 p_steady_state:frc971.fbs.Matrix (id: 2);
52 delayed_u:uint64 (id: 3);
53}
54
55// The tables below represent a single index within a
56// *Loop object. A vector of these will be necessary to initialize
57// the loop (the vector will be of length one except when using a
58// gain-scheduled controller).
59table StateFeedbackLoopCoefficients {
60 plant:StateFeedbackPlantCoefficients (id: 0);
61 controller:StateFeedbackControllerCoefficients (id: 1);
62 observer:StateFeedbackObserverCoefficients (id: 2);
63}
64
65table StateFeedbackHybridLoopCoefficients {
66 plant:StateFeedbackHybridPlantCoefficients (id: 0);
67 controller:StateFeedbackControllerCoefficients (id: 1);
68 observer:HybridKalmanCoefficients (id: 2);
69}
70
71// Helpers for when we need to be able to package just the loop coefficients.
72table StateFeedbackLoopCoefficientsVector {
73 loops:[StateFeedbackLoopCoefficients] (id: 0);
74}
75
76table StateFeedbackHybridLoopCoefficientsVector {
77 loops:[StateFeedbackHybridLoopCoefficients] (id: 0);
78}