Remove runtime malloc's from SplineDrivetrain
This lets drivetrain_lib_test pass with die_on_malloc enabled.
Change-Id: If85b2ee5635fd82ba4aaf2ef18b4736cb6099d27
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/frc971/control_loops/drivetrain/drivetrain.h b/frc971/control_loops/drivetrain/drivetrain.h
index a06b965..0d100ed 100644
--- a/frc971/control_loops/drivetrain/drivetrain.h
+++ b/frc971/control_loops/drivetrain/drivetrain.h
@@ -146,9 +146,10 @@
class DrivetrainLoop
: public frc971::controls::ControlLoop<Goal, Position, Status, Output> {
public:
- // Note that we only actually store N - 1 splines, since we need to keep one
- // fetcher free to check whether there are any new splines.
- static constexpr size_t kNumSplineFetchers = 5;
+ // Note that we only actually store N - 1 splines consistently, since we need
+ // to keep one fetcher free to check whether there are any new splines.
+ static constexpr size_t kNumSplineFetchers =
+ SplineDrivetrain::kMaxTrajectories;
// Constructs a control loop which can take a Drivetrain or defaults to the
// drivetrain at frc971::control_loops::drivetrain