Clean up and check constants.

Most of the changes are pretty minor. I got rid of some ugly stuff
and added real numbers for some things.

Change-Id: Iafb1a81323141fccc907f87b2da3f8118cb3d6ce
diff --git a/frc971/constants.cc b/frc971/constants.cc
index 3beedfb..0f63ed2 100644
--- a/frc971/constants.cc
+++ b/frc971/constants.cc
@@ -31,14 +31,10 @@
 
 // ///// Drivetrain Constants
 
-const double kCompDrivetrainEncoderRatio =
-    (18.0 / 50.0) /*output reduction*/ * (56.0 / 30.0) /*encoder gears*/;
-const double kCompLowGearRatio = 18.0 / 60.0 * 18.0 / 50.0;
-const double kCompHighGearRatio = 28.0 / 50.0 * 18.0 / 50.0;
-
-const double kPracticeDrivetrainEncoderRatio = kCompDrivetrainEncoderRatio;
-const double kPracticeLowGearRatio = kCompLowGearRatio;
-const double kPracticeHighGearRatio = kCompHighGearRatio;
+// These three constants were set by Daniel on 2/13/15.
+const double kDrivetrainEncoderRatio = 20.0 / 64.0;
+const double kLowGearRatio = kDrivetrainEncoderRatio * 20.0 / 50.0;
+const double kHighGearRatio = kLowGearRatio;
 
 const ShifterHallEffect kCompRightDriveShifter{555, 657, 660, 560, 0.2, 0.7};
 const ShifterHallEffect kCompLeftDriveShifter{555, 660, 644, 552, 0.2, 0.7};
@@ -46,37 +42,40 @@
 const ShifterHallEffect kPracticeRightDriveShifter{2.95, 3.95, 3.95, 2.95, 0.2, 0.7};
 const ShifterHallEffect kPracticeLeftDriveShifter{2.95, 4.2, 3.95, 3.0, 0.2, 0.7};
 
-// TODO(sensors): Get actual robot width before turning on robot.
-const double kRobotWidth = 25.0 / 100.0 * 2.54;
-
+// Set by Daniel on 2/13/15.
+// Distance from the center of the left wheel to the center of the right wheel.
+const double kRobotWidth = 37.806 /*inches*/ * 0.0254;
 
 // ///// Superstructure Constants
 
-// Gearing ratios of the pots and encoders for the elevator and arm.
-// Ratio is output shaft rotations per encoder/pot rotation
-const double kArmEncoderRatio = 18.0 / 48.0 * 16.0 / 72.0;
-// const double kArmPotRatio = 48.0 / 48.0 * 16.0 / 72.0;
-const double kElevatorEncoderRatio = 14.0 / 84.0;
-// const double kElevatorPotRatio = 1.0;
-const double kClawEncoderRatio = 18.0 / 72.0;
-// const double kClawPotRatio = 18.0/72.0;
-
 // Elevator gearbox pulley output constants.
 const int kElevatorGearboxOutputPulleyTeeth = 32;  // 32 teeth
 const double kElevatorGearboxOutputPitch = 0.005;  // 5 mm/tooth
-const double kElevatorGearboxOutputRotationDistance =
-    kElevatorGearboxOutputPulleyTeeth * kElevatorGearboxOutputPitch;
+const double kElevatorGearboxOutputRadianDistance =
+    kElevatorGearboxOutputPulleyTeeth * kElevatorGearboxOutputPitch /
+    (2.0 * M_PI);
 
 const double kMaxAllowedLeftRightArmDifference = 0.01;  // radians
 const double kMaxAllowedLeftRightElevatorDifference = 0.01;  // meters
 
+// Gearing ratios of the pots and encoders for the elevator and arm.
+// Ratio is output shaft rotations per encoder/pot rotation
+// Checked by Daniel on 2/13/15.
+const double kArmEncoderRatio = 18.0 / 48.0 * 16.0 / 72.0;
+const double kArmPotRatio = 48.0 / 48.0 * 16.0 / 72.0;
+const double kElevatorEncoderRatio = 14.0 / 84.0;
+const double kElevatorPotRatio = 1.0;
+const double kClawEncoderRatio = 18.0 / 72.0;
+const double kClawPotRatio = 18.0 / 72.0;
+
 // Number of radians between each index pulse on the arm.
-const double kArmEncoderIndexDifference = 2 * M_PI *  kArmEncoderRatio;
-
-// Number of meters betwen index pulses on the elevator.
+const double kArmEncoderIndexDifference = 2.0 * M_PI *  kArmEncoderRatio;
+// Number of meters between each index pulse on the elevator.
 const double kElevatorEncoderIndexDifference =
-    kElevatorGearboxOutputRotationDistance * kElevatorEncoderRatio;
-
+    kElevatorEncoderRatio *
+    2.0 * M_PI * // radians
+    kElevatorGearboxOutputRadianDistance;
+// Number of radians between index pulses on the claw.
 const double kClawEncoderIndexDifference = 2.0 * M_PI * kClawEncoderRatio;
 
 const int kZeroingSampleSize = 20;
@@ -85,9 +84,16 @@
   switch (team) {
     case 1:  // for tests
       return new Values{
-          kCompDrivetrainEncoderRatio,
-          kCompLowGearRatio,
-          kCompHighGearRatio,
+          kDrivetrainEncoderRatio,
+          kArmEncoderRatio,
+          kArmPotRatio,
+          kElevatorEncoderRatio,
+          kElevatorPotRatio,
+          kElevatorGearboxOutputRadianDistance,
+          kClawEncoderRatio,
+          kClawPotRatio,
+          kLowGearRatio,
+          kHighGearRatio,
           kCompLeftDriveShifter,
           kCompRightDriveShifter,
           false,
@@ -97,17 +103,6 @@
           0.02,  // drivetrain done delta
           5.0,   // drivetrain max speed
 
-          // Zeroing constants: left arm, right arm, left elev, right elev
-          {
-           kZeroingSampleSize, kArmEncoderIndexDifference,
-           // TODO(sensors): Get actual offsets before turning on robot.
-           0.0 /*index_offset_at_zero*/
-          },
-          {kZeroingSampleSize, kArmEncoderIndexDifference, 0.0},
-          {kZeroingSampleSize, kElevatorEncoderIndexDifference, 0.0},
-          {kZeroingSampleSize, kElevatorEncoderIndexDifference, 0.0},
-          {kZeroingSampleSize, kClawEncoderIndexDifference, 0.0},
-
           // Motion ranges: hard_lower_limit, hard_upper_limit,
           //                soft_lower_limit, soft_upper_limit
           // TODO(sensors): Get actual bounds before turning on robot.
@@ -116,7 +111,11 @@
             // 0 is level with the ground.
             // Positive moves in the direction of positive encoder values.
             {0.0000000000, 1.5700000000,
-             0.1000000000, 1.2000000000}
+             0.1000000000, 1.2000000000},
+
+            // Zeroing constants for wrist.
+            // TODO(sensors): Get actual offsets for these.
+            {kZeroingSampleSize, kClawEncoderIndexDifference, 0.0},
           },
 
           {
@@ -131,7 +130,15 @@
             // 0 is sticking straight out horizontally over the intake/front.
             // Positive is rotating up and into the robot (towards the back).
             {-1.570000000, 1.5700000000,
-             -1.200000000, 1.2000000000}
+             -1.200000000, 1.2000000000},
+
+            // Elevator zeroing constants: left, right.
+            // TODO(sensors): Get actual offsets for these.
+            {kZeroingSampleSize, kElevatorEncoderIndexDifference, 0.0},
+            {kZeroingSampleSize, kElevatorEncoderIndexDifference, 0.0},
+            // Arm zeroing constants: left, right.
+            {kZeroingSampleSize, kArmEncoderIndexDifference, 0.0},
+            {kZeroingSampleSize, kArmEncoderIndexDifference, 0.0},
           },
           // End "sensor" values.
 
@@ -141,9 +148,16 @@
       break;
     case kCompTeamNumber:
       return new Values{
-          kCompDrivetrainEncoderRatio,
-          kCompLowGearRatio,
-          kCompHighGearRatio,
+          kDrivetrainEncoderRatio,
+          kArmEncoderRatio,
+          kArmPotRatio,
+          kElevatorEncoderRatio,
+          kElevatorPotRatio,
+          kElevatorGearboxOutputRadianDistance,
+          kClawEncoderRatio,
+          kClawPotRatio,
+          kLowGearRatio,
+          kHighGearRatio,
           kCompLeftDriveShifter,
           kCompRightDriveShifter,
           false,
@@ -153,17 +167,6 @@
           0.02,  // drivetrain done delta
           5.0,   // drivetrain max speed
 
-          // Zeroing constants: left arm, right arm, left elev, right elev
-          {
-           kZeroingSampleSize, kArmEncoderIndexDifference,
-           // TODO(sensors): Get actual offsets before turning on robot.
-           0.0 /*index_offset_at_zero*/
-          },
-          {kZeroingSampleSize, kArmEncoderIndexDifference, 0.0},
-          {kZeroingSampleSize, kElevatorEncoderIndexDifference, 0.0},
-          {kZeroingSampleSize, kElevatorEncoderIndexDifference, 0.0},
-          {kZeroingSampleSize, kClawEncoderIndexDifference, 0.0},
-
           // Motion ranges: hard_lower_limit, hard_upper_limit,
           //                soft_lower_limit, soft_upper_limit
           // TODO(sensors): Get actual bounds before turning on robot.
@@ -172,7 +175,12 @@
             // 0 is level with the ground.
             // Positive moves in the direction of positive encoder values.
             {0.0000000000, 1.5700000000,
-             0.1000000000, 1.2000000000}
+             0.1000000000, 1.2000000000},
+
+            // Zeroing constants for wrist.
+            // TODO(sensors): Get actual offsets for these.
+            {kZeroingSampleSize, kClawEncoderIndexDifference, 0.0},
+
           },
 
           {
@@ -186,7 +194,15 @@
             // 0 is sticking straight out horizontally over the intake/front.
             // Positive is rotating up and into the robot (towards the back).
             {-1.570000000, 1.5700000000,
-             -1.200000000, 1.2000000000}
+             -1.200000000, 1.2000000000},
+
+            // Elevator zeroing constants: left, right.
+            // TODO(sensors): Get actual offsets for these.
+            {kZeroingSampleSize, kElevatorEncoderIndexDifference, 0.0},
+            {kZeroingSampleSize, kElevatorEncoderIndexDifference, 0.0},
+            // Arm zeroing constants: left, right.
+            {kZeroingSampleSize, kArmEncoderIndexDifference, 0.0},
+            {kZeroingSampleSize, kArmEncoderIndexDifference, 0.0},
           },
           // End "sensor" values.
 
@@ -196,9 +212,16 @@
       break;
     case kPracticeTeamNumber:
       return new Values{
-          kPracticeDrivetrainEncoderRatio,
-          kPracticeLowGearRatio,
-          kPracticeHighGearRatio,
+          kDrivetrainEncoderRatio,
+          kArmEncoderRatio,
+          kArmPotRatio,
+          kElevatorEncoderRatio,
+          kElevatorPotRatio,
+          kElevatorGearboxOutputRadianDistance,
+          kClawEncoderRatio,
+          kClawPotRatio,
+          kLowGearRatio,
+          kHighGearRatio,
           kPracticeLeftDriveShifter,
           kPracticeRightDriveShifter,
           false,
@@ -208,18 +231,6 @@
           0.02,  // drivetrain done delta
           5.0,   // drivetrain max speed
 
-          // Zeroing constants: left arm, right arm, left elev, right elev
-          {
-           kZeroingSampleSize, kArmEncoderIndexDifference,
-           // TODO(sensors): Get actual offsets before turning on robot.
-           0.0 /*index_offset_at_zero*/
-          },
-          {kZeroingSampleSize, kArmEncoderIndexDifference, 0.0},
-          {kZeroingSampleSize, kElevatorEncoderIndexDifference, 0.0},
-          {kZeroingSampleSize, kElevatorEncoderIndexDifference, 0.0},
-          {kZeroingSampleSize, kClawEncoderIndexDifference, 0.0},
-          // TODO(sensors): End "sensors" values
-
           // Motion ranges: hard_lower_limit, hard_upper_limit,
           //                soft_lower_limit, soft_upper_limit
           // TODO(sensors): Get actual bounds before turning on robot.
@@ -228,7 +239,11 @@
             // 0 is level with the ground.
             // Positive moves in the direction of positive encoder values.
             {0.0000000000, 1.5700000000,
-             0.1000000000, 1.2000000000}
+             0.1000000000, 1.2000000000},
+
+            // Zeroing constants for wrist.
+            // TODO(sensors): Get actual offsets for these.
+            {kZeroingSampleSize, kClawEncoderIndexDifference, 0.0},
           },
 
           {
@@ -242,7 +257,15 @@
             // 0 is sticking straight out horizontally over the intake/front.
             // Positive is rotating up and into the robot (towards the back).
             {-1.570000000, 1.5700000000,
-             -1.200000000, 1.2000000000}
+             -1.200000000, 1.2000000000},
+
+            // Elevator zeroing constants: left, right.
+            // TODO(sensors): Get actual offsets for these.
+            {kZeroingSampleSize, kElevatorEncoderIndexDifference, 0.0},
+            {kZeroingSampleSize, kElevatorEncoderIndexDifference, 0.0},
+            // Arm zeroing constants: left, right.
+            {kZeroingSampleSize, kArmEncoderIndexDifference, 0.0},
+            {kZeroingSampleSize, kArmEncoderIndexDifference, 0.0},
           },
           // TODO(sensors): End "sensor" values.
 
diff --git a/frc971/constants.h b/frc971/constants.h
index eca49d7..883e1b1 100644
--- a/frc971/constants.h
+++ b/frc971/constants.h
@@ -17,6 +17,20 @@
 
   // The ratio from the encoder shaft to the drivetrain wheels.
   double drivetrain_encoder_ratio;
+  // The ratio from the encoder shaft to the arm joint.
+  double arm_encoder_ratio;
+  // The ratio from the pot shaft to the arm joint.
+  double arm_pot_ratio;
+  // The ratio from the encoder shaft to the elevator output pulley.
+  double elev_encoder_ratio;
+  // The ratio from the pot shaft to the elevator output pulley.
+  double elev_pot_ratio;
+  // How far the elevator moves (meters) per radian on the output pulley.
+  double elev_distance_per_radian;
+  // The ratio from the encoder shaft to the claw joint.
+  double claw_encoder_ratio;
+  // The ratio from the pot shaft to the claw joint.
+  double claw_pot_ratio;
 
   // The gear ratios from motor shafts to the drivetrain wheels for high and low
   // gear.
@@ -45,12 +59,6 @@
     double measured_index_position;
   };
 
-  ZeroingConstants left_arm_zeroing_constants;
-  ZeroingConstants right_arm_zeroing_constants;
-  ZeroingConstants left_elevator_zeroing_constants;
-  ZeroingConstants right_elevator_zeroing_constants;
-  ZeroingConstants claw_zeroing_constants;
-
   // Defines a range of motion for a subsystem.
   struct Range {
     double lower_hard_limit;
@@ -61,12 +69,18 @@
 
   struct Claw {
     Range wrist;
+    ZeroingConstants zeroing;
   };
   Claw claw;
 
   struct Fridge {
     Range elevator;
     Range arm;
+
+    ZeroingConstants left_elev_zeroing;
+    ZeroingConstants right_elev_zeroing;
+    ZeroingConstants left_arm_zeroing;
+    ZeroingConstants right_arm_zeroing;
   };
   Fridge fridge;
 
diff --git a/frc971/control_loops/claw/claw_lib_test.cc b/frc971/control_loops/claw/claw_lib_test.cc
index d671cfa..4f86697 100644
--- a/frc971/control_loops/claw/claw_lib_test.cc
+++ b/frc971/control_loops/claw/claw_lib_test.cc
@@ -26,8 +26,7 @@
   // Constructs a claw simulation.
   ClawSimulation()
       : claw_plant_(new StateFeedbackPlant<2, 1, 1>(MakeClawPlant())),
-        pot_and_encoder_(
-            constants::GetValues().claw_zeroing_constants.index_difference),
+        pot_and_encoder_(constants::GetValues().claw.zeroing.index_difference),
         claw_queue_(".frc971.control_loops.claw_queue", 0x9d7452fb,
                     ".frc971.control_loops.claw_queue.goal",
                     ".frc971.control_loops.claw_queue.position",
@@ -35,7 +34,7 @@
                     ".frc971.control_loops.claw_queue.status") {
     pot_and_encoder_.Initialize(
         constants::GetValues().claw.wrist.lower_limit,
-        constants::GetValues().claw_zeroing_constants.index_difference / 3.0);
+        constants::GetValues().claw.zeroing.index_difference / 3.0);
   }
 
   // Do specific initialization for the sensors.
@@ -164,7 +163,7 @@
 
   // Lower limit.
   ASSERT_TRUE(claw_queue_.goal.MakeWithBuilder()
-      .angle(values.claw.wrist.lower_hard_limit + 5.0)
+      .angle(values.claw.wrist.lower_hard_limit - 5.0)
       .Send());
 
   RunForTime(Time::InMS(4000));
diff --git a/frc971/control_loops/fridge/fridge.cc b/frc971/control_loops/fridge/fridge.cc
index d2e7bbf..be6bb01 100644
--- a/frc971/control_loops/fridge/fridge.cc
+++ b/frc971/control_loops/fridge/fridge.cc
@@ -61,12 +61,12 @@
           StateFeedbackLoop<4, 2, 2>(MakeArmLoop()))),
       elevator_loop_(new CappedStateFeedbackLoop(
           StateFeedbackLoop<4, 2, 2>(MakeElevatorLoop()))),
-      left_arm_estimator_(constants::GetValues().left_arm_zeroing_constants),
-      right_arm_estimator_(constants::GetValues().right_arm_zeroing_constants),
+      left_arm_estimator_(constants::GetValues().fridge.left_arm_zeroing),
+      right_arm_estimator_(constants::GetValues().fridge.right_arm_zeroing),
       left_elevator_estimator_(
-          constants::GetValues().left_elevator_zeroing_constants),
+          constants::GetValues().fridge.left_elev_zeroing),
       right_elevator_estimator_(
-          constants::GetValues().right_elevator_zeroing_constants) {}
+          constants::GetValues().fridge.right_elev_zeroing) {}
 
 void Fridge::UpdateZeroingState() {
   if (left_elevator_estimator_.offset_ratio_ready() < 0.5 ||
@@ -184,8 +184,8 @@
       2.0;
 
   const double pulse_width = ::std::max(
-      constants::GetValues().left_elevator_zeroing_constants.index_difference,
-      constants::GetValues().right_elevator_zeroing_constants.index_difference);
+      constants::GetValues().fridge.left_elev_zeroing.index_difference,
+      constants::GetValues().fridge.right_elev_zeroing.index_difference);
 
   if (elevator_zeroing_velocity_ == 0) {
     if (estimated_elevator() > average_elevator) {
@@ -208,8 +208,8 @@
                               constants::GetValues().fridge.arm.upper_limit) /
                              2.0;
   const double pulse_width = ::std::max(
-      constants::GetValues().right_arm_zeroing_constants.index_difference,
-      constants::GetValues().left_arm_zeroing_constants.index_difference);
+      constants::GetValues().fridge.right_arm_zeroing.index_difference,
+      constants::GetValues().fridge.left_arm_zeroing.index_difference);
 
   if (arm_zeroing_velocity_ == 0) {
     if (estimated_arm() > average_arm) {
diff --git a/frc971/control_loops/fridge/fridge_lib_test.cc b/frc971/control_loops/fridge/fridge_lib_test.cc
index 2bc3d02..5c41e98 100644
--- a/frc971/control_loops/fridge/fridge_lib_test.cc
+++ b/frc971/control_loops/fridge/fridge_lib_test.cc
@@ -28,16 +28,13 @@
       : arm_plant_(new StateFeedbackPlant<4, 2, 2>(MakeArmPlant())),
         elev_plant_(new StateFeedbackPlant<4, 2, 2>(MakeElevatorPlant())),
         left_arm_pot_encoder_(
-            constants::GetValues().left_arm_zeroing_constants.index_difference),
+            constants::GetValues().fridge.left_arm_zeroing.index_difference),
         right_arm_pot_encoder_(
-            constants::GetValues()
-                .right_arm_zeroing_constants.index_difference),
+            constants::GetValues().fridge.right_arm_zeroing.index_difference),
         left_elev_pot_encoder_(
-            constants::GetValues()
-                .left_elevator_zeroing_constants.index_difference),
+            constants::GetValues().fridge.left_elev_zeroing.index_difference),
         right_elev_pot_encoder_(
-            constants::GetValues()
-                .right_elevator_zeroing_constants.index_difference),
+            constants::GetValues().fridge.right_elev_zeroing.index_difference),
         fridge_queue_(".frc971.control_loops.fridge_queue", 0xe4e05855,
                       ".frc971.control_loops.fridge_queue.goal",
                       ".frc971.control_loops.fridge_queue.position",
@@ -48,13 +45,12 @@
         constants::GetValues().fridge.elevator.lower_limit,
         constants::GetValues().fridge.elevator.lower_limit,
         kNoiseScalar *
-            constants::GetValues()
-                .right_elevator_zeroing_constants.index_difference);
+            constants::GetValues().fridge.right_elev_zeroing.index_difference);
     // Initialize the arm.
     SetArmSensors(0.0, 0.0,
                   kNoiseScalar *
                       constants::GetValues()
-                          .right_arm_zeroing_constants.index_difference);
+                          .fridge.right_arm_zeroing.index_difference);
   }
 
   void SetElevatorSensors(double left_start_pos, double right_start_pos,
@@ -123,8 +119,6 @@
   }
 
   void VerifySeparation() {
-    // TODO(danielp): Make sure that we are getting the correct values from the
-    // plant.
     const double left_arm_angle = arm_plant_->Y(0, 0);
     const double right_arm_angle = arm_plant_->Y(1, 0);
     const double left_elev_height = elev_plant_->Y(0, 0);
@@ -235,7 +229,7 @@
 // mechanisms.
 TEST_F(FridgeTest, RespectsRange) {
   // Put the arm up to get it out of the way.
-  // We're going to send the elevator to zero, which should be significantly too
+  // We're going to send the elevator to -5, which should be significantly too
   // low.
   ASSERT_TRUE(fridge_queue_.goal.MakeWithBuilder()
       .angle(M_PI)
diff --git a/frc971/wpilib/wpilib.gyp b/frc971/wpilib/wpilib.gyp
index dcd46c2..0207742 100644
--- a/frc971/wpilib/wpilib.gyp
+++ b/frc971/wpilib/wpilib.gyp
@@ -11,6 +11,7 @@
         '<(AOS)/common/common.gyp:stl_mutex',
         '<(AOS)/build/aos.gyp:logging',
         '<(EXTERNALS):WPILib',
+        '<(DEPTH)/frc971/frc971.gyp:constants',
         '<(DEPTH)/frc971/control_loops/drivetrain/drivetrain.gyp:drivetrain_queue',
         '<(DEPTH)/frc971/control_loops/fridge/fridge.gyp:fridge_queue',
         '<(DEPTH)/frc971/control_loops/claw/claw.gyp:claw_queue',
diff --git a/frc971/wpilib/wpilib_interface.cc b/frc971/wpilib/wpilib_interface.cc
index d950c02..b6a08de 100644
--- a/frc971/wpilib/wpilib_interface.cc
+++ b/frc971/wpilib/wpilib_interface.cc
@@ -17,6 +17,7 @@
 #include "aos/linux_code/init.h"
 #include "aos/common/messages/robot_state.q.h"
 
+#include "frc971/constants.h"
 #include "frc971/control_loops/control_loops.q.h"
 #include "frc971/control_loops/drivetrain/drivetrain.q.h"
 #include "frc971/control_loops/fridge/fridge.q.h"
@@ -56,22 +57,20 @@
 double drivetrain_translate(int32_t in) {
   return static_cast<double>(in) /
          (256.0 /*cpr*/ * 4.0 /*4x*/) *
-         (20.0 / 50.0 /*output stage*/) *
-         // * constants::GetValues().drivetrain_encoder_ratio
+         constants::GetValues().drivetrain_encoder_ratio *
          (4 /*wheel diameter*/ * 2.54 / 100.0 * M_PI);
 }
 
 double arm_translate(int32_t in) {
   return static_cast<double>(in) /
           (512.0 /*cpr*/ * 4.0 /*4x*/) *
-          (14.0 / 17.0 /*output sprockets*/) *
-          (18.0 / 48.0 /*encoder pulleys*/) *
+          constants::GetValues().arm_encoder_ratio *
           (2 * M_PI /*radians*/);
 }
 
 double arm_pot_translate(double voltage) {
   return voltage /
-          (14.0 / 17.0 /*output sprockets*/) *
+          constants::GetValues().arm_pot_ratio *
           (5.0 /*volts*/ / 5.0 /*turns*/) *
           (2 * M_PI /*radians*/);
 }
@@ -79,26 +78,29 @@
 double elevator_translate(int32_t in) {
   return static_cast<double>(in) /
           (512.0 /*cpr*/ * 4.0 /*4x*/) *
-          (14.0 / 84.0 /*output stage*/) *
-          (32 * 5 / 2.54 / 10 /*pulley circumference (in)*/);
+          constants::GetValues().elev_encoder_ratio *
+          (2 * M_PI /*radians*/) *
+          constants::GetValues().elev_distance_per_radian;
 }
 
 double elevator_pot_translate(double voltage) {
   return voltage /
-          (32 * 5 / 2.54 / 10 /*pulley circumference (in)*/) *
+          constants::GetValues().elev_pot_ratio *
+          (2 * M_PI /*radians*/) *
+          constants::GetValues().elev_distance_per_radian *
           (5.0 /*volts*/ / 5.0 /*turns*/);
 }
 
 double claw_translate(int32_t in) {
   return static_cast<double>(in) /
           (512.0 /*cpr*/ * 4.0 /*4x*/) *
-          (16.0 / 72.0 /*output sprockets*/) *
+          constants::GetValues().claw_encoder_ratio *
           (2 * M_PI /*radians*/);
 }
 
 double claw_pot_translate(double voltage) {
   return voltage /
-          (16.0 / 72.0 /*output sprockets*/) *
+          constants::GetValues().claw_pot_ratio *
           (5.0 /*volts*/ / 5.0 /*turns*/) *
           (2 * M_PI /*radians*/);
 }