Add a current limit on the flywheels.
We were blowing breakers. Limit the request to do better.
Change-Id: Ibd59d9c54e02991070d0d68f42eb33c29c3a4132
diff --git a/y2020/control_loops/python/flywheel.py b/y2020/control_loops/python/flywheel.py
index 451788a..f284450 100755
--- a/y2020/control_loops/python/flywheel.py
+++ b/y2020/control_loops/python/flywheel.py
@@ -295,6 +295,18 @@
loop_writer.AddConstant(
control_loop.Constant('kFreeSpeed', '%f',
flywheels[0].motor.free_speed))
+ loop_writer.AddConstant(
+ control_loop.Constant(
+ 'kBemf',
+ '%f',
+ flywheels[0].motor.Kv * flywheels[0].G,
+ comment="// Radians/sec / volt"))
+ loop_writer.AddConstant(
+ control_loop.Constant(
+ 'kResistance',
+ '%f',
+ flywheels[0].motor.resistance,
+ comment="// Ohms"))
loop_writer.Write(plant_files[0], plant_files[1])
integral_loop_writer = control_loop.ControlLoopWriter(