WPILibC++  2020.3.2-60-g3011ebe
frc::SplineHelper Class Reference

Helper class that is used to generate cubic and quintic splines from user provided waypoints. More...

#include <SplineHelper.h>

Static Public Member Functions

static std::array< Spline< 3 >::ControlVector, 2 > CubicControlVectorsFromWaypoints (const Pose2d &start, const std::vector< Translation2d > &interiorWaypoints, const Pose2d &end)
 Returns 2 cubic control vectors from a set of exterior waypoints and interior translations. More...
 
static std::vector< Spline< 5 >::ControlVector > QuinticControlVectorsFromWaypoints (const std::vector< Pose2d > &waypoints)
 Returns quintic control vectors from a set of waypoints. More...
 
static std::vector< CubicHermiteSplineCubicSplinesFromControlVectors (const Spline< 3 >::ControlVector &start, std::vector< Translation2d > waypoints, const Spline< 3 >::ControlVector &end)
 Returns a set of cubic splines corresponding to the provided control vectors. More...
 
static std::vector< QuinticHermiteSplineQuinticSplinesFromControlVectors (const std::vector< Spline< 5 >::ControlVector > &controlVectors)
 Returns a set of quintic splines corresponding to the provided control vectors. More...
 

Detailed Description

Helper class that is used to generate cubic and quintic splines from user provided waypoints.

Member Function Documentation

◆ CubicControlVectorsFromWaypoints()

static std::array<Spline<3>::ControlVector, 2> frc::SplineHelper::CubicControlVectorsFromWaypoints ( const Pose2d start,
const std::vector< Translation2d > &  interiorWaypoints,
const Pose2d end 
)
static

Returns 2 cubic control vectors from a set of exterior waypoints and interior translations.

Parameters
startThe starting pose.
interiorWaypointsThe interior waypoints.
endThe ending pose.
Returns
2 cubic control vectors.

◆ CubicSplinesFromControlVectors()

static std::vector<CubicHermiteSpline> frc::SplineHelper::CubicSplinesFromControlVectors ( const Spline< 3 >::ControlVector &  start,
std::vector< Translation2d waypoints,
const Spline< 3 >::ControlVector &  end 
)
static

Returns a set of cubic splines corresponding to the provided control vectors.

The user is free to set the direction of the start and end point. The directions for the middle waypoints are determined automatically to ensure continuous curvature throughout the path.

The derivation for the algorithm used can be found here: https://www.uio.no/studier/emner/matnat/ifi/nedlagte-emner/INF-MAT4350/h08/undervisningsmateriale/chap7alecture.pdf

Parameters
startThe starting control vector.
waypointsThe middle waypoints. This can be left blank if you only wish to create a path with two waypoints.
endThe ending control vector.
Returns
A vector of cubic hermite splines that interpolate through the provided waypoints.

◆ QuinticControlVectorsFromWaypoints()

static std::vector<Spline<5>::ControlVector> frc::SplineHelper::QuinticControlVectorsFromWaypoints ( const std::vector< Pose2d > &  waypoints)
static

Returns quintic control vectors from a set of waypoints.

Parameters
waypointsThe waypoints
Returns
List of control vectors

◆ QuinticSplinesFromControlVectors()

static std::vector<QuinticHermiteSpline> frc::SplineHelper::QuinticSplinesFromControlVectors ( const std::vector< Spline< 5 >::ControlVector > &  controlVectors)
static

Returns a set of quintic splines corresponding to the provided control vectors.

The user is free to set the direction of all waypoints. Continuous curvature is guaranteed throughout the path.

Parameters
controlVectorsThe control vectors.
Returns
A vector of quintic hermite splines that interpolate through the provided waypoints.

The documentation for this class was generated from the following file: