Merge "Add stack action."
diff --git a/aos/build/aos.gypi b/aos/build/aos.gypi
index 3ffe5c0..5b95d3d 100644
--- a/aos/build/aos.gypi
+++ b/aos/build/aos.gypi
@@ -68,12 +68,6 @@
           ['CXX', '<(ccache)<!(which clang++)'],
         ],
       },
-    ], ['PLATFORM=="linux-amd64-gcc"', {
-        'make_global_settings': [
-          ['CC', '<(ccache)<!(which gcc-4.7)'],
-          ['CXX', '<(ccache)<!(which g++-4.7)'],
-        ],
-      },
     ], ['PLATFORM=="linux-amd64-gcc_4.8"', {
         'make_global_settings': [
           ['CC', '<(ccache)/opt/clang-3.5/bin/gcc'],
diff --git a/aos/build/build.py b/aos/build/build.py
index c89e175..90028ba 100755
--- a/aos/build/build.py
+++ b/aos/build/build.py
@@ -423,9 +423,7 @@
 
     def priority(self):
       r = 0
-      if self.compiler() == 'gcc':
-        r -= 100
-      elif self.compiler() == 'clang':
+      if self.compiler() == 'clang':
         r += 100
       if self.sanitizer() != 'none':
         r -= 50
@@ -514,7 +512,7 @@
       return r
 
   ARCHITECTURES = ('arm', 'amd64')
-  COMPILERS = ('clang', 'gcc', 'gcc_frc')
+  COMPILERS = ('clang', 'gcc_frc')
   SANITIZERS = ('address', 'undefined', 'integer', 'memory', 'thread', 'none')
   SANITIZER_TEST_WARNINGS = {
       'memory': (True,
@@ -660,9 +658,6 @@
         packages.add('libcloog-isl3:amd64')
       if is_deploy:
         packages.add('openssh-client')
-      if platform.compiler() == 'gcc' and platform.architecture() == 'amd64':
-        packages.add('gcc-4.7')
-        packages.add('g++-4.7')
       elif platform.compiler() == 'gcc_frc' or platform.compiler() == 'clang_frc':
         packages.add('gcc-4.9-arm-frc-linux-gnueabi')
         packages.add('g++-4.9-arm-frc-linux-gnueabi')
diff --git a/frc971/constants.cc b/frc971/constants.cc
index ac89391..f67ca39 100644
--- a/frc971/constants.cc
+++ b/frc971/constants.cc
@@ -115,41 +115,40 @@
 
           // Motion ranges: hard_lower_limit, hard_upper_limit,
           //                soft_lower_limit, soft_upper_limit
-          // TODO(sensors): Get actual bounds before turning on robot.
           {// Claw values, in radians.
            // 0 is level with the ground.
            // Positive moves in the direction of positive encoder values.
-           {0.0000000000, 1.5700000000, 0.1000000000, 1.2000000000},
+           {-0.05, M_PI / 2.0 + 0.1, 0.0, M_PI / 2.0},
 
            // Zeroing constants for wrist.
-           {kZeroingSampleSize, kClawEncoderIndexDifference, 0.35},
+           {kZeroingSampleSize, kClawEncoderIndexDifference,
+            0.9},
 
-           0.0,
+           6.308141,
            kClawPistonSwitchTime,
            kClawZeroingRange},
 
           {// Elevator values, in meters.
-           // TODO(austin): Fix this.  Positive is up.
-           // 0 is at the top of the elevator frame.
-           // Positive is down towards the drivebase.
-           {0.0000000000, 0.6790000000, 0.2000000000, 0.6000000000},
+           // 0 is the portion of the elevator carriage that Spencer removed
+           // lining up with the bolt.
+           // Positive is up.
+           {-0.005, 0.679000, 0.010000, 0.650000},
 
            // Arm values, in radians.
            // 0 is sticking straight out horizontally over the intake/front.
            // Positive is rotating up and into the robot (towards the back).
-           {-1.570000000, 1.5700000000, -1.200000000, 1.2000000000},
+           {-M_PI / 2 - 0.05, M_PI / 2 + 0.05, -M_PI / 2, M_PI / 2},
 
            // Elevator zeroing constants: left, right.
-           // TODO(sensors): Get actual offsets for these.
            {kZeroingSampleSize, kElevatorEncoderIndexDifference, 0.0},
            {kZeroingSampleSize, kElevatorEncoderIndexDifference, 0.0},
            // Arm zeroing constants: left, right.
            {kZeroingSampleSize, kArmEncoderIndexDifference, 0.0},
            {kZeroingSampleSize, kArmEncoderIndexDifference, 0.0},
-           0.0,
-           0.0,
-           0.0,
-           0.0,
+           0.7,
+           -0.08,
+           -3.5 - 0.01 - -0.02,
+           3.5 - 0.17 - -0.15,
 
            kArmZeroingHeight,
           },
diff --git a/frc971/control_loops/claw/claw_lib_test.cc b/frc971/control_loops/claw/claw_lib_test.cc
index f7b987c..0c2052d 100644
--- a/frc971/control_loops/claw/claw_lib_test.cc
+++ b/frc971/control_loops/claw/claw_lib_test.cc
@@ -149,7 +149,7 @@
       .angle(values.claw.wrist.lower_limit)
       .Send());
 
-  RunForTime(Time::InMS(4000));
+  RunForTime(Time::InSeconds(5));
 
   // We should not have moved.
   VerifyNearGoal();
@@ -165,7 +165,7 @@
       .angle(M_PI / 4.0)
       .Send());
 
-  RunForTime(Time::InMS(4000));
+  RunForTime(Time::InSeconds(5));
 
   ASSERT_TRUE(claw_queue_.status.FetchLatest());
   EXPECT_TRUE(claw_queue_.status->zeroed);
@@ -198,7 +198,7 @@
       .angle(M_PI / 4.0)
       .Send());
 
-  RunForTime(Time::InMS(4000));
+  RunForTime(Time::InSeconds(6));
 
   VerifyNearGoal();
 }
@@ -211,7 +211,7 @@
       .angle(values.claw.wrist.upper_hard_limit + 5.0)
       .Send());
 
-  RunForTime(Time::InMS(4000));
+  RunForTime(Time::InSeconds(5));
 
   claw_queue_.status.FetchLatest();
   EXPECT_NEAR(values.claw.wrist.upper_limit,
@@ -238,7 +238,7 @@
   ASSERT_TRUE(claw_queue_.goal.MakeWithBuilder()
       .angle(M_PI / 4.0)
       .Send());
-  RunForTime(Time::InMS(4000));
+  RunForTime(Time::InSeconds(5));
 
   VerifyNearGoal();
 }
@@ -251,7 +251,7 @@
       .angle(M_PI / 4.0)
       .Send());
   // Zeroing will take a long time here.
-  RunForTime(Time::InMS(12000));
+  RunForTime(Time::InSeconds(15));
 
   VerifyNearGoal();
 }
@@ -268,7 +268,7 @@
       .angle(M_PI / 4.0)
       .Send());
 
-  RunForTime(Time::InMS(4000));
+  RunForTime(Time::InSeconds(5));
   VerifyNearGoal();
 
   SimulateSensorReset();
@@ -278,7 +278,7 @@
 
   // Once again, it's going to take us awhile to rezero since we moved away from
   // our index pulse.
-  RunForTime(Time::InMS(10000));
+  RunForTime(Time::InSeconds(5));
   VerifyNearGoal();
 }
 
diff --git a/frc971/control_loops/fridge/fridge.cc b/frc971/control_loops/fridge/fridge.cc
index 1bf1a4c..9452637 100644
--- a/frc971/control_loops/fridge/fridge.cc
+++ b/frc971/control_loops/fridge/fridge.cc
@@ -311,7 +311,7 @@
                           right_elevator_estimator_.offset());
         LOG(DEBUG, "Zeroed the elevator!\n");
 
-        if (elevator() > values.fridge.arm_zeroing_height &&
+        if (elevator() < values.fridge.arm_zeroing_height &&
             state_ != INITIALIZING) {
           // Move the elevator to a safe height before we start zeroing the arm,
           // so that we don't crash anything.
@@ -517,6 +517,8 @@
   status->zeroed = state_ == RUNNING;
   status->angle = arm_loop_->X_hat(0, 0);
   status->height = elevator_loop_->X_hat(0, 0);
+  status->goal_angle = arm_goal_;
+  status->goal_height = elevator_goal_;
   if (unsafe_goal) {
     status->grabbers = unsafe_goal->grabbers;
   } else {
diff --git a/frc971/control_loops/fridge/fridge.q b/frc971/control_loops/fridge/fridge.q
index 09d2a42..be54ee7 100644
--- a/frc971/control_loops/fridge/fridge.q
+++ b/frc971/control_loops/fridge/fridge.q
@@ -55,6 +55,11 @@
     // state of the grabber pistons
     GrabberPistons grabbers;
 
+    // Goal angle of the arm.
+    double goal_angle;
+    // Goal height of the elevator.
+    double goal_height;
+
     // If true, we have aborted.
     bool estopped;
 
diff --git a/frc971/control_loops/fridge/fridge_lib_test.cc b/frc971/control_loops/fridge/fridge_lib_test.cc
index 0e6de14..1dff2ef 100644
--- a/frc971/control_loops/fridge/fridge_lib_test.cc
+++ b/frc971/control_loops/fridge/fridge_lib_test.cc
@@ -346,7 +346,7 @@
       constants::GetValues().fridge.arm.upper_hard_limit,
       constants::GetValues().fridge.arm.upper_hard_limit);
   fridge_queue_.goal.MakeWithBuilder().angle(0.0).height(0.4).Send();
-  RunForTime(Time::InMS(4000));
+  RunForTime(Time::InMS(5000));
 
   VerifyNearGoal();
 }
@@ -466,14 +466,14 @@
       constants::GetValues().fridge.arm.upper_hard_limit,
       constants::GetValues().fridge.arm.upper_hard_limit);
   fridge_queue_.goal.MakeWithBuilder().angle(0.03).height(0.45).Send();
-  RunForTime(Time::InMS(4000));
+  RunForTime(Time::InMS(5000));
 
   EXPECT_EQ(Fridge::RUNNING, fridge_.state());
   VerifyNearGoal();
   SimulateSensorReset();
   RunForTime(Time::InMS(100));
   EXPECT_NE(Fridge::RUNNING, fridge_.state());
-  RunForTime(Time::InMS(4000));
+  RunForTime(Time::InMS(6000));
   EXPECT_EQ(Fridge::RUNNING, fridge_.state());
   VerifyNearGoal();
 }
@@ -487,7 +487,7 @@
   EXPECT_EQ(0.0, fridge_.arm_goal_);
 
   // Now make sure they move correctly
-  RunForTime(Time::InMS(1000), true);
+  RunForTime(Time::InMS(4000), true);
   EXPECT_NE(0.0, fridge_.elevator_goal_);
   EXPECT_NE(0.0, fridge_.arm_goal_);
 }
diff --git a/frc971/wpilib/wpilib_interface.cc b/frc971/wpilib/wpilib_interface.cc
index b5c87b1..d7c23ce 100644
--- a/frc971/wpilib/wpilib_interface.cc
+++ b/frc971/wpilib/wpilib_interface.cc
@@ -246,6 +246,8 @@
       new_state->voltage_roborio_in = ControllerPower::GetInputVoltage();
       new_state->voltage_battery = ds_->GetBatteryVoltage();
 
+      LOG_STRUCT(DEBUG, "robot_state", *new_state);
+
       new_state.Send();
     }