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/frc971/control_loops/control_loops.fbs b/frc971/control_loops/control_loops.fbs
new file mode 100644
index 0000000..4f1e888
--- /dev/null
+++ b/frc971/control_loops/control_loops.fbs
@@ -0,0 +1,224 @@
+namespace frc971;
+
+// Represents all of the data for a single indexed encoder. In other words,
+// just a relative encoder with an index pulse.
+// The units on all of the positions are the same.
+// All encoder values are relative to where the encoder was at some arbitrary
+// point in time. All potentiometer values are relative to some arbitrary 0
+// position which varies with each robot.
+table IndexPosition {
+  // Current position read from the encoder.
+  encoder:double;
+  // Position from the encoder latched at the last index pulse.
+  latched_encoder:double;
+  // How many index pulses we've seen since startup. Starts at 0.
+  index_pulses:uint;
+}
+
+// Represents all of the data for a single potentiometer and indexed encoder
+// pair.
+// The units on all of the positions are the same.
+// All encoder values are relative to where the encoder was at some arbitrary
+// point in time. All potentiometer values are relative to some arbitrary 0
+// position which varies with each robot.
+table PotAndIndexPosition {
+  // Current position read from the encoder.
+  encoder:double;
+  // Current position read from the potentiometer.
+  pot:double;
+
+  // Position from the encoder latched at the last index pulse.
+  latched_encoder:double;
+  // Position from the potentiometer latched at the last index pulse.
+  latched_pot:double;
+
+  // How many index pulses we've seen since startup. Starts at 0.
+  index_pulses:uint;
+}
+
+// Represents all of the data for a single potentiometer with an absolute and
+// relative encoder pair.
+// The units on all of the positions are the same.
+// The relative encoder values are relative to where the encoder was at some
+// arbitrary point in time. All potentiometer values are relative to some
+// arbitrary 0 position which varies with each robot.
+table PotAndAbsolutePosition {
+  // Current position read from each encoder.
+  encoder:double;
+  absolute_encoder:double;
+
+  // Current position read from the potentiometer.
+  pot:double;
+}
+
+// Represents all of the data for an absolute and relative encoder pair.
+// The units on all of the positions are the same.
+// The relative encoder values are relative to where the encoder was at some
+// arbitrary point in time.
+table AbsolutePosition {
+  // Current position read from each encoder.
+  encoder:double;
+  absolute_encoder:double;
+}
+
+// The internal state of a zeroing estimator.
+table EstimatorState {
+  // If true, there has been a fatal error for the estimator.
+  error:bool;
+  // If the joint has seen an index pulse and is zeroed.
+  zeroed:bool;
+  // The estimated position of the joint.
+  position:double;
+
+  // The estimated position not using the index pulse.
+  pot_position:double;
+}
+
+// The internal state of a zeroing estimator.
+table PotAndAbsoluteEncoderEstimatorState {
+  // If true, there has been a fatal error for the estimator.
+  error:bool;
+  // If the joint has seen an index pulse and is zeroed.
+  zeroed:bool;
+  // The estimated position of the joint.
+  position:double;
+
+  // The estimated position not using the index pulse.
+  pot_position:double;
+
+  // The estimated absolute position of the encoder.  This is filtered, so it
+  // can be easily used when zeroing.
+  absolute_position:double;
+}
+
+// The internal state of a zeroing estimator.
+table AbsoluteEncoderEstimatorState {
+  // If true, there has been a fatal error for the estimator.
+  error:bool;
+  // If the joint has seen an index pulse and is zeroed.
+  zeroed:bool;
+  // The estimated position of the joint.
+  position:double;
+
+  // The estimated absolute position of the encoder.  This is filtered, so it
+  // can be easily used when zeroing.
+  absolute_position:double;
+}
+
+// The internal state of a zeroing estimator.
+table IndexEstimatorState {
+  // If true, there has been a fatal error for the estimator.
+  error:bool;
+  // If the joint has seen an index pulse and is zeroed.
+  zeroed:bool;
+  // The estimated position of the joint. This is just the position relative to
+  // where we started if we're not zeroed yet.
+  position:double;
+
+  // The positions of the extreme index pulses we've seen.
+  min_index_position:double;
+  max_index_position:double;
+  // The number of index pulses we've seen.
+  index_pulses_seen:int;
+}
+
+table HallEffectAndPositionEstimatorState {
+  // If error.
+  error:bool;
+  // If we've found a positive edge while moving backwards and is zeroed.
+  zeroed:bool;
+  // Encoder angle relative to where we started.
+  encoder:double;
+  // The positions of the extreme posedges we've seen.
+  // If we've gotten enough samples where the hall effect is high before can be
+  // certain it is not a false positive.
+  high_long_enough:bool;
+  offset:double;
+}
+
+// A left/right pair of PotAndIndexPositions.
+table PotAndIndexPair {
+  left:PotAndIndexPosition;
+  right:PotAndIndexPosition;
+}
+
+// Records edges captured on a single hall effect sensor.
+table HallEffectStruct {
+  current:bool;
+  posedge_count:int;
+  negedge_count:int;
+  posedge_value:double;
+  negedge_value:double;
+}
+
+// Records the hall effect sensor and encoder values.
+table HallEffectAndPosition {
+  // The current hall effect state.
+  current:bool;
+  // The current encoder position.
+  encoder:double;
+  // The number of positive and negative edges we've seen on the hall effect
+  // sensor.
+  posedge_count:int;
+  negedge_count:int;
+  // The values corresponding to the last hall effect sensor reading.
+  posedge_value:double;
+  negedge_value:double;
+}
+
+// Records the positions for a mechanism with edge-capturing sensors on it.
+table HallEventPositions {
+  current:double;
+  posedge:double;
+  negedge:double;
+}
+
+// Records edges captured on a single hall effect sensor.
+table PosedgeOnlyCountedHallEffectStruct {
+  current:bool;
+  posedge_count:int;
+  negedge_count:int;
+  posedge_value:double;
+}
+
+// Parameters for the motion profiles.
+table ProfileParameters {
+  // Maximum velocity for the profile.
+  max_velocity:float;
+  // Maximum acceleration for the profile.
+  max_acceleration:float;
+}
+
+enum ConstraintType : byte {
+  CONSTRAINT_TYPE_UNDEFINED,
+  LONGITUDINAL_ACCELERATION,
+  LATERAL_ACCELERATION,
+  VOLTAGE,
+  VELOCITY,
+}
+
+// Definition of a constraint on a trajectory
+table Constraint {
+  constraint_type:ConstraintType;
+
+  value:float;
+
+  // start and end distance are only checked for velocity limits.
+  start_distance:float;
+  end_distance:float;
+}
+
+// Parameters for computing a trajectory using a chain of splines and
+// constraints.
+table MultiSpline {
+  // Number of splines. The spline point arrays will be expected to have
+  // 6 + 5 * (n - 1) points in them. The endpoints are shared between
+  // neighboring splines.
+  spline_count:byte;
+  // Maximum of 36 spline points (7 splines).
+  spline_x:[float];
+  spline_y:[float];
+
+  // Maximum of 6 constraints;
+  constraints:[Constraint];
+}