Upgrade WPILib and upgraded compilers to C++17
I haven't touched the CTRE libraries yet, although they may need to be
upgraded as well.
Note that this change makes it so that you need either Ubuntu 18.04 or
later or debian buster or later in order to build the code (you may be
able to build code for the roborio on older operating systems, but
running the tests will not work normally).
Change-Id: I0cfa37fe37f830edde6d305e1f50414c369098e4
diff --git a/frc971/control_loops/drivetrain/libspline.cc b/frc971/control_loops/drivetrain/libspline.cc
index 1d7aa0b..5f5b02e 100644
--- a/frc971/control_loops/drivetrain/libspline.cc
+++ b/frc971/control_loops/drivetrain/libspline.cc
@@ -25,27 +25,27 @@
void deleteSpline(NSpline<6> *spline) { delete spline; }
void SplinePoint(NSpline<6> *spline, double alpha, double *res) {
- double *val = spline->Point(alpha).data();
- res[0] = val[0];
- res[1] = val[1];
+ const Eigen::Vector2d xy = spline->Point(alpha);
+ res[0] = xy.x();
+ res[1] = xy.y();
}
void SplineDPoint(NSpline<6> *spline, double alpha, double *res) {
- double *val = spline->DPoint(alpha).data();
- res[0] = val[0];
- res[1] = val[1];
+ const Eigen::Vector2d dxy = spline->DPoint(alpha);
+ res[0] = dxy.x();
+ res[1] = dxy.y();
}
void SplineDDPoint(NSpline<6> *spline, double alpha, double *res) {
- double *val = spline->DDPoint(alpha).data();
- res[0] = val[0];
- res[1] = val[1];
+ const Eigen::Vector2d ddxy = spline->DDPoint(alpha);
+ res[0] = ddxy.x();
+ res[1] = ddxy.y();
}
void SplineDDDPoint(NSpline<6> *spline, double alpha, double *res) {
- double *val = spline->DDDPoint(alpha).data();
- res[0] = val[0];
- res[1] = val[1];
+ const Eigen::Vector2d dddxy = spline->DDDPoint(alpha);
+ res[0] = dddxy.x();
+ res[1] = dddxy.y();
}
double SplineTheta(NSpline<6> *spline, double alpha) {
@@ -81,22 +81,22 @@
void deleteDistanceSpline(DistanceSpline *spline) { delete spline; }
void DistanceSplineXY(DistanceSpline *spline, double distance, double *res) {
- double *val = spline->XY(distance).data();
- res[0] = val[0];
- res[1] = val[1];
+ const Eigen::Vector2d xy = spline->XY(distance);
+ res[0] = xy.x();
+ res[1] = xy.y();
}
void DistanceSplineDXY(DistanceSpline *spline, double distance, double *res) {
- double *val = spline->DXY(distance).data();
- res[0] = val[0];
- res[1] = val[1];
+ const Eigen::Vector2d dxy = spline->DXY(distance);
+ res[0] = dxy.x();
+ res[1] = dxy.y();
}
void DistanceSplineDDXY(DistanceSpline *spline, double distance,
double *res) {
- double *val = spline->DDXY(distance).data();
- res[0] = val[0];
- res[1] = val[1];
+ const Eigen::Vector2d ddxy = spline->DDXY(distance);
+ res[0] = ddxy.x();
+ res[1] = ddxy.y();
}
double DistanceSplineTheta(DistanceSpline *spline, double distance) {
@@ -150,9 +150,9 @@
void TrajectoryPlan(Trajectory *t) { t->Plan(); }
void TrajectoryVoltage(Trajectory *t, double distance, double* res) {
- double *val = t->FFVoltage(distance).data();
- res[0] = val[0];
- res[1] = val[1];
+ const Eigen::Vector2d ff_voltage = t->FFVoltage(distance);
+ res[0] = ff_voltage.x();
+ res[1] = ff_voltage.y();
}
double TrajectoryLength(Trajectory *t) { return t->length(); }