First pass at tuning 2024 subsystems
The Krakens make everything a bit more exciting. Apply a first pass at
tuning everything.
Change-Id: I4a6541c3f052a3b38fc229f2625039ab72cf00fd
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/y2024/control_loops/python/catapult.py b/y2024/control_loops/python/catapult.py
index c1b1472..f7b76e6 100644
--- a/y2024/control_loops/python/catapult.py
+++ b/y2024/control_loops/python/catapult.py
@@ -19,40 +19,52 @@
gflags.DEFINE_bool('hybrid', False, 'If true, make it hybrid.')
+
+def AddResistance(motor, resistance):
+ motor.resistance += resistance
+ return motor
+
+
kCatapultWithGamePiece = angular_system.AngularSystemParams(
name='Catapult',
- motor=control_loop.KrakenFOC(),
+ # Add the battery series resistance to make it better match.
+ motor=AddResistance(control_loop.NMotor(control_loop.KrakenFOC(), 2),
+ 0.03),
G=(14.0 / 60.0) * (12.0 / 24.0),
# 208.7328 in^2 lb
J=0.065,
- q_pos=0.40,
- q_vel=3.0,
+ q_pos=0.80,
+ q_vel=15.0,
kalman_q_pos=0.12,
kalman_q_vel=2.0,
- kalman_q_voltage=4.0,
+ kalman_q_voltage=0.7,
kalman_r_position=0.05,
- radius=12 * 0.0254)
+ radius=12 * 0.0254,
+ delayed_u=1)
kCatapultWithoutGamePiece = angular_system.AngularSystemParams(
name='Catapult',
- motor=control_loop.KrakenFOC(),
+ # Add the battery series resistance to make it better match.
+ motor=AddResistance(control_loop.NMotor(control_loop.KrakenFOC(), 2),
+ 0.03),
G=(14.0 / 60.0) * (12.0 / 24.0),
# 135.2928 in^2 lb
J=0.04,
- q_pos=0.40,
- q_vel=3.0,
+ q_pos=0.80,
+ q_vel=15.0,
kalman_q_pos=0.12,
kalman_q_vel=2.0,
- kalman_q_voltage=4.0,
+ kalman_q_voltage=0.7,
kalman_r_position=0.05,
- radius=12 * 0.0254)
+ radius=12 * 0.0254,
+ delayed_u=1)
def main(argv):
if FLAGS.plot:
R = numpy.matrix([[numpy.pi / 2.0], [0.0]])
- angular_system.PlotKick(kCatapult, R)
- angular_system.PlotMotion(kCatapult, R)
+ angular_system.PlotKick(kCatapultWithGamePiece, R)
+ angular_system.PlotMotion(kCatapultWithGamePiece, R)
return
# Write the generated constants out to a file.