blob: 7c9bff8f494712294823a26f9e8ddc739be452f7 [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);
20}
21
22table StateFeedbackHybridPlantCoefficients {
23 a_continuous:frc971.fbs.Matrix (id: 0);
24 b_continuous:frc971.fbs.Matrix (id: 1);
25 c:frc971.fbs.Matrix (id: 2);
26 d:frc971.fbs.Matrix (id: 3);
27 u_min:frc971.fbs.Matrix (id: 4);
28 u_max:frc971.fbs.Matrix (id: 5);
29 u_limit_coefficient:frc971.fbs.Matrix (id: 6);
30 u_limit_constant:frc971.fbs.Matrix (id: 7);
31 delayed_u:uint64 (id: 8);
32}
33
34table StateFeedbackControllerCoefficients {
35 k:frc971.fbs.Matrix (id: 0);
36 kff:frc971.fbs.Matrix (id: 1);
37}
38
39table StateFeedbackObserverCoefficients {
40 kalman_gain:frc971.fbs.Matrix (id: 0);
41 q:frc971.fbs.Matrix (id: 1);
42 r:frc971.fbs.Matrix (id: 2);
43 delayed_u:uint64 (id: 3);
44}
45
46table HybridKalmanCoefficients {
47 q_continuous:frc971.fbs.Matrix (id: 0);
48 r_continuous:frc971.fbs.Matrix (id: 1);
49 p_steady_state:frc971.fbs.Matrix (id: 2);
50 delayed_u:uint64 (id: 3);
51}
52
53// The tables below represent a single index within a
54// *Loop object. A vector of these will be necessary to initialize
55// the loop (the vector will be of length one except when using a
56// gain-scheduled controller).
57table StateFeedbackLoopCoefficients {
58 plant:StateFeedbackPlantCoefficients (id: 0);
59 controller:StateFeedbackControllerCoefficients (id: 1);
60 observer:StateFeedbackObserverCoefficients (id: 2);
61}
62
63table StateFeedbackHybridLoopCoefficients {
64 plant:StateFeedbackHybridPlantCoefficients (id: 0);
65 controller:StateFeedbackControllerCoefficients (id: 1);
66 observer:HybridKalmanCoefficients (id: 2);
67}
68
69// Helpers for when we need to be able to package just the loop coefficients.
70table StateFeedbackLoopCoefficientsVector {
71 loops:[StateFeedbackLoopCoefficients] (id: 0);
72}
73
74table StateFeedbackHybridLoopCoefficientsVector {
75 loops:[StateFeedbackHybridLoopCoefficients] (id: 0);
76}