Allow constructing control loops from flatbuffers
The core changes here are to:
* Allow constructing StateFeedbackLoop's from flatbuffers using the
code in *state_feedback_loop_converters.*
* Add constructors to the single-dof subsystem class to make use of
this.
* Add code to control_loops.py to generate JSON files with the requisite
constants (these end up containing identical information to the
generated .cc files).
* Add interfaces to actually support the new JSON codegen to single-dof
subsystem classes.
* Convert all of the drivetrains over to generating these. This I mostly
do so that I can write a test where Iconfirm that the .cc files and
the JSON files generate exactly the same content.
Change-Id: Iceac48f25ecac96200b7bf992c8f34a15fe6800c
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/frc971/control_loops/profiled_subsystem.fbs b/frc971/control_loops/profiled_subsystem.fbs
index 049b52f..d4f64f8 100644
--- a/frc971/control_loops/profiled_subsystem.fbs
+++ b/frc971/control_loops/profiled_subsystem.fbs
@@ -1,4 +1,5 @@
include "frc971/control_loops/control_loops.fbs";
+include "frc971/control_loops/state_feedback_loop.fbs";
namespace frc971.control_loops;
@@ -287,3 +288,15 @@
// the goal + goal velocity directly to the control loop.
ignore_profile:bool (id: 3);
}
+
+// Stores everything but the zeroing information for a single-dof subsystem.
+// Because the subsystem will be templated on the zeroing information, it is
+// passed in separately (see types in //frc971/zeroing:constants.fbs).
+table StaticZeroingSingleDOFProfiledSubsystemCommonParams {
+ zeroing_voltage:double (id: 0);
+ operating_voltage:double (id: 1);
+ zeroing_profile_params:frc971.ProfileParameters (id: 2);
+ default_profile_params:frc971.ProfileParameters (id: 3);
+ range:frc971.Range (id: 4);
+ loop:[frc971.control_loops.fbs.StateFeedbackLoopCoefficients] (id: 5);
+}