Tune shot table for close up

We needed more points, and I think we tuned for the wrong distance once.

Change-Id: I8e02d7400f0bc67bd3e5471795a974bd9b363596
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/y2020/constants.cc b/y2020/constants.cc
index 013cac1..740dc8c 100644
--- a/y2020/constants.cc
+++ b/y2020/constants.cc
@@ -33,8 +33,11 @@
   // keep it constant.
   constexpr double kVelocityFinisher = 350.0;
   r->shot_interpolation_table =
-      InterpolationTable<Values::ShotParams>({{1.4732, {0.10, 10.6}},
-                                              {3.50, {0.48, 13.2}},
+      InterpolationTable<Values::ShotParams>({{1.0, {0.01, 10.7}},
+                                              {1.2, {0.01, 10.7}},
+                                              {1.4732, {0.10, 10.6}},
+                                              {2.5, {0.36, 12.0}},
+                                              {3.50, {0.43, 13.2}},
                                               {4.7371, {0.535, 14.2}},
                                               {5.27, {0.53, 14.55}},
                                               {6.332, {0.53, 15.2}},
diff --git a/y2020/control_loops/superstructure/turret/aiming.cc b/y2020/control_loops/superstructure/turret/aiming.cc
index 841f1a3..2cc2ce0 100644
--- a/y2020/control_loops/superstructure/turret/aiming.cc
+++ b/y2020/control_loops/superstructure/turret/aiming.cc
@@ -72,7 +72,7 @@
 // Minimum distance that we must be from the inner port in order to attempt the
 // shot--this is to account for the fact that if we are too close to the target,
 // then we won't have a clear shot on the inner port.
-constexpr double kMinimumInnerPortShotDistance = 3.5;
+constexpr double kMinimumInnerPortShotDistance = 3.9;
 
 // Amount of buffer, in radians, to leave to help avoid wrapping. I.e., any time
 // that we are in kAvoidEdges mode, we will keep ourselves at least
@@ -165,13 +165,13 @@
   const double ydot = linear_angular(0) * std::sin(status->theta());
 
   const double inner_port_angle = robot_pose_from_inner_port.heading();
-  const double inner_port_distance = robot_pose_from_inner_port.xy_norm();
+  const double inner_port_distance = robot_pose_from_inner_port.rel_pos().x();
   // Add a bit of hysteresis so that we don't jump between aiming for the inner
   // and outer ports.
   const double max_inner_port_angle =
       aiming_for_inner_port_ ? 1.2 * kMaxInnerPortAngle : kMaxInnerPortAngle;
   const double min_inner_port_distance =
-      aiming_for_inner_port_ ? 0.8 * kMinimumInnerPortShotDistance
+      aiming_for_inner_port_ ? (kMinimumInnerPortShotDistance - 0.3)
                              : kMinimumInnerPortShotDistance;
   aiming_for_inner_port_ =
       (std::abs(inner_port_angle) < max_inner_port_angle) &&
diff --git a/y2020/joystick_reader.cc b/y2020/joystick_reader.cc
index 9934571..34d3f54 100644
--- a/y2020/joystick_reader.cc
+++ b/y2020/joystick_reader.cc
@@ -43,9 +43,11 @@
 const ButtonLocation kAutoNoHood(3, 5);
 const ButtonLocation kHood(3, 4);
 const ButtonLocation kShootSlow(4, 2);
+const ButtonLocation kFixedTurret(3, 1);
 const ButtonLocation kFeed(4, 1);
 const ButtonLocation kFeedDriver(1, 2);
 const ButtonLocation kIntakeExtend(3, 9);
+const ButtonLocation kIntakeExtendDriver(1, 4);
 const ButtonLocation kIntakeIn(4, 4);
 const ButtonLocation kSpit(4, 3);
 const ButtonLocation kLocalizerReset(3, 8);
@@ -111,8 +113,7 @@
     double climber_speed = 0.0;
     bool preload_intake = false;
 
-    const bool auto_track =
-        data.IsPressed(kAutoTrack) || data.IsPressed(kAutoNoHood);
+    const bool auto_track = data.IsPressed(kAutoTrack);
 
     if (data.IsPressed(kHood)) {
       hood_pos = 0.45;
@@ -130,7 +131,12 @@
       turret_pos = 0.0;
     }
 
-    if (data.IsPressed(kShootFast)) {
+    if (data.IsPressed(kAutoNoHood)) {
+      if (setpoint_fetcher_.get()) {
+        accelerator_speed = setpoint_fetcher_->accelerator();
+        finisher_speed = setpoint_fetcher_->finisher();
+      }
+    } else if (data.IsPressed(kShootFast)) {
       if (setpoint_fetcher_.get()) {
         accelerator_speed = setpoint_fetcher_->accelerator();
         finisher_speed = setpoint_fetcher_->finisher();
@@ -143,7 +149,7 @@
       finisher_speed = 300.0;
     }
 
-    if (data.IsPressed(kIntakeExtend)) {
+    if (data.IsPressed(kIntakeExtend) || data.IsPressed(kIntakeExtendDriver)) {
       intake_pos = 1.2;
       roller_speed = 7.0f;
       roller_speed_compensation = 2.0f;
@@ -210,10 +216,14 @@
                                                data.IsPressed(kFeedDriver));
       superstructure_goal_builder.add_climber_voltage(climber_speed);
 
-      superstructure_goal_builder.add_turret_tracking(auto_track);
+      superstructure_goal_builder.add_turret_tracking(
+          !data.IsPressed(kFixedTurret));
       superstructure_goal_builder.add_hood_tracking(
-          auto_track && !data.IsPressed(kAutoNoHood));
-      superstructure_goal_builder.add_shooter_tracking(auto_track);
+          !data.IsPressed(kFixedTurret) && !data.IsPressed(kAutoNoHood));
+      superstructure_goal_builder.add_shooter_tracking(
+          auto_track ||
+          (!data.IsPressed(kFixedTurret) && !data.IsPressed(kAutoNoHood) &&
+           data.IsPressed(kFeedDriver)));
       superstructure_goal_builder.add_intake_preloading(preload_intake);
 
       if (!builder.Send(superstructure_goal_builder.Finish())) {