Switch all robots over to use EventLoop

Stop using the old QueueGroup constructor for ControlLoop

Change-Id: I027febf86e75399a97cdb4dc50dbc475705e0393
diff --git a/y2016/control_loops/superstructure/BUILD b/y2016/control_loops/superstructure/BUILD
index 7f08651..6a14a5f 100644
--- a/y2016/control_loops/superstructure/BUILD
+++ b/y2016/control_loops/superstructure/BUILD
@@ -1,118 +1,119 @@
-package(default_visibility = ['//visibility:public'])
+package(default_visibility = ["//visibility:public"])
 
-load('//aos/build:queues.bzl', 'queue_library')
+load("//aos/build:queues.bzl", "queue_library")
 
 queue_library(
-  name = 'superstructure_queue',
-  srcs = [
-    'superstructure.q',
-  ],
-  deps = [
-    '//aos/controls:control_loop_queues',
-    '//frc971/control_loops:queues',
-  ],
+    name = "superstructure_queue",
+    srcs = [
+        "superstructure.q",
+    ],
+    deps = [
+        "//aos/controls:control_loop_queues",
+        "//frc971/control_loops:queues",
+    ],
 )
 
 genrule(
-  name = 'genrule_intake',
-  visibility = ['//visibility:private'],
-  cmd = '$(location //y2016/control_loops/python:intake) $(OUTS)',
-  tools = [
-    '//y2016/control_loops/python:intake',
-  ],
-  outs = [
-    'intake_plant.h',
-    'intake_plant.cc',
-    'integral_intake_plant.h',
-    'integral_intake_plant.cc',
-  ],
+    name = "genrule_intake",
+    outs = [
+        "intake_plant.h",
+        "intake_plant.cc",
+        "integral_intake_plant.h",
+        "integral_intake_plant.cc",
+    ],
+    cmd = "$(location //y2016/control_loops/python:intake) $(OUTS)",
+    tools = [
+        "//y2016/control_loops/python:intake",
+    ],
+    visibility = ["//visibility:private"],
 )
 
 genrule(
-  name = 'genrule_arm',
-  visibility = ['//visibility:private'],
-  cmd = '$(location //y2016/control_loops/python:arm) $(OUTS)',
-  tools = [
-    '//y2016/control_loops/python:arm',
-  ],
-  outs = [
-    'arm_plant.h',
-    'arm_plant.cc',
-    'integral_arm_plant.h',
-    'integral_arm_plant.cc',
-  ],
+    name = "genrule_arm",
+    outs = [
+        "arm_plant.h",
+        "arm_plant.cc",
+        "integral_arm_plant.h",
+        "integral_arm_plant.cc",
+    ],
+    cmd = "$(location //y2016/control_loops/python:arm) $(OUTS)",
+    tools = [
+        "//y2016/control_loops/python:arm",
+    ],
+    visibility = ["//visibility:private"],
 )
 
 cc_library(
-  name = 'superstructure_plants',
-  srcs = [
-    'intake_plant.cc',
-    'arm_plant.cc',
-    'integral_intake_plant.cc',
-    'integral_arm_plant.cc',
-  ],
-  hdrs = [
-    'intake_plant.h',
-    'arm_plant.h',
-    'integral_intake_plant.h',
-    'integral_arm_plant.h',
-  ],
-  deps = [
-    '//frc971/control_loops:state_feedback_loop',
-  ],
+    name = "superstructure_plants",
+    srcs = [
+        "arm_plant.cc",
+        "intake_plant.cc",
+        "integral_arm_plant.cc",
+        "integral_intake_plant.cc",
+    ],
+    hdrs = [
+        "arm_plant.h",
+        "intake_plant.h",
+        "integral_arm_plant.h",
+        "integral_intake_plant.h",
+    ],
+    deps = [
+        "//frc971/control_loops:state_feedback_loop",
+    ],
 )
 
 cc_library(
-  name = 'superstructure_lib',
-  srcs = [
-    'superstructure.cc',
-    'superstructure_controls.cc',
-  ],
-  hdrs = [
-    'superstructure.h',
-    'superstructure_controls.h',
-  ],
-  deps = [
-    ':superstructure_queue',
-    ':superstructure_plants',
-    '//aos/controls:control_loop',
-    '//aos/util:trapezoid_profile',
-    '//aos:math',
-    '//frc971/control_loops:profiled_subsystem',
-    '//frc971/control_loops:simple_capped_state_feedback_loop',
-    '//frc971/control_loops:state_feedback_loop',
-    '//frc971/zeroing',
-    '//y2016/queues:ball_detector',
-    '//y2016:constants',
-  ],
+    name = "superstructure_lib",
+    srcs = [
+        "superstructure.cc",
+        "superstructure_controls.cc",
+    ],
+    hdrs = [
+        "superstructure.h",
+        "superstructure_controls.h",
+    ],
+    deps = [
+        ":superstructure_plants",
+        ":superstructure_queue",
+        "//aos:math",
+        "//aos/controls:control_loop",
+        "//aos/util:trapezoid_profile",
+        "//frc971/control_loops:profiled_subsystem",
+        "//frc971/control_loops:simple_capped_state_feedback_loop",
+        "//frc971/control_loops:state_feedback_loop",
+        "//frc971/zeroing",
+        "//y2016:constants",
+        "//y2016/queues:ball_detector",
+    ],
 )
 
 cc_test(
-  name = 'superstructure_lib_test',
-  srcs = [
-    'superstructure_lib_test.cc',
-  ],
-  deps = [
-    ':superstructure_queue',
-    ':superstructure_lib',
-    '//aos/testing:googletest',
-    '//aos:queues',
-    '//aos/controls:control_loop_test',
-    '//aos:math',
-    '//aos/time:time',
-    '//frc971/control_loops:position_sensor_sim',
-    '//frc971/control_loops:team_number_test_environment',
-  ],
+    name = "superstructure_lib_test",
+    srcs = [
+        "superstructure_lib_test.cc",
+    ],
+    deps = [
+        ":superstructure_lib",
+        ":superstructure_queue",
+        "//aos:math",
+        "//aos:queues",
+        "//aos/controls:control_loop_test",
+        "//aos/testing:googletest",
+        "//aos/time",
+        "//frc971/control_loops:position_sensor_sim",
+        "//frc971/control_loops:team_number_test_environment",
+    ],
 )
 
 cc_binary(
-  name = 'superstructure',
-  srcs = [
-    'superstructure_main.cc',
-  ],
-  deps = [
-    '//aos:init',
-    ':superstructure_lib',
-    ':superstructure_queue',
-  ],
+    name = "superstructure",
+    srcs = [
+        "superstructure_main.cc",
+    ],
+    deps = [
+        ":superstructure_lib",
+        ":superstructure_queue",
+        "//aos:init",
+        "//aos/events:shm-event-loop",
+    ],
 )
diff --git a/y2016/control_loops/superstructure/superstructure.cc b/y2016/control_loops/superstructure/superstructure.cc
index 1bcac52..984bcc3 100644
--- a/y2016/control_loops/superstructure/superstructure.cc
+++ b/y2016/control_loops/superstructure/superstructure.cc
@@ -225,10 +225,10 @@
 constexpr double CollisionAvoidance::kMaxWristAngleForSafeArmStowing;
 constexpr double CollisionAvoidance::kMaxShoulderAngleUntilSafeIntakeStowing;
 
-Superstructure::Superstructure(
-    control_loops::SuperstructureQueue *superstructure_queue)
-    : aos::controls::ControlLoop<control_loops::SuperstructureQueue>(
-          superstructure_queue),
+Superstructure::Superstructure(::aos::EventLoop *event_loop,
+                               const ::std::string &name)
+    : aos::controls::ControlLoop<control_loops::SuperstructureQueue>(event_loop,
+                                                                     name),
       collision_avoidance_(&intake_, &arm_) {}
 
 bool Superstructure::IsArmNear(double shoulder_tolerance,
diff --git a/y2016/control_loops/superstructure/superstructure.h b/y2016/control_loops/superstructure/superstructure.h
index 17a1547..7215067 100644
--- a/y2016/control_loops/superstructure/superstructure.h
+++ b/y2016/control_loops/superstructure/superstructure.h
@@ -107,8 +107,8 @@
     : public ::aos::controls::ControlLoop<control_loops::SuperstructureQueue> {
  public:
   explicit Superstructure(
-      control_loops::SuperstructureQueue *my_superstructure =
-          &control_loops::superstructure_queue);
+      ::aos::EventLoop *event_loop,
+      const ::std::string &name = ".y2016.control_loops.superstructure_queue");
 
   static constexpr double kZeroingVoltage = 6.0;
   static constexpr double kShooterHangingVoltage = 6.0;
diff --git a/y2016/control_loops/superstructure/superstructure_lib_test.cc b/y2016/control_loops/superstructure/superstructure_lib_test.cc
index 57ca9fa..d0c4362 100644
--- a/y2016/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2016/control_loops/superstructure/superstructure_lib_test.cc
@@ -88,11 +88,11 @@
         pot_encoder_shoulder_(
             constants::Values::kShoulderEncoderIndexDifference),
         pot_encoder_wrist_(constants::Values::kWristEncoderIndexDifference),
-        superstructure_queue_(".y2016.control_loops.superstructure",
-                              ".y2016.control_loops.superstructure.goal",
-                              ".y2016.control_loops.superstructure.position",
-                              ".y2016.control_loops.superstructure.output",
-                              ".y2016.control_loops.superstructure.status") {
+        superstructure_queue_(".y2016.control_loops.superstructure_queue",
+                              ".y2016.control_loops.superstructure_queue.goal",
+                              ".y2016.control_loops.superstructure_queue.position",
+                              ".y2016.control_loops.superstructure_queue.output",
+                              ".y2016.control_loops.superstructure_queue.status") {
     InitializeIntakePosition(0.0);
     InitializeShoulderPosition(0.0);
     InitializeRelativeWristPosition(0.0);
@@ -246,12 +246,12 @@
 class SuperstructureTest : public ::aos::testing::ControlLoopTest {
  protected:
   SuperstructureTest()
-      : superstructure_queue_(".y2016.control_loops.superstructure",
-                              ".y2016.control_loops.superstructure.goal",
-                              ".y2016.control_loops.superstructure.position",
-                              ".y2016.control_loops.superstructure.output",
-                              ".y2016.control_loops.superstructure.status"),
-        superstructure_(&superstructure_queue_),
+      : superstructure_queue_(".y2016.control_loops.superstructure_queue",
+                              ".y2016.control_loops.superstructure_queue.goal",
+                              ".y2016.control_loops.superstructure_queue.position",
+                              ".y2016.control_loops.superstructure_queue.output",
+                              ".y2016.control_loops.superstructure_queue.status"),
+        superstructure_(&event_loop_),
         superstructure_plant_() {}
 
   void VerifyNearGoal() {
@@ -375,6 +375,7 @@
   // shared memory that is no longer valid.
   SuperstructureQueue superstructure_queue_;
 
+  ::aos::ShmEventLoop event_loop_;
   // Create a control loop and simulation.
   Superstructure superstructure_;
   SuperstructureSimulation superstructure_plant_;
diff --git a/y2016/control_loops/superstructure/superstructure_main.cc b/y2016/control_loops/superstructure/superstructure_main.cc
index a08074d..435724b 100644
--- a/y2016/control_loops/superstructure/superstructure_main.cc
+++ b/y2016/control_loops/superstructure/superstructure_main.cc
@@ -1,10 +1,13 @@
 #include "y2016/control_loops/superstructure/superstructure.h"
 
+#include "aos/events/shm-event-loop.h"
 #include "aos/init.h"
 
 int main() {
   ::aos::Init();
-  ::y2016::control_loops::superstructure::Superstructure superstructure;
+  ::aos::ShmEventLoop event_loop;
+  ::y2016::control_loops::superstructure::Superstructure superstructure(
+      &event_loop);
   superstructure.Run();
   ::aos::Cleanup();
   return 0;