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.h b/y2019/actors/auto_splines.h
index 5d79ba9..7b56c11 100644
--- a/y2019/actors/auto_splines.h
+++ b/y2019/actors/auto_splines.h
@@ -20,59 +20,72 @@
// Path off of level 2 to the far side of the rocket with a panel
static flatbuffers::Offset<frc971::MultiSpline> HABToFarRocket(
- aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder,
+ aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+ *builder,
bool is_left);
// Path from the far side of the rocket to the loading station to pickup
static flatbuffers::Offset<frc971::MultiSpline> FarRocketToHP(
- aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder,
+ aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+ *builder,
bool is_left);
// Path from the far side of the rocket to the loading station to pickup
static flatbuffers::Offset<frc971::MultiSpline> HPToFarRocket(
- aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder,
+ aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+ *builder,
bool is_left);
// Path from the far side of the rocket to close to the loading station
static flatbuffers::Offset<frc971::MultiSpline> FarRocketToNearHP(
- aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder,
+ aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+ *builder,
bool is_left);
// Splines for 2 Panels on the far reaches of the cargo ship
// Path from level 2 to 2nd cargo ship bay with a hatch panel
static flatbuffers::Offset<frc971::MultiSpline> HABToSecondCargoShipBay(
- aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder,
+ aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+ *builder,
bool is_left);
// Path from 2nd cargo ship bay to loading station
static flatbuffers::Offset<frc971::MultiSpline> SecondCargoShipBayToHP(
- aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder,
+ aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+ *builder,
bool is_left);
// Path from loading station to 3rd cargo ship bay with a hatch panel
static flatbuffers::Offset<frc971::MultiSpline> HPToThirdCargoShipBay(
- aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder,
+ aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+ *builder,
bool is_left);
// Path from 3rd cargo ship bay to near the loading station
static flatbuffers::Offset<frc971::MultiSpline> ThirdCargoShipBayToNearHP(
- aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder,
+ aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+ *builder,
bool is_left);
// Testing Splines
static flatbuffers::Offset<frc971::MultiSpline> HPToNearRocketTest(
- aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder);
+ aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+ *builder);
static flatbuffers::Offset<frc971::MultiSpline> HabToFarRocketTest(
- aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder,
+ aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+ *builder,
bool is_left);
static flatbuffers::Offset<frc971::MultiSpline> FarRocketToHPTest(
- aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder);
+ aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+ *builder);
static flatbuffers::Offset<frc971::MultiSpline> BasicSSpline(
- aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder);
+ aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+ *builder);
static flatbuffers::Offset<frc971::MultiSpline> StraightLine(
- aos::Sender<frc971::control_loops::drivetrain::Goal>::Builder *builder);
+ aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
+ *builder);
};
} // namespace actors