Split shooter interpolation into two stages
Interpolation table 1: shot distance to hood angle and
ball muzzle velocity.
Interpolation table 2: ball muzzle velocity to finisher and
accelerator velocities.
Signed-off-by: milind-u <milind.upadhyay@gmail.com>
Change-Id: Id7f6ed52de5fb4b54e1e577b73a47168f8578179
diff --git a/y2020/control_loops/superstructure/superstructure.cc b/y2020/control_loops/superstructure/superstructure.cc
index 98de31d..70ea319 100644
--- a/y2020/control_loops/superstructure/superstructure.cc
+++ b/y2020/control_loops/superstructure/superstructure.cc
@@ -72,15 +72,18 @@
aos::FlatbufferFixedAllocatorArray<ShooterGoal, 64> shooter_goal;
constants::Values::ShotParams shot_params;
+ constants::Values::FlywheelShotParams flywheel_shot_params;
if (constants::GetValues().shot_interpolation_table.GetInRange(
- distance_to_goal, &shot_params)) {
+ distance_to_goal, &shot_params) &&
+ constants::GetValues().flywheel_shot_interpolation_table.GetInRange(
+ shot_params.velocity_ball, &flywheel_shot_params)) {
hood_goal.Finish(frc971::control_loops::
CreateStaticZeroingSingleDOFProfiledSubsystemGoal(
*hood_goal.fbb(), shot_params.hood_angle));
- shooter_goal.Finish(CreateShooterGoal(*shooter_goal.fbb(),
- shot_params.accelerator_power,
- shot_params.finisher_power));
+ shooter_goal.Finish(CreateShooterGoal(
+ *shooter_goal.fbb(), flywheel_shot_params.velocity_accelerator,
+ flywheel_shot_params.velocity_finisher));
} else {
hood_goal.Finish(
frc971::control_loops::