SplineHelper

class wpimath.spline.SplineHelper

Bases: pybind11_object

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

static cubicControlVectorsFromWaypoints(start: wpimath.geometry._geometry.Pose2d, interiorWaypoints: List[wpimath.geometry._geometry.Translation2d], end: wpimath.geometry._geometry.Pose2d) Tuple[wpimath.spline._spline.Spline3.ControlVector, wpimath.spline._spline.Spline3.ControlVector]

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

Parameters:
  • start – The starting pose.

  • interiorWaypoints – The interior waypoints.

  • end – The ending pose.

Returns:

2 cubic control vectors.

static cubicSplinesFromControlVectors(start: wpimath.spline._spline.Spline3.ControlVector, waypoints: List[wpimath.geometry._geometry.Translation2d], end: wpimath.spline._spline.Spline3.ControlVector) List[wpimath.spline._spline.CubicHermiteSpline]

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:
  • start – The starting control vector.

  • waypoints – The middle waypoints. This can be left blank if you only wish to create a path with two waypoints.

  • end – The ending control vector.

Returns:

A vector of cubic hermite splines that interpolate through the provided waypoints.

static quinticSplinesFromControlVectors(controlVectors: List[wpimath.spline._spline.Spline5.ControlVector]) List[wpimath.spline._spline.QuinticHermiteSpline]

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:

controlVectors – The control vectors.

Returns:

A vector of quintic hermite splines that interpolate through the provided waypoints.

static quinticSplinesFromWaypoints(waypoints: List[wpimath.geometry._geometry.Pose2d]) List[wpimath.spline._spline.QuinticHermiteSpline]

Returns quintic splines from a set of waypoints.

Parameters:

waypoints – The waypoints

Returns:

List of quintic splines.