55 : runtime_error(what_arg) {}
75 std::vector<PoseWithCurvature> splinePoints;
78 splinePoints.push_back(spline.
GetPoint(t0));
82 std::stack<StackContents> stack;
83 stack.emplace(StackContents{t0, t1});
85 StackContents current;
90 while (!stack.empty()) {
91 current = stack.top();
96 const auto twist = start.first.Log(end.first);
101 stack.emplace(StackContents{(current.t0 + current.t1) / 2, current.t1});
102 stack.emplace(StackContents{current.t0, (current.t0 + current.t1) / 2});
104 splinePoints.push_back(spline.
GetPoint(current.t1));
107 if (iterations++ >= kMaxIterations) {
109 "Could not parameterize a malformed spline. "
110 "This means that you probably had two or more adjacent "
111 "waypoints that were very close together with headings "
112 "in opposing directions.");
121 static constexpr units::meter_t kMaxDx = 5_in;
122 static constexpr units::meter_t kMaxDy = 0.05_in;
123 static constexpr units::radian_t kMaxDtheta = 0.0872_rad;
125 struct StackContents {
137 static constexpr int kMaxIterations = 5000;
139 friend class CubicHermiteSplineTest;
140 friend class QuinticHermiteSplineTest;
#define WPILIB_DLLEXPORT
Definition: SymbolExports.h:36
Represents a two-dimensional parametric spline that interpolates between two points.
Definition: Spline.h:25
PoseWithCurvature GetPoint(double t) const
Gets the pose and curvature at some point t on the spline.
Definition: Spline.h:60
Class used to parameterize a spline by its arc length.
Definition: SplineParameterizer.h:49
static std::vector< PoseWithCurvature > Parameterize(const Spline< Dim > &spline, double t0=0.0, double t1=1.0)
Parametrizes the spline.
Definition: SplineParameterizer.h:72
std::pair< Pose2d, units::curvature_t > PoseWithCurvature
Definition: SplineParameterizer.h:51
UnitType abs(const UnitType x) noexcept
Compute absolute value.
Definition: math.h:721
Definition: AprilTagPoseEstimator.h:15