Added superstructure gear ratios.
Change-Id: I128082460ae62beaafab04f23579494aa25f46ba
diff --git a/y2016/constants.cc b/y2016/constants.cc
index 4f87312..3e228e8 100644
--- a/y2016/constants.cc
+++ b/y2016/constants.cc
@@ -50,19 +50,6 @@
const double kRobotWidth = 25.0 / 100.0 * 2.54;
-// TODO(comran): Remove comments from ratios for pots when they are actually
-// used.
-const double kIntakeEncoderRatio = 18.0 / 48.0 * 16.0 / 72.0;
-//const double kIntakePotRatio = 48.0 / 48.0 * 16.0 / 72.0;
-const double kShoulderEncoderRatio = 18.0 / 48.0 * 16.0 / 72.0;
-//const double kShoulderPotRatio = 48.0 / 48.0 * 16.0 / 72.0;
-const double kWristEncoderRatio = 18.0 / 48.0 * 16.0 / 72.0;
-//const double kWristPotRatio = 48.0 / 48.0 * 16.0 / 72.0;
-
-const double kIntakeEncoderIndexDifference = 2.0 * M_PI * kIntakeEncoderRatio;
-const double kShoulderEncoderIndexDifference = 2.0 * M_PI * kShoulderEncoderRatio;
-const double kWristEncoderIndexDifference = 2.0 * M_PI * kWristEncoderRatio;
-
const int kZeroingSampleSize = 200;
const Values *DoGetValuesForTeam(uint16_t team) {
@@ -81,20 +68,20 @@
// Intake
{
- {-M_PI - 0.05, M_PI + 0.05, -M_PI, M_PI},
- {kZeroingSampleSize, kIntakeEncoderIndexDifference, 0.9, 0.3},
+ {-M_PI - 0.05, M_PI + 0.05, -M_PI, M_PI},
+ {kZeroingSampleSize, INTAKE_ENCODER_INDEX_DIFFERENCE, 0.9, 0.3},
},
// Shoulder
{
- {-M_PI - 0.05, M_PI + 0.05, -M_PI, M_PI},
- {kZeroingSampleSize, kShoulderEncoderIndexDifference, 0.9, 0.3},
+ {-M_PI - 0.05, M_PI + 0.05, -M_PI, M_PI},
+ {kZeroingSampleSize, SHOULDER_ENCODER_INDEX_DIFFERENCE, 0.9, 0.3},
},
// Wrist
{
- {-M_PI - 0.05, M_PI + 0.05, -M_PI, M_PI},
- {kZeroingSampleSize, kWristEncoderIndexDifference, 0.9, 0.3},
+ {-M_PI - 0.05, M_PI + 0.05, -M_PI, M_PI},
+ {kZeroingSampleSize, WRIST_ENCODER_INDEX_DIFFERENCE, 0.9, 0.3},
},
};
break;
@@ -112,20 +99,20 @@
// Intake
{
- {-M_PI - 0.05, M_PI + 0.05, -M_PI, M_PI},
- {kZeroingSampleSize, kIntakeEncoderIndexDifference, 0.9, 0.3},
+ {-M_PI - 0.05, M_PI + 0.05, -M_PI, M_PI},
+ {kZeroingSampleSize, INTAKE_ENCODER_INDEX_DIFFERENCE, 0.9, 0.3},
},
// Shoulder
{
- {-M_PI - 0.05, M_PI + 0.05, -M_PI, M_PI},
- {kZeroingSampleSize, kShoulderEncoderIndexDifference, 0.9, 0.3},
+ {-M_PI - 0.05, M_PI + 0.05, -M_PI, M_PI},
+ {kZeroingSampleSize, SHOULDER_ENCODER_INDEX_DIFFERENCE, 0.9, 0.3},
},
// Wrist
{
- {-M_PI - 0.05, M_PI + 0.05, -M_PI, M_PI},
- {kZeroingSampleSize, kWristEncoderIndexDifference, 0.9, 0.3},
+ {-M_PI - 0.05, M_PI + 0.05, -M_PI, M_PI},
+ {kZeroingSampleSize, WRIST_ENCODER_INDEX_DIFFERENCE, 0.9, 0.3},
},
};
break;
@@ -143,20 +130,20 @@
// Intake
{
- {-M_PI - 0.05, M_PI + 0.05, -M_PI, M_PI},
- {kZeroingSampleSize, kIntakeEncoderIndexDifference, 0.9, 0.3},
+ {-M_PI - 0.05, M_PI + 0.05, -M_PI, M_PI},
+ {kZeroingSampleSize, INTAKE_ENCODER_INDEX_DIFFERENCE, 0.9, 0.3},
},
// Shoulder
{
- {-M_PI - 0.05, M_PI + 0.05, -M_PI, M_PI},
- {kZeroingSampleSize, kShoulderEncoderIndexDifference, 0.9, 0.3},
+ {-M_PI - 0.05, M_PI + 0.05, -M_PI, M_PI},
+ {kZeroingSampleSize, SHOULDER_ENCODER_INDEX_DIFFERENCE, 0.9, 0.3},
},
// Wrist
{
- {-M_PI - 0.05, M_PI + 0.05, -M_PI, M_PI},
- {kZeroingSampleSize, kWristEncoderIndexDifference, 0.9, 0.3},
+ {-M_PI - 0.05, M_PI + 0.05, -M_PI, M_PI},
+ {kZeroingSampleSize, WRIST_ENCODER_INDEX_DIFFERENCE, 0.9, 0.3},
},
};
break;
diff --git a/y2016/constants.h b/y2016/constants.h
index 44136a9..202b436 100644
--- a/y2016/constants.h
+++ b/y2016/constants.h
@@ -7,6 +7,18 @@
#include "frc971/shifter_hall_effect.h"
#include "frc971/constants.h"
+#define INTAKE_ENCODER_RATIO (16.0 / 58.0 * 18.0 / 72.0 * 14.0 / 64.0)
+#define INTAKE_POT_RATIO (16.0 / 58.0)
+#define INTAKE_ENCODER_INDEX_DIFFERENCE (2.0 * M_PI * INTAKE_ENCODER_RATIO)
+
+#define SHOULDER_ENCODER_RATIO (16.0 / 58.0 * 18.0 / 72.0 * 14.0 / 64.0)
+#define SHOULDER_POT_RATIO (16.0 / 58.0)
+#define SHOULDER_ENCODER_INDEX_DIFFERENCE (2.0 * M_PI * SHOULDER_ENCODER_RATIO)
+
+#define WRIST_ENCODER_RATIO (16.0 / 48.0 * 18.0 / 64.0 * 14.0 / 54.0)
+#define WRIST_POT_RATIO (16.0 / 48.0)
+#define WRIST_ENCODER_INDEX_DIFFERENCE (2.0 * M_PI * WRIST_ENCODER_RATIO)
+
namespace y2016 {
namespace constants {
diff --git a/y2016/control_loops/superstructure/superstructure_lib_test.cc b/y2016/control_loops/superstructure/superstructure_lib_test.cc
index f168fb3..0db3112 100644
--- a/y2016/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2016/control_loops/superstructure/superstructure_lib_test.cc
@@ -80,9 +80,9 @@
SuperstructureSimulation()
: intake_plant_(new IntakePlant(MakeIntakePlant())),
plant_arm_(new ArmPlant(MakeArmPlant())),
- pot_encoder_intake_(0.0),
- pot_encoder_shoulder_(0.0),
- pot_encoder_wrist_(0.0),
+ pot_encoder_intake_(INTAKE_ENCODER_INDEX_DIFFERENCE),
+ pot_encoder_shoulder_(SHOULDER_ENCODER_INDEX_DIFFERENCE),
+ pot_encoder_wrist_(WRIST_ENCODER_INDEX_DIFFERENCE),
superstructure_queue_(".y2016.control_loops.superstructure", 0x0,
".y2016.control_loops.superstructure.goal",
".y2016.control_loops.superstructure.status",