Move aos/controls to frc971/control_loops

Also put what was aos/controls/control_loops.fbs in y2012/control_loops
because that's the only user.

Change-Id: I8f402b0708103077e135a41e55ef5e4f23681d87
Signed-off-by: James Kuszmaul <jabukuszmaul@gmail.com>
diff --git a/y2018/control_loops/superstructure/BUILD b/y2018/control_loops/superstructure/BUILD
index d44807e..6ef3734 100644
--- a/y2018/control_loops/superstructure/BUILD
+++ b/y2018/control_loops/superstructure/BUILD
@@ -61,7 +61,7 @@
         ":superstructure_output_fbs",
         ":superstructure_position_fbs",
         ":superstructure_status_fbs",
-        "//aos/controls:control_loop",
+        "//frc971/control_loops:control_loop",
         "//aos/events:event_loop",
         "//frc971/control_loops:control_loops_fbs",
         "//frc971/control_loops/drivetrain:drivetrain_output_fbs",
@@ -89,7 +89,7 @@
         ":superstructure_position_fbs",
         ":superstructure_status_fbs",
         "//aos:math",
-        "//aos/controls:control_loop_test",
+        "//frc971/control_loops:control_loop_test",
         "//aos/testing:googletest",
         "//aos/time",
         "//frc971/control_loops:position_sensor_sim",
diff --git a/y2018/control_loops/superstructure/intake/BUILD b/y2018/control_loops/superstructure/intake/BUILD
index c49b80b..fa4eb7e 100644
--- a/y2018/control_loops/superstructure/intake/BUILD
+++ b/y2018/control_loops/superstructure/intake/BUILD
@@ -43,7 +43,7 @@
     deps = [
         ":intake_plants",
         "//aos:math",
-        "//aos/controls:control_loop",
+        "//frc971/control_loops:control_loop",
         "//frc971/control_loops:control_loops_fbs",
         "//frc971/zeroing",
         "//y2018:constants",
diff --git a/y2018/control_loops/superstructure/intake/intake.h b/y2018/control_loops/superstructure/intake/intake.h
index e064c0e..7bc3986 100644
--- a/y2018/control_loops/superstructure/intake/intake.h
+++ b/y2018/control_loops/superstructure/intake/intake.h
@@ -4,7 +4,7 @@
 #include <math.h>
 
 #include "aos/commonmath.h"
-#include "aos/controls/control_loop.h"
+#include "frc971/control_loops/control_loop.h"
 #include "frc971/zeroing/wrap.h"
 #include "frc971/zeroing/zeroing.h"
 #include "y2018/constants.h"
@@ -46,7 +46,7 @@
   double goal_angle(const double *unsafe_goal);
 
   constexpr static double kDt =
-      ::aos::time::DurationInSeconds(::aos::controls::kLoopFrequency);
+      ::aos::time::DurationInSeconds(::frc971::controls::kLoopFrequency);
 
   // Sets the offset of the controller to be the zeroing estimator offset when
   // possible otherwise zero.
diff --git a/y2018/control_loops/superstructure/superstructure.cc b/y2018/control_loops/superstructure/superstructure.cc
index f24da3b..a3e7d4f 100644
--- a/y2018/control_loops/superstructure/superstructure.cc
+++ b/y2018/control_loops/superstructure/superstructure.cc
@@ -25,8 +25,8 @@
 
 Superstructure::Superstructure(::aos::EventLoop *event_loop,
                                const ::std::string &name)
-    : aos::controls::ControlLoop<Goal, Position, Status, Output>(event_loop,
-                                                                 name),
+    : frc971::controls::ControlLoop<Goal, Position, Status, Output>(event_loop,
+                                                                    name),
       status_light_sender_(
           event_loop->MakeSender<::y2018::StatusLight>("/superstructure")),
       vision_status_fetcher_(
@@ -131,7 +131,6 @@
           output != nullptr ? &release_arm_brake_output : nullptr,
           output != nullptr ? &claw_grabbed_output : nullptr, status->fbb());
 
-
   bool hook_release_output = false;
   bool forks_release_output = false;
   double voltage_winch_output = 0.0;
diff --git a/y2018/control_loops/superstructure/superstructure.h b/y2018/control_loops/superstructure/superstructure.h
index 78851df..63adbb2 100644
--- a/y2018/control_loops/superstructure/superstructure.h
+++ b/y2018/control_loops/superstructure/superstructure.h
@@ -3,7 +3,7 @@
 
 #include <memory>
 
-#include "aos/controls/control_loop.h"
+#include "frc971/control_loops/control_loop.h"
 #include "aos/events/event_loop.h"
 #include "aos/time/time.h"
 #include "frc971/control_loops/drivetrain/drivetrain_output_generated.h"
@@ -22,7 +22,7 @@
 namespace superstructure {
 
 class Superstructure
-    : public ::aos::controls::ControlLoop<Goal, Position, Status, Output> {
+    : public ::frc971::controls::ControlLoop<Goal, Position, Status, Output> {
  public:
   explicit Superstructure(::aos::EventLoop *event_loop,
                           const ::std::string &name = "/superstructure");
diff --git a/y2018/control_loops/superstructure/superstructure_lib_test.cc b/y2018/control_loops/superstructure/superstructure_lib_test.cc
index a087356..9d2c10e 100644
--- a/y2018/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2018/control_loops/superstructure/superstructure_lib_test.cc
@@ -1,11 +1,9 @@
-#include "y2018/control_loops/superstructure/superstructure.h"
-
 #include <unistd.h>
 
 #include <chrono>
 #include <memory>
 
-#include "aos/controls/control_loop_test.h"
+#include "frc971/control_loops/control_loop_test.h"
 #include "frc971/control_loops/position_sensor_sim.h"
 #include "frc971/control_loops/team_number_test_environment.h"
 #include "gtest/gtest.h"
@@ -13,6 +11,7 @@
 #include "y2018/control_loops/superstructure/arm/dynamics.h"
 #include "y2018/control_loops/superstructure/arm/generated_graph.h"
 #include "y2018/control_loops/superstructure/intake/intake_plant.h"
+#include "y2018/control_loops/superstructure/superstructure.h"
 #include "y2018/status_light_generated.h"
 #include "y2018/vision/vision_generated.h"
 
@@ -64,9 +63,8 @@
     plant_.mutable_X(0) = start_pos;
     plant_.mutable_X(2) = start_pos;
 
-    pot_encoder_.Initialize(
-        start_pos, kNoiseScalar, 0.0,
-        zeroing_constants_.measured_absolute_position);
+    pot_encoder_.Initialize(start_pos, kNoiseScalar, 0.0,
+                            zeroing_constants_.measured_absolute_position);
   }
 
   flatbuffers::Offset<IntakeElasticSensors> GetSensorValues(
@@ -106,10 +104,8 @@
     const double position_intake = plant_.Y(1);
 
     pot_encoder_.MoveTo(position_intake);
-    EXPECT_GE(position_intake,
-              constants::Values::kIntakeRange().lower_hard);
-    EXPECT_LE(position_intake,
-              constants::Values::kIntakeRange().upper_hard);
+    EXPECT_GE(position_intake, constants::Values::kIntakeRange().lower_hard);
+    EXPECT_LE(position_intake, constants::Values::kIntakeRange().upper_hard);
   }
 
  private:
@@ -312,10 +308,10 @@
   bool first_ = true;
 };
 
-class SuperstructureTest : public ::aos::testing::ControlLoopTest {
+class SuperstructureTest : public ::frc971::testing::ControlLoopTest {
  protected:
   SuperstructureTest()
-      : ::aos::testing::ControlLoopTest(
+      : ::frc971::testing::ControlLoopTest(
             aos::configuration::ReadConfig("y2018/config.json"),
             ::std::chrono::microseconds(5050)),
         test_event_loop_(MakeEventLoop("test")),
@@ -405,7 +401,8 @@
     intake_goal_builder.add_left_intake_angle(0.1);
     intake_goal_builder.add_right_intake_angle(0.2);
 
-    flatbuffers::Offset<IntakeGoal> intake_offset = intake_goal_builder.Finish();
+    flatbuffers::Offset<IntakeGoal> intake_offset =
+        intake_goal_builder.Finish();
 
     Goal::Builder goal_builder = builder.MakeBuilder<Goal>();
     goal_builder.add_intake(intake_offset);
@@ -435,7 +432,8 @@
     intake_goal_builder.add_left_intake_angle(0.1);
     intake_goal_builder.add_right_intake_angle(0.2);
 
-    flatbuffers::Offset<IntakeGoal> intake_offset = intake_goal_builder.Finish();
+    flatbuffers::Offset<IntakeGoal> intake_offset =
+        intake_goal_builder.Finish();
 
     Goal::Builder goal_builder = builder.MakeBuilder<Goal>();
     goal_builder.add_intake(intake_offset);
@@ -463,7 +461,8 @@
     intake_goal_builder.add_left_intake_angle(5.0 * M_PI);
     intake_goal_builder.add_right_intake_angle(5.0 * M_PI);
 
-    flatbuffers::Offset<IntakeGoal> intake_offset = intake_goal_builder.Finish();
+    flatbuffers::Offset<IntakeGoal> intake_offset =
+        intake_goal_builder.Finish();
 
     Goal::Builder goal_builder = builder.MakeBuilder<Goal>();
     goal_builder.add_intake(intake_offset);
@@ -501,7 +500,8 @@
     intake_goal_builder.add_left_intake_angle(-5.0 * M_PI);
     intake_goal_builder.add_right_intake_angle(-5.0 * M_PI);
 
-    flatbuffers::Offset<IntakeGoal> intake_offset = intake_goal_builder.Finish();
+    flatbuffers::Offset<IntakeGoal> intake_offset =
+        intake_goal_builder.Finish();
 
     Goal::Builder goal_builder = builder.MakeBuilder<Goal>();
     goal_builder.add_intake(intake_offset);
@@ -544,7 +544,8 @@
     intake_goal_builder.add_right_intake_angle(
         constants::Values::kIntakeRange().lower);
 
-    flatbuffers::Offset<IntakeGoal> intake_offset = intake_goal_builder.Finish();
+    flatbuffers::Offset<IntakeGoal> intake_offset =
+        intake_goal_builder.Finish();
 
     Goal::Builder goal_builder = builder.MakeBuilder<Goal>();
     goal_builder.add_intake(intake_offset);
@@ -589,7 +590,8 @@
     intake_goal_builder.add_right_intake_angle(
         constants::Values::kIntakeRange().upper);
 
-    flatbuffers::Offset<IntakeGoal> intake_offset = intake_goal_builder.Finish();
+    flatbuffers::Offset<IntakeGoal> intake_offset =
+        intake_goal_builder.Finish();
 
     Goal::Builder goal_builder = builder.MakeBuilder<Goal>();
     goal_builder.add_intake(intake_offset);
@@ -617,7 +619,8 @@
     intake_goal_builder.add_right_intake_angle(
         constants::Values::kIntakeRange().upper - 0.1);
 
-    flatbuffers::Offset<IntakeGoal> intake_offset = intake_goal_builder.Finish();
+    flatbuffers::Offset<IntakeGoal> intake_offset =
+        intake_goal_builder.Finish();
 
     Goal::Builder goal_builder = builder.MakeBuilder<Goal>();
     goal_builder.add_intake(intake_offset);
@@ -664,7 +667,8 @@
     intake_goal_builder.add_left_intake_angle(-0.8);
     intake_goal_builder.add_right_intake_angle(-0.8);
 
-    flatbuffers::Offset<IntakeGoal> intake_offset = intake_goal_builder.Finish();
+    flatbuffers::Offset<IntakeGoal> intake_offset =
+        intake_goal_builder.Finish();
 
     Goal::Builder goal_builder = builder.MakeBuilder<Goal>();
     goal_builder.add_intake(intake_offset);
@@ -687,7 +691,8 @@
     intake_goal_builder.add_left_intake_angle(0.0);
     intake_goal_builder.add_right_intake_angle(0.0);
 
-    flatbuffers::Offset<IntakeGoal> intake_offset = intake_goal_builder.Finish();
+    flatbuffers::Offset<IntakeGoal> intake_offset =
+        intake_goal_builder.Finish();
 
     Goal::Builder goal_builder = builder.MakeBuilder<Goal>();
     goal_builder.add_intake(intake_offset);
@@ -708,7 +713,8 @@
     intake_goal_builder.add_left_intake_angle(0.0);
     intake_goal_builder.add_right_intake_angle(0.0);
 
-    flatbuffers::Offset<IntakeGoal> intake_offset = intake_goal_builder.Finish();
+    flatbuffers::Offset<IntakeGoal> intake_offset =
+        intake_goal_builder.Finish();
 
     Goal::Builder goal_builder = builder.MakeBuilder<Goal>();
     goal_builder.add_intake(intake_offset);
@@ -734,7 +740,8 @@
     intake_goal_builder.add_left_intake_angle(0.0);
     intake_goal_builder.add_right_intake_angle(0.0);
 
-    flatbuffers::Offset<IntakeGoal> intake_offset = intake_goal_builder.Finish();
+    flatbuffers::Offset<IntakeGoal> intake_offset =
+        intake_goal_builder.Finish();
 
     Goal::Builder goal_builder = builder.MakeBuilder<Goal>();
     goal_builder.add_intake(intake_offset);
@@ -755,7 +762,8 @@
     intake_goal_builder.add_left_intake_angle(0.0);
     intake_goal_builder.add_right_intake_angle(0.0);
 
-    flatbuffers::Offset<IntakeGoal> intake_offset = intake_goal_builder.Finish();
+    flatbuffers::Offset<IntakeGoal> intake_offset =
+        intake_goal_builder.Finish();
 
     Goal::Builder goal_builder = builder.MakeBuilder<Goal>();
     goal_builder.add_intake(intake_offset);
@@ -769,7 +777,6 @@
   VerifyNearGoal();
 }
 
-
 // TODO(austin): Test multiple path segments.
 // TODO(austin): Disable in the middle and test recovery.