Update turret gear ratio and tuned controller
Signed-off-by: milind-u <milind.upadhyay@gmail.com>
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
Change-Id: Ibc6a255c866c77af7d909e311217398f3bf26135
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/frc971/control_loops/python/control_loop.py b/frc971/control_loops/python/control_loop.py
index cea1fdd..72d3297 100644
--- a/frc971/control_loops/python/control_loop.py
+++ b/frc971/control_loops/python/control_loop.py
@@ -588,6 +588,9 @@
# Torque constant
self.Kt = self.stall_torque / self.stall_current
+ # Motor inertia in kg m^2
+ self.motor_inertia = 0.0001634
+
class NMotor(object):
def __init__(self, motor, n):
diff --git a/y2020/control_loops/python/turret.py b/y2020/control_loops/python/turret.py
index acddae3..6f15057 100644
--- a/y2020/control_loops/python/turret.py
+++ b/y2020/control_loops/python/turret.py
@@ -20,14 +20,14 @@
kTurret = angular_system.AngularSystemParams(
name='Turret',
- motor=control_loop.Vex775Pro(),
- G=(6.0 / 60.0) * (26.0 / 150.0),
+ motor=control_loop.MiniCIM(),
+ G=(26.0 / 150.0) * (14.0 / 60.0) * (20.0 / 60.0),
J=0.20,
q_pos=0.30,
q_vel=4.5,
kalman_q_pos=0.12,
kalman_q_vel=10.0,
- kalman_q_voltage=12.0,
+ kalman_q_voltage=20.0,
kalman_r_position=0.05)
def main(argv):
diff --git a/y2020/control_loops/superstructure/superstructure.h b/y2020/control_loops/superstructure/superstructure.h
index e4a9cb6..59e976e 100644
--- a/y2020/control_loops/superstructure/superstructure.h
+++ b/y2020/control_loops/superstructure/superstructure.h
@@ -26,9 +26,9 @@
// Terms to control the velocity gain for the friction compensation, and the
// voltage cap.
- static constexpr double kTurretFrictionGain = 10.0;
+ static constexpr double kTurretFrictionGain = 0.0;
static constexpr double kTurretFrictionVoltageLimit = 1.5;
- static constexpr double kTurretDitherGain = 0.4;
+ static constexpr double kTurretDitherGain = 0.0;
using PotAndAbsoluteEncoderSubsystem =
::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystem<
diff --git a/y2020/wpilib_interface.cc b/y2020/wpilib_interface.cc
index 3e91d1e..bdc16fa 100644
--- a/y2020/wpilib_interface.cc
+++ b/y2020/wpilib_interface.cc
@@ -456,7 +456,7 @@
kMaxBringupPower) /
12.0);
- turret_victor_->SetSpeed(std::clamp(-output.turret_voltage(),
+ turret_victor_->SetSpeed(std::clamp(output.turret_voltage(),
-kMaxBringupPower, kMaxBringupPower) /
12.0);