Convert aos over to flatbuffers

Everything builds, and all the tests pass.  I suspect that some entries
are missing from the config files, but those will be found pretty
quickly on startup.

There is no logging or live introspection of queue messages.

Change-Id: I496ee01ed68f202c7851bed7e8786cee30df29f5
diff --git a/y2017/control_loops/superstructure/hood/BUILD b/y2017/control_loops/superstructure/hood/BUILD
index 9760eac..c3f6ef0 100644
--- a/y2017/control_loops/superstructure/hood/BUILD
+++ b/y2017/control_loops/superstructure/hood/BUILD
@@ -1,46 +1,48 @@
 genrule(
-  name = 'genrule_hood',
-  cmd = '$(location //y2017/control_loops/python:hood) $(OUTS)',
-  tools = [
-    '//y2017/control_loops/python:hood',
-  ],
-  outs = [
-    'hood_plant.h',
-    'hood_plant.cc',
-    'hood_integral_plant.h',
-    'hood_integral_plant.cc',
-  ],
+    name = "genrule_hood",
+    outs = [
+        "hood_plant.h",
+        "hood_plant.cc",
+        "hood_integral_plant.h",
+        "hood_integral_plant.cc",
+    ],
+    cmd = "$(location //y2017/control_loops/python:hood) $(OUTS)",
+    tools = [
+        "//y2017/control_loops/python:hood",
+    ],
 )
 
 cc_library(
-  name = 'hood_plants',
-  visibility = ['//visibility:public'],
-  srcs = [
-    'hood_plant.cc',
-    'hood_integral_plant.cc',
-  ],
-  hdrs = [
-    'hood_plant.h',
-    'hood_integral_plant.h',
-  ],
-  deps = [
-    '//frc971/control_loops:state_feedback_loop',
-  ],
+    name = "hood_plants",
+    srcs = [
+        "hood_integral_plant.cc",
+        "hood_plant.cc",
+    ],
+    hdrs = [
+        "hood_integral_plant.h",
+        "hood_plant.h",
+    ],
+    visibility = ["//visibility:public"],
+    deps = [
+        "//frc971/control_loops:state_feedback_loop",
+    ],
 )
 
 cc_library(
-  name = 'hood',
-  visibility = ['//visibility:public'],
-  srcs = [
-    'hood.cc',
-  ],
-  hdrs = [
-    'hood.h',
-  ],
-  deps = [
-    ':hood_plants',
-    '//frc971/control_loops:profiled_subsystem',
-    '//y2017/control_loops/superstructure:superstructure_queue',
-    '//y2017:constants',
-  ],
+    name = "hood",
+    srcs = [
+        "hood.cc",
+    ],
+    hdrs = [
+        "hood.h",
+    ],
+    visibility = ["//visibility:public"],
+    deps = [
+        ":hood_plants",
+        "//frc971/control_loops:profiled_subsystem",
+        "//y2017:constants",
+        "//y2017/control_loops/superstructure:superstructure_goal_fbs",
+        "//y2017/control_loops/superstructure:superstructure_position_fbs",
+        "//y2017/control_loops/superstructure:superstructure_status_fbs",
+    ],
 )
diff --git a/y2017/control_loops/superstructure/hood/hood.cc b/y2017/control_loops/superstructure/hood/hood.cc
index 8588a16..3dcd806 100644
--- a/y2017/control_loops/superstructure/hood/hood.cc
+++ b/y2017/control_loops/superstructure/hood/hood.cc
@@ -61,10 +61,12 @@
   last_position_ = 0;
 }
 
-void Hood::Iterate(const ::aos::monotonic_clock::time_point monotonic_now,
-                   const control_loops::HoodGoal *unsafe_goal,
-                   const ::frc971::IndexPosition *position, double *output,
-                   ::frc971::control_loops::IndexProfiledJointStatus *status) {
+flatbuffers::Offset<frc971::control_loops::IndexProfiledJointStatus>
+Hood::Iterate(const ::aos::monotonic_clock::time_point monotonic_now,
+              const double *unsafe_goal,
+              const frc971::ProfileParameters *unsafe_goal_profile_parameters,
+              const ::frc971::IndexPosition *position, double *output,
+              flatbuffers::FlatBufferBuilder *fbb) {
   bool disable = output == nullptr;
   profiled_subsystem_.Correct(*position);
 
@@ -151,8 +153,8 @@
 
       // If we have a goal, go to it.  Otherwise stay where we are.
       if (unsafe_goal) {
-        profiled_subsystem_.AdjustProfile(unsafe_goal->profile_params);
-        profiled_subsystem_.set_unprofiled_goal(unsafe_goal->angle);
+        profiled_subsystem_.AdjustProfile(unsafe_goal_profile_parameters);
+        profiled_subsystem_.set_unprofiled_goal(*unsafe_goal);
       }
 
       // ESTOP if we hit the hard limits.
@@ -198,12 +200,14 @@
   }
 
   // Save debug/internal state.
+  frc971::control_loops::IndexProfiledJointStatus::Builder status_builder =
+      profiled_subsystem_.BuildStatus<
+          frc971::control_loops::IndexProfiledJointStatus::Builder>(fbb);
   // TODO(austin): Save more.
-  status->zeroed = profiled_subsystem_.zeroed();
+  status_builder.add_estopped((state_ == State::ESTOP));
+  status_builder.add_state(static_cast<int32_t>(state_));
 
-  profiled_subsystem_.PopulateStatus(status);
-  status->estopped = (state_ == State::ESTOP);
-  status->state = static_cast<int32_t>(state_);
+  return status_builder.Finish();
 }
 
 }  // namespace hood
diff --git a/y2017/control_loops/superstructure/hood/hood.h b/y2017/control_loops/superstructure/hood/hood.h
index 55d5344..7778152 100644
--- a/y2017/control_loops/superstructure/hood/hood.h
+++ b/y2017/control_loops/superstructure/hood/hood.h
@@ -2,8 +2,8 @@
 #define Y2017_CONTROL_LOOPS_SUPERSTRUCTURE_HOOD_HOOD_H_
 
 #include "frc971/control_loops/profiled_subsystem.h"
-#include "y2017/control_loops/superstructure/superstructure.q.h"
 #include "y2017/constants.h"
+#include "y2017/control_loops/superstructure/superstructure_goal_generated.h"
 
 namespace y2017 {
 namespace control_loops {
@@ -45,10 +45,12 @@
       ::std::chrono::milliseconds(15);
   static constexpr double kNotMovingVoltage = 2.0;
 
-  void Iterate(::aos::monotonic_clock::time_point monotonic_now,
-               const control_loops::HoodGoal *unsafe_goal,
-               const ::frc971::IndexPosition *position, double *output,
-               ::frc971::control_loops::IndexProfiledJointStatus *status);
+  flatbuffers::Offset<frc971::control_loops::IndexProfiledJointStatus> Iterate(
+      ::aos::monotonic_clock::time_point monotonic_now,
+      const double *unsafe_goal,
+      const frc971::ProfileParameters *unsafe_goal_profile_parameters,
+      const ::frc971::IndexPosition *position, double *output,
+      flatbuffers::FlatBufferBuilder *fbb);
 
   void Reset();