Remove the final users of robot_state and joystick_state

This means we can remove them from the .q file.

Change-Id: Iefded3cf4537b2635341f3248c5f50af1534a241
diff --git a/aos/controls/BUILD b/aos/controls/BUILD
index 8c44823..30fe5c6 100644
--- a/aos/controls/BUILD
+++ b/aos/controls/BUILD
@@ -27,6 +27,7 @@
         "control_loop_test.h",
     ],
     deps = [
+        "//aos/events:shm-event-loop",
         "//aos/logging:queue_logging",
         "//aos/robot_state",
         "//aos/testing:googletest",
diff --git a/aos/controls/control_loop_test.h b/aos/controls/control_loop_test.h
index 66fb174..95f1c7d 100644
--- a/aos/controls/control_loop_test.h
+++ b/aos/controls/control_loop_test.h
@@ -5,6 +5,7 @@
 
 #include "gtest/gtest.h"
 
+#include "aos/events/shm-event-loop.h"
 #include "aos/logging/queue_logging.h"
 #include "aos/robot_state/robot_state.q.h"
 #include "aos/testing/test_shm.h"
@@ -22,17 +23,16 @@
 class ControlLoopTestTemplated : public TestBaseClass {
  public:
   ControlLoopTestTemplated() {
-    ::aos::joystick_state.Clear();
-    ::aos::robot_state.Clear();
+    robot_state_sender_ =
+        test_event_loop_.MakeSender<::aos::RobotState>(".aos.robot_state");
+    joystick_state_sender_ =
+        test_event_loop_.MakeSender<::aos::JoystickState>(".aos.joystick_state");
 
     ::aos::time::EnableMockTime(current_time_);
 
     SendMessages(false);
   }
   virtual ~ControlLoopTestTemplated() {
-    ::aos::joystick_state.Clear();
-    ::aos::robot_state.Clear();
-
     ::aos::time::DisableMockTime();
   }
 
@@ -44,7 +44,7 @@
     if (current_time_ >= kDSPacketTime + last_ds_time_ ||
         last_enabled_ != enabled) {
       last_ds_time_ = current_time_;
-      auto new_state = ::aos::joystick_state.MakeMessage();
+      auto new_state = joystick_state_sender_.MakeMessage();
       new_state->fake = true;
 
       new_state->enabled = enabled;
@@ -56,7 +56,7 @@
     }
 
     {
-      auto new_state = ::aos::robot_state.MakeMessage();
+      auto new_state = robot_state_sender_.MakeMessage();
 
       new_state->reader_pid = reader_pid_;
       new_state->outputs_enabled = enabled;
@@ -113,6 +113,11 @@
   ::aos::testing::TestSharedMemory my_shm_;
 
   bool last_enabled_ = false;
+
+  ::aos::ShmEventLoop test_event_loop_;
+
+  ::aos::Sender<::aos::RobotState> robot_state_sender_;
+  ::aos::Sender<::aos::JoystickState> joystick_state_sender_;
 };
 
 typedef ControlLoopTestTemplated<::testing::Test> ControlLoopTest;
diff --git a/aos/controls/replay_control_loop.h b/aos/controls/replay_control_loop.h
index d1436dd..1626c0a 100644
--- a/aos/controls/replay_control_loop.h
+++ b/aos/controls/replay_control_loop.h
@@ -33,10 +33,10 @@
     loop_group_->status.FetchLatest();
     loop_group_->output.FetchLatest();
 
-    replayer_.AddDirectQueueSender("wpilib_interface.DSReader",
-                                   "joystick_state", ::aos::joystick_state);
-    replayer_.AddDirectQueueSender("wpilib_interface.SensorReader",
-                                   "robot_state", ::aos::robot_state);
+    AddDirectQueueSender<::aos::JoystickState>(
+        "wpilib_interface.DSReader", "joystick_state", ".aos.joystick_state");
+    AddDirectQueueSender<::aos::RobotState>("wpilib_interface.SensorReader",
+                                            "robot_state", ".aos.robot_state");
 
     replayer_.AddHandler(
         process_name, "position",
@@ -49,14 +49,15 @@
         ::std::function<void(const StatusType &)>(::std::ref(status_)));
     // The timing of goal messages doesn't matter, and we don't need to look
     // back at them after running the loop.
-    replayer_.AddDirectQueueSender(process_name, "goal", loop_group_->goal);
+    AddDirectQueueSender<GoalType>(
+        process_name, "goal", ::std::string(loop_group_->name()) + ".goal");
   }
 
   template <class QT>
   void AddDirectQueueSender(const ::std::string &process_name,
                             const ::std::string &log_message,
-                            const ::aos::Queue<QT> &queue) {
-    replayer_.AddDirectQueueSender<QT>(process_name, log_message, queue);
+                            const ::std::string &name) {
+    replayer_.AddDirectQueueSender<QT>(process_name, log_message, name);
   }
 
   // Replays messages from a file.
@@ -93,6 +94,8 @@
   // Returns after going through the entire file.
   void DoProcessFile();
 
+  ::aos::ShmEventLoop event_loop_;
+
   T *const loop_group_;
 
   CaptureMessage<PositionType> position_;