Convert StatusLight to event loops.

Change-Id: Ifc8a497b0f30c0ce1624b005791859eef2d9912f
diff --git a/y2018/control_loops/superstructure/BUILD b/y2018/control_loops/superstructure/BUILD
index a646ab6..1a2aa5e 100644
--- a/y2018/control_loops/superstructure/BUILD
+++ b/y2018/control_loops/superstructure/BUILD
@@ -24,6 +24,7 @@
     deps = [
         ":superstructure_queue",
         "//aos/controls:control_loop",
+        "//aos/events:event-loop",
         "//frc971/control_loops:queues",
         "//frc971/control_loops/drivetrain:drivetrain_queue",
         "//y2018:constants",
diff --git a/y2018/control_loops/superstructure/superstructure.cc b/y2018/control_loops/superstructure/superstructure.cc
index 9474b6d..d94e34d 100644
--- a/y2018/control_loops/superstructure/superstructure.cc
+++ b/y2018/control_loops/superstructure/superstructure.cc
@@ -24,21 +24,12 @@
 constexpr double kMaxIntakeRollerVoltage = 12.0;
 }  // namespace
 
-void SendColors(float red, float green, float blue) {
-  auto new_status_light = status_light.MakeMessage();
-  new_status_light->red = red;
-  new_status_light->green = green;
-  new_status_light->blue = blue;
-
-  if (!new_status_light.Send()) {
-    LOG(ERROR, "Failed to send lights.\n");
-  }
-}
-
 Superstructure::Superstructure(::aos::EventLoop *event_loop,
                                const ::std::string &name)
     : aos::controls::ControlLoop<control_loops::SuperstructureQueue>(event_loop,
                                                                      name),
+      status_light_sender_(
+          event_loop->MakeSender<::y2018::StatusLight>(".y2018.status_light")),
       intake_left_(constants::GetValues().left_intake.zeroing),
       intake_right_(constants::GetValues().right_intake.zeroing) {}
 
@@ -292,6 +283,17 @@
   last_box_distance_ = clipped_box_distance;
 }
 
+void Superstructure::SendColors(float red, float green, float blue) {
+  auto new_status_light = status_light_sender_.MakeMessage();
+  new_status_light->red = red;
+  new_status_light->green = green;
+  new_status_light->blue = blue;
+
+  if (!new_status_light.Send()) {
+    LOG(ERROR, "Failed to send lights.\n");
+  }
+}
+
 }  // namespace superstructure
 }  // namespace control_loops
 }  // namespace y2018
diff --git a/y2018/control_loops/superstructure/superstructure.h b/y2018/control_loops/superstructure/superstructure.h
index 3d1a6af..8ab6bf3 100644
--- a/y2018/control_loops/superstructure/superstructure.h
+++ b/y2018/control_loops/superstructure/superstructure.h
@@ -4,10 +4,12 @@
 #include <memory>
 
 #include "aos/controls/control_loop.h"
+#include "aos/events/event-loop.h"
 #include "frc971/control_loops/state_feedback_loop.h"
 #include "y2018/control_loops/superstructure/arm/arm.h"
 #include "y2018/control_loops/superstructure/intake/intake.h"
 #include "y2018/control_loops/superstructure/superstructure.q.h"
+#include "y2018/status_light.q.h"
 
 namespace y2018 {
 namespace control_loops {
@@ -32,6 +34,11 @@
       control_loops::SuperstructureQueue::Status *status) override;
 
  private:
+  // Sends the status light message for the 3 colors provided.
+  void SendColors(float red, float green, float blue);
+
+  ::aos::Sender<::y2018::StatusLight> status_light_sender_;
+
   intake::IntakeSide intake_left_;
   intake::IntakeSide intake_right_;
   arm::Arm arm_;
diff --git a/y2018/control_loops/superstructure/superstructure_lib_test.cc b/y2018/control_loops/superstructure/superstructure_lib_test.cc
index 89cfaa0..5fa4abe 100644
--- a/y2018/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2018/control_loops/superstructure/superstructure_lib_test.cc
@@ -274,7 +274,6 @@
                               ".y2018.control_loops.superstructure.status",
                               ".y2018.control_loops.superstructure.position"),
         superstructure_(&event_loop_, ".y2018.control_loops.superstructure") {
-    status_light.Clear();
     ::y2018::vision::vision_status.Clear();
     ::frc971::control_loops::drivetrain_queue.output.Clear();
     set_team_id(::frc971::control_loops::testing::kTeamNumber);