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/python/angular_system.py b/frc971/control_loops/python/angular_system.py
index c6ffb50..551f3d0 100755
--- a/frc971/control_loops/python/angular_system.py
+++ b/frc971/control_loops/python/angular_system.py
@@ -461,7 +461,8 @@
loop_writer.AddConstant(
control_loop.Constant('kFreeSpeed', '%f',
angular_systems[0].motor.free_speed))
- loop_writer.Write(plant_files[0], plant_files[1])
+ loop_writer.Write(plant_files[0], plant_files[1],
+ None if len(plant_files) < 3 else plant_files[2])
integral_loop_writer = control_loop.ControlLoopWriter(
'Integral' + name,
@@ -469,4 +470,6 @@
namespaces=year_namespaces,
plant_type=plant_type,
observer_type=observer_type)
- integral_loop_writer.Write(controller_files[0], controller_files[1])
+ integral_loop_writer.Write(
+ controller_files[0], controller_files[1],
+ None if len(controller_files) < 3 else controller_files[2])