James Kuszmaul | eeb98e9 | 2024-01-14 22:15:32 -0800 | [diff] [blame] | 1 | include "frc971/math/matrix.fbs"; |
| 2 | |
| 3 | namespace 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 | |
| 9 | table 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 | |
| 22 | table 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 | |
| 34 | table StateFeedbackControllerCoefficients { |
| 35 | k:frc971.fbs.Matrix (id: 0); |
| 36 | kff:frc971.fbs.Matrix (id: 1); |
| 37 | } |
| 38 | |
| 39 | table 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 | |
| 46 | table 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). |
| 57 | table StateFeedbackLoopCoefficients { |
| 58 | plant:StateFeedbackPlantCoefficients (id: 0); |
| 59 | controller:StateFeedbackControllerCoefficients (id: 1); |
| 60 | observer:StateFeedbackObserverCoefficients (id: 2); |
| 61 | } |
| 62 | |
| 63 | table 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. |
| 70 | table StateFeedbackLoopCoefficientsVector { |
| 71 | loops:[StateFeedbackLoopCoefficients] (id: 0); |
| 72 | } |
| 73 | |
| 74 | table StateFeedbackHybridLoopCoefficientsVector { |
| 75 | loops:[StateFeedbackHybridLoopCoefficients] (id: 0); |
| 76 | } |