Refactor trajectory generation to separate process

This pulls all the trajectory planning into a TrajectoryGenerator class,
which produces a Trajectory spline that the drivetrain code can consume
and use to track the spline.

Broadly speaking, this change:
- Separates the Trajectory class into a generation class and a
  FinishedTrajectory class, where the generator produces a flatbuffer
  and the FinishedTrajectory reads all the required information from
  the flatbuffer.
- Add an option for serialization/deserialization of a DistanceSpline.
- Removes some dead code from Trajectory class (mostly having to do with
  the old feedback algorithm).
- Uses floats in more places, to keep the size of the Trajectory
  flatbuffer under control
- Update the tests & autonomous code to use the new spline code.

Further work that may make sense:
- Experiment with alternatives to current structure of the Trajectory
  flatbuffer to see whether (a) the size is a problem; and (b) if so,
  what we should do about it.
- Add shims to allow replaying logfiles with old-style spline goals.

Change-Id: Ic80ce4e384ec4d1bd22940580e3652ecd305b352
diff --git a/y2019/actors/auto_splines.cc b/y2019/actors/auto_splines.cc
index 397229c..67f9e85 100644
--- a/y2019/actors/auto_splines.cc
+++ b/y2019/actors/auto_splines.cc
@@ -6,10 +6,10 @@
 namespace actors {
 
 void MaybeFlipSpline(
-    aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder,
+    aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+        *builder,
     flatbuffers::Offset<flatbuffers::Vector<float>> spline_y_offset,
     bool is_left) {
-
   flatbuffers::Vector<float> *spline_y =
       GetMutableTemporaryPointer(*builder->fbb(), spline_y_offset);
 
@@ -22,7 +22,8 @@
 
 // Path off of level 2 to the far side of the rocket with a panel
 flatbuffers::Offset<frc971::MultiSpline> AutonomousSplines::HABToFarRocket(
-    aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder,
+    aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+        *builder,
     bool is_left) {
   flatbuffers::Offset<frc971::Constraint> longitudinal_constraint_offset;
   flatbuffers::Offset<frc971::Constraint> lateral_constraint_offset;
@@ -97,7 +98,8 @@
 
 // Path from the far side of the rocket to the loading station to pickup
 flatbuffers::Offset<frc971::MultiSpline> AutonomousSplines::FarRocketToHP(
-    aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder,
+    aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+        *builder,
     bool is_left) {
   flatbuffers::Offset<frc971::Constraint> longitudinal_constraint_offset;
   flatbuffers::Offset<frc971::Constraint> lateral_constraint_offset;
@@ -170,7 +172,8 @@
 
 // Path from the human player station to the far side of the rocket with a panel
 flatbuffers::Offset<frc971::MultiSpline> AutonomousSplines::HPToFarRocket(
-    aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder,
+    aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+        *builder,
     bool is_left) {
   flatbuffers::Offset<frc971::Constraint> longitudinal_constraint_offset;
   flatbuffers::Offset<frc971::Constraint> lateral_constraint_offset;
@@ -245,7 +248,8 @@
 
 // Path from the far side of the rocket to close to the loading station
 flatbuffers::Offset<frc971::MultiSpline> AutonomousSplines::FarRocketToNearHP(
-    aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder,
+    aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+        *builder,
     bool is_left) {
   // TODO(theo): Add some real constraints.
   flatbuffers::Offset<flatbuffers::Vector<float>> spline_x_offset =
@@ -269,8 +273,10 @@
 }
 
 // Path from level 2 to 2nd cargo ship bay with a hatch panel
-flatbuffers::Offset<frc971::MultiSpline> AutonomousSplines::HABToSecondCargoShipBay(
-    aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder,
+flatbuffers::Offset<frc971::MultiSpline>
+AutonomousSplines::HABToSecondCargoShipBay(
+    aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+        *builder,
     bool is_left) {
   flatbuffers::Offset<frc971::Constraint> longitudinal_constraint_offset;
   flatbuffers::Offset<frc971::Constraint> voltage_constraint_offset;
@@ -335,8 +341,10 @@
 }
 
 // Path from 2nd cargo ship bay to loading station
-flatbuffers::Offset<frc971::MultiSpline> AutonomousSplines::SecondCargoShipBayToHP(
-    aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder,
+flatbuffers::Offset<frc971::MultiSpline>
+AutonomousSplines::SecondCargoShipBayToHP(
+    aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+        *builder,
     bool is_left) {
   flatbuffers::Offset<frc971::Constraint> voltage_constraint_offset;
   flatbuffers::Offset<frc971::Constraint> velocity_constraint_offset;
@@ -390,8 +398,10 @@
 }
 
 // Path from loading station to 3rd cargo ship bay with a hatch panel
-flatbuffers::Offset<frc971::MultiSpline> AutonomousSplines::HPToThirdCargoShipBay(
-    aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder,
+flatbuffers::Offset<frc971::MultiSpline>
+AutonomousSplines::HPToThirdCargoShipBay(
+    aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+        *builder,
     bool is_left) {
   flatbuffers::Offset<frc971::Constraint> voltage_constraint_offset;
   flatbuffers::Offset<frc971::Constraint> velocity_constraint_offset;
@@ -456,8 +466,10 @@
 }
 
 // Path from 3rd cargo ship bay to near the loading station
-flatbuffers::Offset<frc971::MultiSpline> AutonomousSplines::ThirdCargoShipBayToNearHP(
-    aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder,
+flatbuffers::Offset<frc971::MultiSpline>
+AutonomousSplines::ThirdCargoShipBayToNearHP(
+    aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+        *builder,
     bool is_left) {
   flatbuffers::Offset<frc971::Constraint> velocity_constraint_offset;
 
@@ -500,7 +512,8 @@
 }
 
 flatbuffers::Offset<frc971::MultiSpline> AutonomousSplines::HabToFarRocketTest(
-    aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder,
+    aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+        *builder,
     bool is_left) {
   flatbuffers::Offset<frc971::Constraint> longitudinal_constraint_offset;
   flatbuffers::Offset<frc971::Constraint> lateral_constraint_offset;
@@ -574,7 +587,8 @@
 }
 
 flatbuffers::Offset<frc971::MultiSpline> AutonomousSplines::FarRocketToHPTest(
-    aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder) {
+    aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+        *builder) {
   flatbuffers::Offset<frc971::Constraint> longitudinal_constraint_offset;
   flatbuffers::Offset<frc971::Constraint> lateral_constraint_offset;
   flatbuffers::Offset<frc971::Constraint> voltage_constraint_offset;
@@ -642,7 +656,8 @@
 }
 
 flatbuffers::Offset<frc971::MultiSpline> AutonomousSplines::HPToNearRocketTest(
-    aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder) {
+    aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+        *builder) {
   flatbuffers::Offset<frc971::Constraint> longitudinal_constraint_offset;
   flatbuffers::Offset<frc971::Constraint> lateral_constraint_offset;
   flatbuffers::Offset<frc971::Constraint> voltage_constraint_offset;
@@ -710,7 +725,8 @@
 }
 
 flatbuffers::Offset<frc971::MultiSpline> AutonomousSplines::BasicSSpline(
-    aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder) {
+    aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+        *builder) {
   flatbuffers::Offset<frc971::Constraint> longitudinal_constraint_offset;
   flatbuffers::Offset<frc971::Constraint> lateral_constraint_offset;
   flatbuffers::Offset<frc971::Constraint> voltage_constraint_offset;
@@ -772,7 +788,8 @@
 }
 
 flatbuffers::Offset<frc971::MultiSpline> AutonomousSplines::StraightLine(
-    aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder) {
+    aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+        *builder) {
   flatbuffers::Offset<flatbuffers::Vector<float>> spline_x_offset =
       builder->fbb()->CreateVector<float>(
           {-12.3, -11.9, -11.5, -11.1, -10.6, -10.0});