Add deadband to pistol grip inputs
This allows the robot to actually be still when stopped, which helps the
localization reset when we do stop during a match.
Change-Id: I872eaa1061cd34edbdb376c206f08403108b8fe5
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/frc971/input/drivetrain_input.cc b/frc971/input/drivetrain_input.cc
index b1adf1c..ab3afef 100644
--- a/frc971/input/drivetrain_input.cc
+++ b/frc971/input/drivetrain_input.cc
@@ -207,6 +207,13 @@
high_gear_ = true;
}
+ // Emprically, the current pistol grip tends towards steady-state errors at
+ // ~0.01-0.02 on both the wheel/throttle. Having the throttle correctly snap
+ // to zero is more important than the wheel for our internal logic, so force a
+ // deadband there.
+ constexpr double kThrottleDeadband = 0.05;
+ throttle = aos::Deadband(throttle, kThrottleDeadband, 1.0);
+
return DrivetrainInputReader::WheelAndThrottle{
wheel, wheel_velocity, wheel_torque,
throttle, throttle_velocity, throttle_torque,