cleaned up lots of logging

There were many LOGs that made more sense as LOG_STRUCTs to save space,
reduce CPU usage, and make it a bit more obvious what they're saying.
diff --git a/frc971/control_loops/claw/claw.cc b/frc971/control_loops/claw/claw.cc
index 7334166..b07d75b 100755
--- a/frc971/control_loops/claw/claw.cc
+++ b/frc971/control_loops/claw/claw.cc
@@ -6,6 +6,7 @@
 
 #include "aos/common/control_loop/control_loops.q.h"
 #include "aos/common/logging/logging.h"
+#include "aos/common/logging/queue_logging.h"
 
 #include "frc971/constants.h"
 #include "frc971/control_loops/claw/claw_motor_plant.h"
@@ -75,9 +76,9 @@
 
   const double k_max_voltage = is_zeroing_ ? kZeroingVoltage : kMaxVoltage;
   if (max_value > k_max_voltage) {
-    LOG(DEBUG, "Capping U because max is %f\n", max_value);
     U = U * k_max_voltage / max_value;
-    LOG(DEBUG, "Capping U is now %f %f\n", U(0, 0), U(1, 0));
+    LOG(DEBUG, "Capping U is now %f %f (max is %f)\n",
+        U(0, 0), U(1, 0), max_value);
   }
 }
 
@@ -238,7 +239,7 @@
 
   if (SawFilteredPosedge(this_sensor, sensorA, sensorB)) {
     if (min_hall_effect_off_angle_ == max_hall_effect_off_angle_) {
-      LOG(INFO, "%s: Uncertain which side, rejecting posedge\n", name_);
+      LOG(WARNING, "%s: Uncertain which side, rejecting posedge\n", name_);
     } else {
       const double average_last_encoder =
           (min_hall_effect_off_angle_ + max_hall_effect_off_angle_) / 2.0;
@@ -260,7 +261,7 @@
 
   if (SawFilteredNegedge(this_sensor, sensorA, sensorB)) {
     if (min_hall_effect_on_angle_ == max_hall_effect_on_angle_) {
-      LOG(INFO, "%s: Uncertain which side, rejecting negedge\n", name_);
+      LOG(WARNING, "%s: Uncertain which side, rejecting negedge\n", name_);
     } else {
       const double average_last_encoder =
           (min_hall_effect_on_angle_ + max_hall_effect_on_angle_) / 2.0;
@@ -450,8 +451,9 @@
       initial_separation_ =
           top_claw_.absolute_position() - bottom_claw_.absolute_position();
     }
-    LOG(DEBUG, "Claw position is (top: %f bottom: %f\n",
-        top_claw_.absolute_position(), bottom_claw_.absolute_position());
+    LOG_STRUCT(DEBUG, "absolute position",
+               ClawPositionToLog(top_claw_.absolute_position(),
+                                 bottom_claw_.absolute_position()));
   }
 
   const bool autonomous = ::aos::robot_state->autonomous;
@@ -675,8 +677,8 @@
     if (position != nullptr) {
       separation = position->top.position - position->bottom.position;
     }
-    LOG(DEBUG, "Goal is %f (bottom) %f, separation is %f\n", claw_.R(0, 0),
-        claw_.R(1, 0), separation);
+    LOG_STRUCT(DEBUG, "actual goal",
+               ClawGoalToLog(claw_.R(0, 0), claw_.R(1, 0), separation));
 
     // Only cap power when one of the halves of the claw is moving slowly and
     // could wind up.
@@ -702,8 +704,9 @@
         bottom_claw_goal_ -= dx;
         top_claw_goal_ -= dx;
         capped_goal_ = true;
-        LOG(DEBUG, "Moving the goal by %f to prevent windup\n", dx);
-        LOG(DEBUG, "Uncapped is %f, max is %f, difference is %f\n",
+        LOG(DEBUG, "Moving the goal by %f to prevent windup."
+            " Uncapped is %f, max is %f, difference is %f\n",
+            dx,
             claw_.uncapped_average_voltage(), values.claw.max_zeroing_voltage,
             (claw_.uncapped_average_voltage() -
              values.claw.max_zeroing_voltage));
diff --git a/frc971/control_loops/claw/claw.gyp b/frc971/control_loops/claw/claw.gyp
index 8bb94c0..588ce79 100644
--- a/frc971/control_loops/claw/claw.gyp
+++ b/frc971/control_loops/claw/claw.gyp
@@ -29,6 +29,7 @@
         '<(AOS)/common/common.gyp:controls',
         '<(DEPTH)/frc971/frc971.gyp:constants',
         '<(DEPTH)/frc971/control_loops/control_loops.gyp:state_feedback_loop',
+        '<(AOS)/common/logging/logging.gyp:queue_logging',
       ],
       'export_dependent_settings': [
         'claw_loop',
diff --git a/frc971/control_loops/claw/claw.q b/frc971/control_loops/claw/claw.q
index 38e7efb..3225d2f 100644
--- a/frc971/control_loops/claw/claw.q
+++ b/frc971/control_loops/claw/claw.q
@@ -73,3 +73,14 @@
 };
 
 queue_group ClawGroup claw_queue_group;
+
+struct ClawPositionToLog {
+	double top;
+	double bottom;
+};
+
+struct ClawGoalToLog {
+	double bottom_pos;
+	double bottom_vel;
+	double separation;
+};
diff --git a/frc971/control_loops/shooter/shooter.cc b/frc971/control_loops/shooter/shooter.cc
index 0ba599b..3b03832 100755
--- a/frc971/control_loops/shooter/shooter.cc
+++ b/frc971/control_loops/shooter/shooter.cc
@@ -6,6 +6,7 @@
 
 #include "aos/common/control_loop/control_loops.q.h"
 #include "aos/common/logging/logging.h"
+#include "aos/common/logging/queue_logging.h"
 
 #include "frc971/constants.h"
 #include "frc971/control_loops/shooter/shooter_motor_plant.h"
@@ -36,7 +37,7 @@
   voltage_ = std::max(-max_voltage_, voltage_);
   U(0, 0) = voltage_ - old_voltage;
 
-  LOG(DEBUG, "X_hat is %f, applied is %f\n", X_hat(2, 0), voltage_);
+  LOG_STRUCT(DEBUG, "output", ShooterVoltageToLog(X_hat(2, 0), voltage_));
 
   last_voltage_ = voltage_;
   capped_goal_ = false;
@@ -55,7 +56,7 @@
       R(0, 0) -= dx;
     }
     capped_goal_ = true;
-    LOG(DEBUG, "Moving the goal by %f to prevent windup\n", dx);
+    LOG_STRUCT(DEBUG, "to prevent windup", ShooterMovingGoal(dx));
   } else if (uncapped_voltage() < -max_voltage_) {
     double dx;
     if (controller_index() == 0) {
@@ -68,7 +69,7 @@
       R(0, 0) -= dx;
     }
     capped_goal_ = true;
-    LOG(DEBUG, "Moving the goal by %f to prevent windup\n", dx);
+    LOG_STRUCT(DEBUG, "to prevent windup", ShooterMovingGoal(dx));
   } else {
     capped_goal_ = false;
   }
@@ -84,13 +85,10 @@
 
 void ZeroedStateFeedbackLoop::SetCalibration(double encoder_val,
                                              double known_position) {
-  LOG(INFO, "Setting calibration such that %f -> %f\n", encoder_val,
-      known_position);
-  LOG(INFO, "Position was %f\n", absolute_position());
+  double old_position = absolute_position();
   double previous_offset = offset_;
   offset_ = known_position - encoder_val;
   double doffset = offset_ - previous_offset;
-  LOG(INFO, "Changing offset from %f to %f\n", previous_offset, offset_);
   X_hat(0, 0) += doffset;
   // Offset our measurements because the offset is baked into them.
   Y_(0, 0) += doffset;
@@ -99,7 +97,10 @@
   if (controller_index() == 0) {
     R(2, 0) += -A(1, 0) / A(1, 2) * (doffset);
   }
-  LOG(INFO, "Validation: position is %f\n", absolute_position());
+  LOG_STRUCT(
+      INFO, "sensor edge",
+      ShooterChangeCalibration(encoder_val, known_position, old_position,
+                               absolute_position(), previous_offset, offset_));
 }
 
 ShooterMotor::ShooterMotor(control_loops::ShooterGroup *my_shooter)
@@ -164,7 +165,7 @@
 
   if (::std::isnan(goal->shot_power)) {
 	  state_ = STATE_ESTOP;
-    LOG(ERROR, "Got a shot power of NAN.\n");
+    LOG(ERROR, "Estopping because got a shot power of NAN.\n");
   }
 
   // we must always have these or we have issues.
@@ -244,7 +245,8 @@
           state_ = STATE_REQUEST_LOAD;
         } else {
           shooter_loop_disable = true;
-          LOG(DEBUG, "Not moving on until the latch has moved to avoid a crash\n");
+          LOG(DEBUG,
+              "Not moving on until the latch has moved to avoid a crash\n");
         }
       } else {
         // If we can't start yet because we don't know where we are, set the
@@ -393,6 +395,7 @@
           if (!position->pusher_distal.current ||
               !position->pusher_proximal.current) {
             state_ = STATE_ESTOP;
+            LOG(ERROR, "Estopping because took too long to load.\n");
           }
         }
       } else if (goal->unload_requested) {
@@ -558,6 +561,7 @@
         // We have been stuck trying to unload for way too long, give up and
         // turn everything off.
         state_ = STATE_ESTOP;
+        LOG(ERROR, "Estopping because took too long to unload.\n");
       }
 
       brake_piston_ = false;
@@ -603,6 +607,7 @@
       break;
 
     case STATE_ESTOP:
+      LOG(DEBUG, "estopped\n");
       // Totally lost, go to a safe state.
       shooter_loop_disable = true;
       latch_piston_ = true;
@@ -611,8 +616,9 @@
   }
 
   if (!shooter_loop_disable) {
-    LOG(DEBUG, "Running the loop, goal is %f, position is %f\n",
-        shooter_.goal_position(), shooter_.absolute_position());
+    LOG_STRUCT(DEBUG, "running the loop",
+               ShooterStatusToLog(shooter_.goal_position(),
+                                  shooter_.absolute_position()));
     if (!cap_goal) {
       shooter_.set_max_voltage(12.0);
     }
@@ -635,15 +641,15 @@
   }
 
   if (position) {
+    LOG_STRUCT(DEBUG, "internal state",
+               ShooterStateToLog(
+                   shooter_.absolute_position(), shooter_.absolute_velocity(),
+                   state_, position->latch, position->pusher_proximal.current,
+                   position->pusher_distal.current, position->plunger,
+                   brake_piston_, latch_piston_));
+
     last_position_ = *position;
-    LOG(DEBUG, "pos > absolute: %f velocity: %f state= %d l= %d pp= %d, pd= %d "
-               "p= %d b=%d\n",
-        shooter_.absolute_position(), shooter_.absolute_velocity(),
-        state_, position->latch, position->pusher_proximal.current,
-        position->pusher_distal.current,
-        position->plunger, brake_piston_);
-  }
-  if (position) {
+
     last_distal_posedge_count_ = position->pusher_distal.posedge_count;
     last_proximal_posedge_count_ = position->pusher_proximal.posedge_count;
     last_distal_current_ = position->pusher_distal.current;
diff --git a/frc971/control_loops/shooter/shooter.gyp b/frc971/control_loops/shooter/shooter.gyp
index efcc0e7..10e0f4e 100755
--- a/frc971/control_loops/shooter/shooter.gyp
+++ b/frc971/control_loops/shooter/shooter.gyp
@@ -30,6 +30,7 @@
         '<(AOS)/common/common.gyp:controls',
         '<(DEPTH)/frc971/frc971.gyp:constants',
         '<(DEPTH)/frc971/control_loops/control_loops.gyp:state_feedback_loop',
+        '<(AOS)/common/logging/logging.gyp:queue_logging',
       ],
       'export_dependent_settings': [
         'shooter_loop',
diff --git a/frc971/control_loops/shooter/shooter.q b/frc971/control_loops/shooter/shooter.q
index 7475873..8613669 100755
--- a/frc971/control_loops/shooter/shooter.q
+++ b/frc971/control_loops/shooter/shooter.q
@@ -58,3 +58,38 @@
 };
 
 queue_group ShooterGroup shooter_queue_group;
+
+struct ShooterStateToLog {
+	double absolute_position;
+	double absolute_velocity;
+	uint32_t state;
+	bool latch_sensor;
+	bool proximal;
+	bool distal;
+	bool plunger;
+	bool brake;
+	bool latch_piston;
+};
+
+struct ShooterVoltageToLog {
+	double X_hat;
+	double applied;
+};
+
+struct ShooterMovingGoal {
+	double dx;
+};
+
+struct ShooterChangeCalibration {
+	double encoder;
+	double real_position;
+	double old_position;
+	double new_position;
+	double old_offset;
+	double new_offset;
+};
+
+struct ShooterStatusToLog {
+	double goal;
+	double position;
+};