Templatize interpolation table to make it more geneirc.
Change-Id: I7da0698486775b3e2482fa99fa172d6e1b6028ac
diff --git a/y2017/constants.cc b/y2017/constants.cc
index 2e97b9e..802c57d 100644
--- a/y2017/constants.cc
+++ b/y2017/constants.cc
@@ -88,12 +88,12 @@
// TODO(phil): Should these be different per robot?
*shot_interpolation_table =
- ::frc971::shooter_interpolation::InterpolationTable(
+ ::frc971::shooter_interpolation::InterpolationTable<Values::ShotParams>(
{// { distance_to_target, { shot_angle, shot_power }},
- {1.67, {0.31, 320.0}},
- {1.90, {0.33, 330.0}},
- {2.15, {0.33, 347.0}},
- {2.45, {0.33, 361.0}},
+ {1.67, {0.31, 320.0, -2.25 * M_PI}},
+ {1.90, {0.33, 330.0, -2.25 * M_PI}},
+ {2.15, {0.33, 347.0, -2.25 * M_PI}},
+ {2.45, {0.33, 361.0, -2.25 * M_PI}},
});
switch (team) {
@@ -190,5 +190,12 @@
return *values[team_number];
}
+Values::ShotParams Values::ShotParams::BlendY(double coefficient, Values::ShotParams a1, Values::ShotParams a2) {
+ using ::frc971::shooter_interpolation::Blend;
+ return Values::ShotParams{Blend(coefficient, a1.angle, a2.angle),
+ Blend(coefficient, a1.power, a2.power),
+ Blend(coefficient, a1.indexer_velocity, a2.indexer_velocity)};
+}
+
} // namespace constants
} // namespace y2017