Complete shooter interpolation table
Signed-off-by: milind-u <milind.upadhyay@gmail.com>
Change-Id: I64786e0f854bdfc75b0a9643d31f4ca6063e4ef0
diff --git a/y2020/constants.cc b/y2020/constants.cc
index 1336411..ea12b46 100644
--- a/y2020/constants.cc
+++ b/y2020/constants.cc
@@ -33,17 +33,18 @@
::frc971::zeroing::AbsoluteAndAbsoluteEncoderZeroingEstimator>
*const hood = &r->hood;
- constexpr double kFeetToMeters = 0.0254 * 12.0;
- // Approximate robot length, for converting estimates from the doc below.
- // Rounded up from exact estimate, since I'm not sure if the original estimate
- // includes bumpers.
- constexpr double kRobotLength = 0.9;
+ constexpr double kInchesToMeters = 0.0254;
+ // Approximate length from the front bumpers to the middle of the robot.
+ constexpr double kHalfRobotLength = (36.00 / 2) * kInchesToMeters;
// We found that the finisher velocity does not change ball velocity much, so
// keep it constant.
constexpr double kVelocityFinisher = 350.0;
r->shot_interpolation_table = InterpolationTable<Values::ShotParams>(
- {{7.6 * kFeetToMeters + kRobotLength, {0.31, 16.9}},
- {12.6 * kFeetToMeters + kRobotLength, {0.4, 20.4}}});
+ {{40.00 * kInchesToMeters + kHalfRobotLength, {0.1, 10.6}},
+ {113.5 * kInchesToMeters + kHalfRobotLength, {0.42, 13.2}},
+ {168.5 * kInchesToMeters + kHalfRobotLength, {0.51, 13.2}},
+ {231.3 * kInchesToMeters + kHalfRobotLength, {0.51, 13.2}},
+ {276.5 * kInchesToMeters + kHalfRobotLength, {0.53, 13.2}}});
r->flywheel_shot_interpolation_table =
InterpolationTable<Values::FlywheelShotParams>(
diff --git a/y2020/control_loops/superstructure/superstructure_lib_test.cc b/y2020/control_loops/superstructure/superstructure_lib_test.cc
index a54c89c..28c4bf5 100644
--- a/y2020/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2020/control_loops/superstructure/superstructure_lib_test.cc
@@ -1085,9 +1085,8 @@
constants::Values::kHoodRange().upper, 0.001);
}
-// TODO(milind): Add correct values and enable this once interpolation tables
-// have been filled out
-TEST_P(SuperstructureAllianceTest, DISABLED_ShooterInterpolationInRange) {
+// Test a value in range with auto tracking
+TEST_P(SuperstructureAllianceTest, ShooterInterpolationInRange) {
SetEnabled(true);
const frc971::control_loops::Pose target = turret::OuterPortPose(GetParam());
WaitUntilZeroed();
@@ -1142,15 +1141,15 @@
EXPECT_GE(superstructure_status_fetcher_->shooter()
->accelerator_left()
->angular_velocity_goal(),
- 100.0);
+ 250.0);
EXPECT_GE(superstructure_status_fetcher_->shooter()
->accelerator_right()
->angular_velocity_goal(),
- 100.0);
- EXPECT_GE(superstructure_status_fetcher_->shooter()
- ->finisher()
- ->angular_velocity_goal(),
- 100.0);
+ 250.0);
+ EXPECT_DOUBLE_EQ(superstructure_status_fetcher_->shooter()
+ ->finisher()
+ ->angular_velocity_goal(),
+ 350.0);
EXPECT_GE(superstructure_status_fetcher_->hood()->position(),
constants::Values::kHoodRange().lower);
}