Fix some undefined behavior in Trajectory
Some of our passes were accessing the Nth element of a vector with
length N-1...
Change-Id: Ic97c552af0468e5e212ead99efb4f1856d9358ff
diff --git a/frc971/control_loops/drivetrain/trajectory.cc b/frc971/control_loops/drivetrain/trajectory.cc
index 43b1c30..4da3dee 100644
--- a/frc971/control_loops/drivetrain/trajectory.cc
+++ b/frc971/control_loops/drivetrain/trajectory.cc
@@ -37,7 +37,7 @@
? ::std::max(100, static_cast<int>(spline_->length() / 0.0025))
: num_distance,
vmax),
- plan_segment_type_(plan_.size() - 1, SegmentType::VELOCITY_LIMITED) {}
+ plan_segment_type_(plan_.size(), SegmentType::VELOCITY_LIMITED) {}
void Trajectory::LateralAccelPass() {
for (size_t i = 0; i < plan_.size(); ++i) {