Moved 2014 code into y2014 namespace.

Change-Id: Ibece165daa9e267ea1c3c7b822b0ba3eeb9830bb
diff --git a/y2014/control_loops/shooter/shooter.cc b/y2014/control_loops/shooter/shooter.cc
index 21c5b1e..39bf5c0 100644
--- a/y2014/control_loops/shooter/shooter.cc
+++ b/y2014/control_loops/shooter/shooter.cc
@@ -12,7 +12,7 @@
 #include "y2014/constants.h"
 #include "y2014/control_loops/shooter/shooter_motor_plant.h"
 
-namespace frc971 {
+namespace y2014 {
 namespace control_loops {
 
 using ::y2014::control_loops::shooter::kSpringConstant;
@@ -42,7 +42,9 @@
   voltage_ = std::max(-max_voltage_, voltage_);
   mutable_U(0, 0) = voltage_ - old_voltage;
 
-  LOG_STRUCT(DEBUG, "shooter_output", ShooterVoltageToLog(X_hat(2, 0), voltage_));
+  LOG_STRUCT(
+      DEBUG, "shooter_output",
+      ::frc971::control_loops::ShooterVoltageToLog(X_hat(2, 0), voltage_));
 
   last_voltage_ = voltage_;
   capped_goal_ = false;
@@ -61,7 +63,8 @@
       mutable_R(0, 0) -= dx;
     }
     capped_goal_ = true;
-    LOG_STRUCT(DEBUG, "to prevent windup", ShooterMovingGoal(dx));
+    LOG_STRUCT(DEBUG, "to prevent windup",
+               ::frc971::control_loops::ShooterMovingGoal(dx));
   } else if (uncapped_voltage() < -max_voltage_) {
     double dx;
     if (controller_index() == 0) {
@@ -74,7 +77,8 @@
       mutable_R(0, 0) -= dx;
     }
     capped_goal_ = true;
-    LOG_STRUCT(DEBUG, "to prevent windup", ShooterMovingGoal(dx));
+    LOG_STRUCT(DEBUG, "to prevent windup",
+               ::frc971::control_loops::ShooterMovingGoal(dx));
   } else {
     capped_goal_ = false;
   }
@@ -100,14 +104,15 @@
   if (controller_index() == 0) {
     mutable_R(2, 0) += -A(1, 0) / A(1, 2) * (doffset);
   }
-  LOG_STRUCT(
-      DEBUG, "sensor edge (fake?)",
-      ShooterChangeCalibration(encoder_val, known_position, old_position,
-                               absolute_position(), previous_offset, offset_));
+  LOG_STRUCT(DEBUG, "sensor edge (fake?)",
+             ::frc971::control_loops::ShooterChangeCalibration(
+                 encoder_val, known_position, old_position, absolute_position(),
+                 previous_offset, offset_));
 }
 
-ShooterMotor::ShooterMotor(control_loops::ShooterQueue *my_shooter)
-    : aos::controls::ControlLoop<control_loops::ShooterQueue>(my_shooter),
+ShooterMotor::ShooterMotor(::frc971::control_loops::ShooterQueue *my_shooter)
+    : aos::controls::ControlLoop<::frc971::control_loops::ShooterQueue>(
+          my_shooter),
       shooter_(MakeShooterLoop()),
       state_(STATE_INITIALIZE),
       loading_problem_end_time_(0, 0),
@@ -124,16 +129,18 @@
       last_proximal_current_(true) {}
 
 double ShooterMotor::PowerToPosition(double power) {
-  const frc971::constants::Values &values = constants::GetValues();
+  const constants::Values &values = constants::GetValues();
   double maxpower = 0.5 * kSpringConstant *
                     (kMaxExtension * kMaxExtension -
                      (kMaxExtension - values.shooter.upper_limit) *
                          (kMaxExtension - values.shooter.upper_limit));
   if (power < 0) {
-    LOG_STRUCT(WARNING, "negative power", PowerAdjustment(power, 0));
+    LOG_STRUCT(WARNING, "negative power",
+               ::frc971::control_loops::PowerAdjustment(power, 0));
     power = 0;
   } else if (power > maxpower) {
-    LOG_STRUCT(WARNING, "power too high", PowerAdjustment(power, maxpower));
+    LOG_STRUCT(WARNING, "power too high",
+               ::frc971::control_loops::PowerAdjustment(power, maxpower));
     power = maxpower;
   }
 
@@ -157,9 +164,9 @@
 }
 
 void ShooterMotor::CheckCalibrations(
-    const control_loops::ShooterQueue::Position *position) {
+    const ::frc971::control_loops::ShooterQueue::Position *position) {
   CHECK_NOTNULL(position);
-  const frc971::constants::Values &values = constants::GetValues();
+  const constants::Values &values = constants::GetValues();
 
   // TODO(austin): Validate that this is the right edge.
   // If we see a posedge on any of the hall effects,
@@ -206,10 +213,10 @@
 
 // Positive is out, and positive power is out.
 void ShooterMotor::RunIteration(
-    const control_loops::ShooterQueue::Goal *goal,
-    const control_loops::ShooterQueue::Position *position,
-    control_loops::ShooterQueue::Output *output,
-    control_loops::ShooterQueue::Status *status) {
+    const ::frc971::control_loops::ShooterQueue::Goal *goal,
+    const ::frc971::control_loops::ShooterQueue::Position *position,
+    ::frc971::control_loops::ShooterQueue::Output *output,
+    ::frc971::control_loops::ShooterQueue::Status *status) {
   if (goal && ::std::isnan(goal->shot_power)) {
 	  state_ = STATE_ESTOP;
     LOG(ERROR, "Estopping because got a shot power of NAN.\n");
@@ -236,7 +243,7 @@
   // motors disabled.
   if (output) output->voltage = 0;
 
-  const frc971::constants::Values &values = constants::GetValues();
+  const constants::Values &values = constants::GetValues();
 
   // Don't even let the control loops run.
   bool shooter_loop_disable = false;
@@ -641,8 +648,8 @@
 
   if (!shooter_loop_disable) {
     LOG_STRUCT(DEBUG, "running the loop",
-               ShooterStatusToLog(shooter_.goal_position(),
-                                  shooter_.absolute_position()));
+               ::frc971::control_loops::ShooterStatusToLog(
+                   shooter_.goal_position(), shooter_.absolute_position()));
     if (!cap_goal) {
       shooter_.set_max_voltage(12.0);
     }
@@ -668,7 +675,7 @@
 
   if (position) {
     LOG_STRUCT(DEBUG, "internal state",
-               ShooterStateToLog(
+               ::frc971::control_loops::ShooterStateToLog(
                    shooter_.absolute_position(), shooter_.absolute_velocity(),
                    state_, position->latch, position->pusher_proximal.current,
                    position->pusher_distal.current, position->plunger,
@@ -698,4 +705,4 @@
 }
 
 }  // namespace control_loops
-}  // namespace frc971
+}  // namespace y2014
diff --git a/y2014/control_loops/shooter/shooter.h b/y2014/control_loops/shooter/shooter.h
index 93b45e0..107fc65 100644
--- a/y2014/control_loops/shooter/shooter.h
+++ b/y2014/control_loops/shooter/shooter.h
@@ -11,7 +11,7 @@
 #include "y2014/control_loops/shooter/shooter_motor_plant.h"
 #include "y2014/control_loops/shooter/shooter.q.h"
 
-namespace frc971 {
+namespace y2014 {
 namespace control_loops {
 namespace testing {
 class ShooterTest_UnloadWindupPositive_Test;
@@ -122,17 +122,18 @@
 const Time kPrepareFireEndTime = Time::InMS(40);
 
 class ShooterMotor
-    : public aos::controls::ControlLoop<control_loops::ShooterQueue> {
+    : public aos::controls::ControlLoop<::frc971::control_loops::ShooterQueue> {
  public:
-  explicit ShooterMotor(control_loops::ShooterQueue *my_shooter =
-                            &control_loops::shooter_queue);
+  explicit ShooterMotor(::frc971::control_loops::ShooterQueue *my_shooter =
+                            &::frc971::control_loops::shooter_queue);
 
   // True if the goal was moved to avoid goal windup.
   bool capped_goal() const { return shooter_.capped_goal(); }
 
   double PowerToPosition(double power);
   double PositionToPower(double position);
-  void CheckCalibrations(const control_loops::ShooterQueue::Position *position);
+  void CheckCalibrations(
+      const ::frc971::control_loops::ShooterQueue::Position *position);
 
   typedef enum {
     STATE_INITIALIZE = 0,
@@ -153,9 +154,10 @@
 
  protected:
   virtual void RunIteration(
-      const ShooterQueue::Goal *goal,
-      const control_loops::ShooterQueue::Position *position,
-      ShooterQueue::Output *output, ShooterQueue::Status *status);
+      const ::frc971::control_loops::ShooterQueue::Goal *goal,
+      const ::frc971::control_loops::ShooterQueue::Position *position,
+      ::frc971::control_loops::ShooterQueue::Output *output,
+      ::frc971::control_loops::ShooterQueue::Status *status);
 
  private:
   // We have to override this to keep the pistons in the correct positions.
@@ -177,7 +179,7 @@
     load_timeout_ = Time::Now() + kLoadTimeout;
   }
 
-  control_loops::ShooterQueue::Position last_position_;
+  ::frc971::control_loops::ShooterQueue::Position last_position_;
 
   ZeroedStateFeedbackLoop shooter_;
 
@@ -220,6 +222,6 @@
 };
 
 }  // namespace control_loops
-}  // namespace frc971
+}  // namespace y2014
 
 #endif  // Y2014_CONTROL_LOOPS_shooter_shooter_H_
diff --git a/y2014/control_loops/shooter/shooter_lib_test.cc b/y2014/control_loops/shooter/shooter_lib_test.cc
index 648bbd7..e22ee7a 100644
--- a/y2014/control_loops/shooter/shooter_lib_test.cc
+++ b/y2014/control_loops/shooter/shooter_lib_test.cc
@@ -12,7 +12,7 @@
 
 using ::aos::time::Time;
 
-namespace frc971 {
+namespace y2014 {
 namespace control_loops {
 namespace testing {
 
@@ -85,8 +85,9 @@
 
   // Sets the values of the physical sensors that can be directly observed
   // (encoder, hall effect).
-  void SetPhysicalSensors(control_loops::ShooterQueue::Position *position) {
-    const frc971::constants::Values &values = constants::GetValues();
+  void SetPhysicalSensors(
+      ::frc971::control_loops::ShooterQueue::Position *position) {
+    const constants::Values &values = constants::GetValues();
 
    	position->position = GetPosition();
 
@@ -115,10 +116,10 @@
   }
 
   void UpdateEffectEdge(
-      PosedgeOnlyCountedHallEffectStruct *sensor,
-      const PosedgeOnlyCountedHallEffectStruct &last_sensor,
+      ::frc971::PosedgeOnlyCountedHallEffectStruct *sensor,
+      const ::frc971::PosedgeOnlyCountedHallEffectStruct &last_sensor,
       const constants::Values::AnglePair &limits,
-      const control_loops::ShooterQueue::Position &last_position) {
+      const ::frc971::control_loops::ShooterQueue::Position &last_position) {
     sensor->posedge_count = last_sensor.posedge_count;
     sensor->negedge_count = last_sensor.negedge_count;
 
@@ -152,9 +153,9 @@
   // it into a state using the passed values
   void SendPositionMessage(bool use_passed, bool plunger_in,
                            bool latch_in, bool brake_in) {
-    const frc971::constants::Values &values = constants::GetValues();
-    ::aos::ScopedMessagePtr<control_loops::ShooterQueue::Position> position =
-        shooter_queue_.position.MakeMessage();
+    const constants::Values &values = constants::GetValues();
+    ::aos::ScopedMessagePtr<::frc971::control_loops::ShooterQueue::Position>
+        position = shooter_queue_.position.MakeMessage();
 
     if (use_passed) {
       plunger_latched_ = latch_in && plunger_in;
@@ -282,11 +283,11 @@
   int brake_delay_count_;
 
  private:
-  ShooterQueue shooter_queue_;
+  ::frc971::control_loops::ShooterQueue shooter_queue_;
   double initial_position_;
   double last_voltage_;
 
-  control_loops::ShooterQueue::Position last_position_message_;
+  ::frc971::control_loops::ShooterQueue::Position last_position_message_;
   double last_plant_position_;
 };
 
@@ -296,7 +297,7 @@
   // Create a new instance of the test queue so that it invalidates the queue
   // that it points to.  Otherwise, we will have a pointer to shared memory that
   // is no longer valid.
-  ShooterQueue shooter_queue_;
+  ::frc971::control_loops::ShooterQueue shooter_queue_;
 
   // Create a loop and simulation plant.
   ShooterMotor shooter_motor_;
@@ -326,7 +327,7 @@
 };
 
 TEST_F(ShooterTest, PowerConversion) {
-  const frc971::constants::Values &values = constants::GetValues();
+  const constants::Values &values = constants::GetValues();
   // test a couple of values return the right thing
   EXPECT_NEAR(0.254001, shooter_motor_.PowerToPosition(140.0), 0.00001);
   EXPECT_NEAR(0.00058, shooter_motor_.PowerToPosition(0.53), 0.00001);
@@ -719,4 +720,4 @@
 
 }  // namespace testing
 }  // namespace control_loops
-}  // namespace frc971
+}  // namespace y2014
diff --git a/y2014/control_loops/shooter/shooter_main.cc b/y2014/control_loops/shooter/shooter_main.cc
index 31b24bf..2819f10 100644
--- a/y2014/control_loops/shooter/shooter_main.cc
+++ b/y2014/control_loops/shooter/shooter_main.cc
@@ -4,7 +4,7 @@
 
 int main() {
   ::aos::Init();
-  frc971::control_loops::ShooterMotor shooter;
+  ::y2014::control_loops::ShooterMotor shooter;
   shooter.Run();
   ::aos::Cleanup();
   return 0;