Calibrated encoders.
Change-Id: I92d46866c6ab16129dd9907058e61c7fcc0bd1e0
diff --git a/bot3/control_loops/elevator/elevator.h b/bot3/control_loops/elevator/elevator.h
index 3185187..074ab15 100644
--- a/bot3/control_loops/elevator/elevator.h
+++ b/bot3/control_loops/elevator/elevator.h
@@ -28,27 +28,24 @@
// Game pieces
constexpr double kToteHeight = 0.3;
-// TODO(comran): Get actual constants for the ones below.
// Gearing
-
constexpr double kElevEncoderRatio = 18.0 / 48.0;
+constexpr double kElevChainReduction = 16.0 / 22.0;
const int kElevGearboxOutputPulleyTeeth = 22;
-// 25 pitch chain.
-constexpr double kElevGearboxOutputPitch = 0.25 * 0.0254;
+constexpr double kElevGearboxOutputPitch = 0.25 * 0.0254; // 25 pitch chain.
constexpr double kElevGearboxOutputRadianDistance =
kElevGearboxOutputPulleyTeeth * kElevGearboxOutputPitch / (2.0 * M_PI);
// Limits
-constexpr double kElevLowerHardLimit = -0.005;
-constexpr double kElevUpperHardLimit = 0.720000;
-constexpr double kElevLowerLimit = 0.010000;
-constexpr double kElevUpperLimit = 0.680000;
+constexpr double kElevLowerHardLimit = 0.000;
+constexpr double kElevUpperHardLimit = 1.387;
+constexpr double kElevLowerLimit = 0.020;
+constexpr double kElevUpperLimit = 1.350;
// Zeroing
namespace {
-// TODO(Adam): Find the actual value of the hall effect position.
-constexpr double kHallEffectPosition = 0.01;
+constexpr double kHallEffectPosition = 0.025;
} // namespace
// End constants
diff --git a/bot3/wpilib/wpilib_interface.cc b/bot3/wpilib/wpilib_interface.cc
index dfffddc..0c7df64 100644
--- a/bot3/wpilib/wpilib_interface.cc
+++ b/bot3/wpilib/wpilib_interface.cc
@@ -62,7 +62,7 @@
namespace wpilib {
double drivetrain_translate(int32_t in) {
- return static_cast<double>(in) / (512.0 /*cpr*/ * 4.0 /*4x*/) *
+ return static_cast<double>(in) / (256.0 /*cpr*/ * 4.0 /*4x*/) *
::bot3::control_loops::kDrivetrainEncoderRatio *
(4 /*wheel diameter*/ * 2.54 / 100.0 * M_PI);
}
@@ -70,6 +70,7 @@
double elevator_translate(int32_t in) {
return static_cast<double>(in) / (512.0 /*cpr*/ * 4.0 /*4x*/) *
::bot3::control_loops::kElevEncoderRatio * (2 * M_PI /*radians*/) *
+ ::bot3::control_loops::kElevChainReduction *
::bot3::control_loops::kElevGearboxOutputRadianDistance;
}