3 tote auto now works.

Change-Id: I61bf7a31feab1a9768e115be3cc204c08b564d50
diff --git a/frc971/autonomous/auto.cc b/frc971/autonomous/auto.cc
index ecf760d..42f4ca9 100644
--- a/frc971/autonomous/auto.cc
+++ b/frc971/autonomous/auto.cc
@@ -16,6 +16,7 @@
 #include "frc971/control_loops/fridge/fridge.q.h"
 #include "frc971/actors/pickup_actor.h"
 #include "frc971/actors/stack_actor.h"
+#include "frc971/actors/held_to_lift_actor.h"
 
 using ::aos::time::Time;
 using ::frc971::control_loops::claw_queue;
@@ -28,7 +29,16 @@
 constexpr double kClawAutoVelocity = 3.00;
 constexpr double kClawAutoAcceleration = 6.0;
 constexpr double kAngleEpsilon = 0.10;
-double kClawTotePackAngle = 0.95;
+const double kClawTotePackAngle = 0.90;
+const double kArmRaiseLowerClearance = -0.08;
+const double kClawStackClearance = 0.55;
+const double kStackUpHeight = 0.60;
+const double kStackUpArm = 0.0;
+
+struct ProfileParams {
+  double velocity;
+  double acceleration;
+};
 
 namespace time = ::aos::time;
 
@@ -69,47 +79,12 @@
       .Send();
 }
 
-void DriveSpin(double radians) {
-  LOG(INFO, "going to spin %f\n", radians);
-
-  // TODO(sensors): update this time thing maybe?
-  ::aos::util::TrapezoidProfile profile(::aos::time::Time::InMS(10));
-  ::Eigen::Matrix<double, 2, 1> driveTrainState;
-  const double goal_velocity = 0.0;
-  const double epsilon = 0.01;
-  // in drivetrain "meters"
-  const double kRobotWidth = 0.4544;
-
-  profile.set_maximum_acceleration(1.5);
-  profile.set_maximum_velocity(0.8);
-
-  const double side_offset = kRobotWidth * radians / 2.0;
-
-  while (true) {
-    ::aos::time::PhasedLoopXMS(5, 2500);
-    driveTrainState = profile.Update(side_offset, goal_velocity);
-
-    if (::std::abs(driveTrainState(0, 0) - side_offset) < epsilon) break;
-    if (ShouldExitAuto()) return;
-
-    LOG(DEBUG, "Driving left to %f, right to %f\n",
-        left_initial_position - driveTrainState(0, 0),
-        right_initial_position + driveTrainState(0, 0));
-    control_loops::drivetrain_queue.goal.MakeWithBuilder()
-        .control_loop_driving(true)
-        //.highgear(false)
-        .left_goal(left_initial_position - driveTrainState(0, 0))
-        .right_goal(right_initial_position + driveTrainState(0, 0))
-        .left_velocity_goal(-driveTrainState(1, 0))
-        .right_velocity_goal(driveTrainState(1, 0))
-        .Send();
+void WaitUntilDoneOrCanceled(
+    ::std::unique_ptr<aos::common::actions::Action> action) {
+  if (!action) {
+    LOG(ERROR, "No action, not waiting\n");
+    return;
   }
-  left_initial_position -= side_offset;
-  right_initial_position += side_offset;
-  LOG(INFO, "Done moving\n");
-}
-
-void WaitUntilDoneOrCanceled(aos::common::actions::Action *action) {
   while (true) {
     // Poll the running bit and auto done bits.
     ::aos::time::PhasedLoopXMS(5, 2500);
@@ -119,9 +94,51 @@
   }
 }
 
+void StepDrive(double distance, double theta) {
+  double left_goal = (left_initial_position + distance -
+                      theta * constants::GetValues().turn_width / 2.0);
+  double right_goal = (right_initial_position + distance +
+                       theta * constants::GetValues().turn_width / 2.0);
+  control_loops::drivetrain_queue.goal.MakeWithBuilder()
+      .control_loop_driving(true)
+      .left_goal(left_goal)
+      .right_goal(right_goal)
+      .left_velocity_goal(0.0)
+      .right_velocity_goal(0.0)
+      .Send();
+  left_initial_position = left_goal;
+  right_initial_position = right_goal;
+}
+
+void WaitUntilNear(double distance) {
+  while (true) {
+    if (ShouldExitAuto()) return;
+    control_loops::drivetrain_queue.status.FetchAnother();
+    double left_error = ::std::abs(
+        left_initial_position -
+        control_loops::drivetrain_queue.status->filtered_left_position);
+    double right_error = ::std::abs(
+        right_initial_position -
+        control_loops::drivetrain_queue.status->filtered_right_position);
+    const double kPositionThreshold = 0.05 + distance;
+    if (right_error < kPositionThreshold && left_error < kPositionThreshold) {
+      LOG(INFO, "At the goal\n");
+      return;
+    }
+  }
+}
+
+const ProfileParams kFastDrive = {2.0, 3.5};
+const ProfileParams kFastKnockDrive = {2.0, 3.0};
+const ProfileParams kStackingDrive = {2.0, 1.5};
+const ProfileParams kFastTurn = {3.0, 10.0};
+const ProfileParams kComboTurn = {1.2, 8.0};
+const ProfileParams kRaceTurn = {4.0, 10.0};
+const ProfileParams kRaceDrive = {2.0, 2.0};
+const ProfileParams kRaceBackupDrive = {2.0, 5.0};
+
 ::std::unique_ptr<::frc971::actors::DrivetrainAction> SetDriveGoal(
-    double distance, bool slow_acceleration, double maximum_velocity = 0.7,
-    double theta = 0) {
+    double distance, const ProfileParams drive_params, double theta = 0, const ProfileParams &turn_params = kFastTurn) {
   LOG(INFO, "Driving to %f\n", distance);
 
   ::frc971::actors::DrivetrainActionParams params;
@@ -129,8 +146,10 @@
   params.right_initial_position = right_initial_position;
   params.y_offset = distance;
   params.theta_offset = theta;
-  params.maximum_velocity = maximum_velocity;
-  params.maximum_acceleration = slow_acceleration ? 0.3 : 0.2;
+  params.maximum_turn_acceleration = turn_params.acceleration;
+  params.maximum_turn_velocity = turn_params.velocity;
+  params.maximum_velocity = drive_params.velocity;
+  params.maximum_acceleration = drive_params.acceleration;
   auto drivetrain_action = actors::MakeDrivetrainAction(params);
 
   drivetrain_action->Start();
@@ -141,31 +160,135 @@
   return ::std::move(drivetrain_action);
 }
 
-void InitializeEncoders() {
-  control_loops::drivetrain_queue.status.FetchLatest();
-  while (!control_loops::drivetrain_queue.status.get()) {
-    LOG(WARNING,
-        "No previous drivetrain position packet, trying to fetch again\n");
-    control_loops::drivetrain_queue.status.FetchNextBlocking();
+const ProfileParams kFridgeYProfile{1.0, 4.0};
+const ProfileParams kFridgeXProfile{1.0, 2.0};
+const ProfileParams kFridgeFastXProfile{1.2, 5.0};
+
+static double fridge_goal_x = 0.0;
+static double fridge_goal_y = 0.0;
+
+void MoveFridge(double x, double y, bool grabbers, const ProfileParams x_params,
+                const ProfileParams y_params) {
+  auto new_fridge_goal = fridge_queue.goal.MakeMessage();
+  new_fridge_goal->profiling_type = 1;
+
+  new_fridge_goal->max_y_velocity = y_params.velocity;
+  new_fridge_goal->max_y_acceleration = y_params.acceleration;
+  new_fridge_goal->y = y;
+  fridge_goal_y = y;
+  new_fridge_goal->y_velocity = 0.0;
+
+  new_fridge_goal->max_x_velocity = x_params.velocity;
+  new_fridge_goal->max_x_acceleration = x_params.acceleration;
+  new_fridge_goal->x = x;
+  fridge_goal_x = x;
+  new_fridge_goal->x_velocity = 0.0;
+
+  new_fridge_goal->grabbers.top_front = grabbers;
+  new_fridge_goal->grabbers.top_back = grabbers;
+  new_fridge_goal->grabbers.bottom_front = grabbers;
+  new_fridge_goal->grabbers.bottom_back = grabbers;
+
+  if (!new_fridge_goal.Send()) {
+    LOG(ERROR, "Sending fridge goal failed.\n");
+    return;
   }
+}
+
+void WaitForFridge() {
+  while (true) {
+    if (ShouldExitAuto()) return;
+    control_loops::fridge_queue.status.FetchAnother();
+
+    constexpr double kProfileError = 1e-5;
+    constexpr double kXEpsilon = 0.03, kYEpsilon = 0.03;
+
+    if (control_loops::fridge_queue.status->state != 4) {
+      LOG(ERROR, "Fridge no longer running, aborting action\n");
+      return;
+    }
+
+    if (::std::abs(control_loops::fridge_queue.status->goal_x - fridge_goal_x) <
+            kProfileError &&
+        ::std::abs(control_loops::fridge_queue.status->goal_y - fridge_goal_y) <
+            kProfileError &&
+        ::std::abs(control_loops::fridge_queue.status->goal_x_velocity) <
+            kProfileError &&
+        ::std::abs(control_loops::fridge_queue.status->goal_y_velocity) <
+            kProfileError) {
+      LOG(INFO, "Profile done.\n");
+      if (::std::abs(control_loops::fridge_queue.status->x - fridge_goal_x) <
+              kXEpsilon &&
+          ::std::abs(control_loops::fridge_queue.status->y - fridge_goal_y) <
+              kYEpsilon) {
+        LOG(INFO, "Near goal, done.\n");
+        return;
+      }
+    }
+  }
+}
+
+void InitializeEncoders() {
+  control_loops::drivetrain_queue.status.FetchAnother();
   left_initial_position =
       control_loops::drivetrain_queue.status->filtered_left_position;
   right_initial_position =
       control_loops::drivetrain_queue.status->filtered_right_position;
 }
 
-void SetClawState(double angle, double intake_voltage, double rollers_closed) {
+void WaitForClawZero() {
+  LOG(INFO, "Waiting for claw to zero.\n");
+  while (true) {
+    control_loops::claw_queue.status.FetchAnother();
+    LOG_STRUCT(DEBUG, "Got claw status", *control_loops::claw_queue.status);
+    if (control_loops::claw_queue.status->zeroed) {
+      LOG(INFO, "Claw zeroed\n");
+      return;
+    }
+
+    if (ShouldExitAuto()) return;
+  }
+}
+
+void WaitForFridgeZero() {
+  LOG(INFO, "Waiting for claw to zero.\n");
+  while (true) {
+    control_loops::fridge_queue.status.FetchAnother();
+    LOG_STRUCT(DEBUG, "Got fridge status", *control_loops::fridge_queue.status);
+    if (control_loops::fridge_queue.status->zeroed) {
+      LOG(INFO, "Fridge zeroed\n");
+      return;
+    }
+
+    if (ShouldExitAuto()) return;
+  }
+}
+
+constexpr ProfileParams kDefaultClawParams = {kClawAutoVelocity,
+                                              kClawAutoAcceleration};
+
+// Move the claw in a very small number of cycles.
+constexpr ProfileParams kInstantaneousClaw = {100.0, 100.0};
+constexpr ProfileParams kFastClaw = {8.0, 20.0};
+
+void SetClawStateNoWait(double angle, double intake_voltage,
+                        double rollers_closed,
+                        const ProfileParams &claw_params = kDefaultClawParams) {
   auto message = control_loops::claw_queue.goal.MakeMessage();
   message->angle = angle;
-  message->max_velocity = kClawAutoVelocity;
-  message->max_acceleration = kClawAutoAcceleration;
+  message->max_velocity = claw_params.velocity;
+  message->max_acceleration = claw_params.acceleration;
   message->angular_velocity = 0.0;
   message->intake = intake_voltage;
   message->rollers_closed = rollers_closed;
 
   LOG_STRUCT(DEBUG, "Sending claw goal", *message);
   message.Send();
+}
 
+void SetClawState(double angle, double intake_voltage, double rollers_closed,
+                  const ProfileParams &claw_params = kDefaultClawParams) {
+  SetClawStateNoWait(angle, intake_voltage, rollers_closed, claw_params);
   while (true) {
     control_loops::claw_queue.status.FetchAnother();
     const double current_angle = control_loops::claw_queue.status->angle;
@@ -177,74 +300,37 @@
     if (::std::abs(current_angle - angle) < kAngleEpsilon) {
       break;
     }
+    if (ShouldExitAuto()) return;
   }
 }
 
 void HandleAuto() {
   ::aos::time::Time start_time = ::aos::time::Time::Now();
-  LOG(INFO, "Handling auto mode at %f\n", start_time.ToSeconds());
+  LOG(INFO, "Starting auto mode at %f\n", start_time.ToSeconds());
   ::std::unique_ptr<::frc971::actors::DrivetrainAction> drive;
   ::std::unique_ptr<::frc971::actors::PickupAction> pickup;
   ::std::unique_ptr<::frc971::actors::StackAction> stack;
-  // TODO(austin): Score!
-  //::std::unique_ptr<ScoreAction> score;
-
-  ResetDrivetrain();
+  ::std::unique_ptr<::frc971::actors::HeldToLiftAction> lift;
 
   if (ShouldExitAuto()) return;
   InitializeEncoders();
+  ResetDrivetrain();
 
-  time::SleepFor(time::Time::InSeconds(0.45));
+  WaitForClawZero();
+  WaitForFridgeZero();
 
-  if (!drivetrain_queue.goal.MakeWithBuilder()
-           .steering(0)
-           .throttle(0.5)
-           .quickturn(false)
-           .control_loop_driving(false)
-           .Send()) {
-    LOG(WARNING, "sending drivetrain goal failed\n");
-  }
-  time::SleepFor(time::Time::InSeconds(1.0));
-  if (!drivetrain_queue.goal.MakeWithBuilder()
-           .steering(0)
-           .throttle(0)
-           .quickturn(false)
-           .control_loop_driving(false)
-           .Send()) {
-    LOG(WARNING, "sending drivetrain goal failed\n");
-  }
+  // Initialize the fridge.
+  MoveFridge(0.0, 0.3, true, kFridgeXProfile, kFridgeYProfile);
 
-  return;
+  LOG(INFO, "Lowering claw into position.\n");
+  SetClawState(0.0, 2.0, false, kInstantaneousClaw);
+  LOG(INFO, "Sucking in tote.\n");
+  SetClawState(0.0, 5.0, true, kInstantaneousClaw);
 
-  {
-    auto new_fridge_goal = fridge_queue.goal.MakeMessage();
-    new_fridge_goal->max_velocity = 0.0;
-    new_fridge_goal->max_acceleration = 0.0;
-    new_fridge_goal->profiling_type = 0;
-    new_fridge_goal->height = 0.3;
-    new_fridge_goal->velocity = 0.0;
-    new_fridge_goal->max_angular_velocity = 0.0;
-    new_fridge_goal->max_angular_acceleration = 0.0;
-    new_fridge_goal->angle = 0.0;
-    new_fridge_goal->angular_velocity = 0.0;
-    new_fridge_goal->grabbers.top_front = true;
-    new_fridge_goal->grabbers.top_back = true;
-    new_fridge_goal->grabbers.bottom_front = true;
-    new_fridge_goal->grabbers.bottom_back = true;
+  time::SleepFor(time::Time::InSeconds(0.7));
+  LOG(INFO, "Done sucking in tote\n");
 
-    if (!new_fridge_goal.Send()) {
-      LOG(ERROR, "Sending fridge goal failed.\n");
-      return;
-    }
-  }
-
-  // Pick up the tote.
-  SetClawState(0.0, 7.0, true);
-  if (ShouldExitAuto()) return;
-  time::SleepFor(time::Time::InSeconds(0.1));
-  if (ShouldExitAuto()) return;
-
-  // now pick it up
+  // Now pick it up
   {
     actors::PickupParams params;
     // Lift to here initially.
@@ -255,56 +341,216 @@
     params.suck_angle_finish = 0.4;
     // Pack the box back in here.
     params.pickup_finish_angle = kClawTotePackAngle;
-    params.intake_time = 0.8;
-    params.intake_voltage = 7.0;
+    params.intake_time = 0.60;
+    params.intake_voltage = 6.5;
     pickup = actors::MakePickupAction(params);
     pickup->Start();
-    WaitUntilDoneOrCanceled(pickup.get());
   }
+
+  time::SleepFor(time::Time::InSeconds(0.9));
+  // Start turning.
+  LOG(INFO, "Turning in place\n");
+  drive = SetDriveGoal(0.0, kFastDrive, -0.18);
+
+  WaitUntilDoneOrCanceled(::std::move(drive));
   if (ShouldExitAuto()) return;
 
-  drive = SetDriveGoal(1.0, false);
-  WaitUntilDoneOrCanceled(drive.get());
+  LOG(INFO, "Now driving next to the can\n");
+  drive = SetDriveGoal(0.60, kFastDrive);
 
-  SetClawState(0.0, 0.0, true);
-  return;
+  WaitUntilDoneOrCanceled(::std::move(pickup));
+  if (ShouldExitAuto()) return;
+
+  // Now grab it in the fridge.
+  {
+    actors::StackParams params;
+
+    params.claw_out_angle = kClawTotePackAngle;
+    params.bottom = 0.020;
+    params.only_place = false;
+    params.arm_clearance = kArmRaiseLowerClearance;
+    params.over_box_before_place_height = 0.39;
+
+    stack = actors::MakeStackAction(params);
+    stack->Start();
+  }
+  WaitUntilDoneOrCanceled(::std::move(stack));
+  if (ShouldExitAuto()) return;
+
+  // Lower the claw to knock the tote.
+  LOG(INFO, "Lowering the claw to knock the tote\n");
+  SetClawStateNoWait(0.0, 0.0, true, kFastClaw);
+
+  time::SleepFor(time::Time::InSeconds(0.1));
+  if (ShouldExitAuto()) return;
+
+  WaitUntilDoneOrCanceled(::std::move(drive));
+  if (ShouldExitAuto()) return;
+
+  LOG(INFO, "Knocking the can over\n");
+  drive = SetDriveGoal(0.40, kFastKnockDrive, 1.00, kComboTurn);
+  WaitUntilDoneOrCanceled(::std::move(drive));
+  if (ShouldExitAuto()) return;
+  {
+    actors::HeldToLiftParams params;
+    params.arm_clearance = kArmRaiseLowerClearance;
+    params.clamp_pause_time = 0.1;
+    params.before_lift_settle_time = 0.1;
+    params.bottom_height = 0.020;
+    params.claw_out_angle = kClawStackClearance;
+    params.lift_params.lift_height = kStackUpHeight;
+    params.lift_params.lift_arm = kStackUpArm;
+
+    lift = actors::MakeHeldToLiftAction(params);
+    lift->Start();
+  }
+
+  LOG(INFO, "Turning back to aim\n");
+  drive = SetDriveGoal(0.0, kFastDrive, -0.70);
+  WaitUntilDoneOrCanceled(::std::move(drive));
+  if (ShouldExitAuto()) return;
+
+  SetClawStateNoWait(0.0, 4.0, false, kFastClaw);
+  LOG(INFO, "Now driving the second tote\n");
+  drive = SetDriveGoal(1.05, kFastDrive);
+
+  // Wait until we are almost at the tote, and then start intaking.
+  WaitUntilNear(0.20);
+
+  SetClawState(0.0, 6.0, true, kFastClaw);
+  WaitUntilDoneOrCanceled(::std::move(drive));
+  if (ShouldExitAuto()) return;
+
+  if (ShouldExitAuto()) return;
+  time::SleepFor(time::Time::InSeconds(0.3));
+
+  WaitUntilDoneOrCanceled(::std::move(lift));
+  if (ShouldExitAuto()) return;
+
+  LOG(INFO, "Done sucking in tote\n");
+  SetClawState(0.0, 0.0, true, kFastClaw);
+  if (ShouldExitAuto()) return;
+
+  // Now pick it up
+  {
+    actors::PickupParams params;
+    // Lift to here initially.
+    params.pickup_angle = 0.9;
+    // Start sucking here
+    params.suck_angle = 0.8;
+    // Go back down to here to finish sucking.
+    params.suck_angle_finish = 0.4;
+    // Pack the box back in here.
+    params.pickup_finish_angle = kClawTotePackAngle;
+    params.intake_time = 0.60;
+    params.intake_voltage = 6.5;
+    pickup = actors::MakePickupAction(params);
+    pickup->Start();
+  }
+
+  time::SleepFor(time::Time::InSeconds(0.9));
+  if (ShouldExitAuto()) return;
+
+  // Start turning.
+  LOG(INFO, "Turning in place\n");
+  drive = SetDriveGoal(0.65, kStackingDrive, -0.45);
+
+  WaitUntilDoneOrCanceled(::std::move(pickup));
+  if (ShouldExitAuto()) return;
+
+  // Now grab it in the fridge.
+  {
+    actors::StackParams params;
+
+    params.claw_out_angle = kClawTotePackAngle;
+    params.bottom = 0.020;
+    params.only_place = false;
+    params.arm_clearance = kArmRaiseLowerClearance;
+    params.over_box_before_place_height = 0.39;
+
+    stack = actors::MakeStackAction(params);
+    stack->Start();
+  }
+
+  WaitUntilDoneOrCanceled(::std::move(stack));
+  if (ShouldExitAuto()) return;
+
+  WaitUntilDoneOrCanceled(::std::move(drive));
+  if (ShouldExitAuto()) return;
+
+  // Lower the claw to knock the tote.
+  LOG(INFO, "Lowering the claw to knock the tote\n");
+  SetClawStateNoWait(0.0, 0.0, true, kFastClaw);
+
+  // Lift the fridge.
+  MoveFridge(0.0, 0.3, true, kFridgeXProfile, kFridgeYProfile);
+
+  time::SleepFor(time::Time::InSeconds(0.1));
+  if (ShouldExitAuto()) return;
+
+  LOG(INFO, "Knocking the can over\n");
+  drive = SetDriveGoal(0.40, kFastKnockDrive, 1.10, kComboTurn);
+  WaitUntilDoneOrCanceled(::std::move(drive));
+  if (ShouldExitAuto()) return;
+
+  LOG(INFO, "Turning back to aim\n");
+  drive = SetDriveGoal(0.0, kFastDrive, -0.60);
+  WaitUntilDoneOrCanceled(::std::move(drive));
+  if (ShouldExitAuto()) return;
+
+
+  SetClawStateNoWait(0.0, 4.0, false, kFastClaw);
+  LOG(INFO, "Now driving to the last tote\n");
+  drive = SetDriveGoal(1.05, kFastDrive);
+  WaitUntilNear(0.05);
+
+  SetClawState(0.0, 7.0, true, kFastClaw);
+  if (ShouldExitAuto()) return;
+
+  time::SleepFor(time::Time::InSeconds(0.2));
+  if (ShouldExitAuto()) return;
+
+  WaitUntilDoneOrCanceled(::std::move(drive));
+  if (ShouldExitAuto()) return;
+  SetClawState(0.0, 6.0, true, kFastClaw);
+
+  LOG(INFO, "Racing over\n");
+  //StepDrive(2.5, -1.4);
+  drive = SetDriveGoal(2.5, kRaceDrive, -1.4, kRaceTurn);
+
+  time::SleepFor(time::Time::InSeconds(0.5));
+
+  LOG(INFO, "Moving totes out\n");
+  MoveFridge(0.6, 0.32, true, kFridgeXProfile, kFridgeYProfile);
+
+  WaitForFridge();
+  if (ShouldExitAuto()) return;
+
+  LOG(INFO, "Lowering totes\n");
+  MoveFridge(0.6, 0.15, false, kFridgeXProfile, kFridgeYProfile);
+
+  WaitForFridge();
+  if (ShouldExitAuto()) return;
+
+  time::SleepFor(time::Time::InSeconds(0.1));
 
   if (ShouldExitAuto()) return;
 
-  if (false) {
-    // drive up to the next tote
-    drive = SetDriveGoal(1.0, false);
-    WaitUntilDoneOrCanceled(drive.get());
-    if (ShouldExitAuto()) return;
+  LOG(INFO, "Retracting\n");
+  MoveFridge(0.0, 0.10, false, kFridgeFastXProfile, kFridgeYProfile);
 
-    // suck in the tote
-    SetClawState(0.0, 7.0, true);
-    drive = SetDriveGoal(0.2, false);
-    WaitUntilDoneOrCanceled(drive.get());
-    SetClawState(0.0, 0.0, true);
-    if (ShouldExitAuto()) return;
+  SetClawState(0.0, 0.0, false, kFastClaw);
 
+  if (ShouldExitAuto()) return;
+  WaitForFridge();
+  if (ShouldExitAuto()) return;
 
-    // we should have the tote, now stack it
-    {
-      actors::StackParams params;
-      params.claw_out_angle = 0.6;
-      params.bottom = 0.020;
-      params.over_box_before_place_height = 0.39;
-      stack = actors::MakeStackAction(params);
-      WaitUntilDoneOrCanceled(stack.get());
-    }
-    if (ShouldExitAuto()) return;
+  WaitUntilDoneOrCanceled(::std::move(drive));
+  if (ShouldExitAuto()) return;
 
-    // turn 90
-    DriveSpin(M_PI / 4.0);
-    if (ShouldExitAuto()) return;
-
-    // place the new stack
-    // TODO(austin): Score!
-    // score = MakeScoreAction(score_params);
-    // WaitUntilDoneOrCanceled(score.get());
-  }
+  LOG(INFO, "Backing away to let the stack ago\n");
+  drive = SetDriveGoal(-0.1, kRaceBackupDrive);
+  WaitUntilDoneOrCanceled(::std::move(drive));
 }
 
 }  // namespace autonomous
diff --git a/frc971/autonomous/autonomous.gyp b/frc971/autonomous/autonomous.gyp
index f021033..8d75b27 100644
--- a/frc971/autonomous/autonomous.gyp
+++ b/frc971/autonomous/autonomous.gyp
@@ -29,6 +29,7 @@
         '<(DEPTH)/frc971/control_loops/claw/claw.gyp:claw_queue',
         '<(DEPTH)/frc971/control_loops/fridge/fridge.gyp:fridge_queue',
         '<(DEPTH)/frc971/actors/actors.gyp:stack_action_lib',
+        '<(DEPTH)/frc971/actors/actors.gyp:held_to_lift_action_lib',
         '<(DEPTH)/frc971/actors/actors.gyp:pickup_action_lib',
       ],
       'export_dependent_settings': [