hermite
0.0.1
|
A natural cubic spline. More...
#include <cubic.hpp>
Public Member Functions | |
Cubic ()=default | |
Default constructor. More... | |
Cubic (const std::vector< Pose< D >> &waypoints) | |
Constructor. More... | |
Cubic (const Cubic< D > &other) | |
Copy constructor. | |
Cubic< D > & | operator= (const Cubic< D > &other) |
Assignment operator. | |
~Cubic () override=default | |
Destructor. | |
std::vector< Pose< D > > | getAllWaypoints () const |
Gets a list of all waypoints. More... | |
double | getLowestTime () const override |
Gets the lower bound of the domain of the piecewise spline function, which is the first time (lowest t-value) listed in the waypoints. More... | |
double | getHighestTime () const override |
Gets the upper bound of the domain of the piecewise spline function, which is the first time (lowest t-value) listed in the waypoints. More... | |
Vector< D > | getPos (const double t) const override |
Gets position at a certain time. More... | |
Vector< D > | getVel (const double t) const override |
Gets velocity at a certain time. More... | |
Vector< D > | getAcc (const double t) const override |
Gets acceleration of the function at a certain time. More... | |
double | getLength (const double timeStep) const override |
Gets arc length. More... | |
Public Member Functions inherited from hermite::BaseSpline< D > | |
virtual | ~BaseSpline ()=default |
Destructor. | |
double | getMaxDistance (const double timeStep) const |
Gets maximum distance from origin. More... | |
double | getMaxSpeed (const double timeStep) const |
Gets maximum speed. More... | |
double | getMaxAcceleration (const double timeStep) const |
Gets maximum magnitude of acceleration. More... | |
Public Member Functions inherited from hermite::BaseInterpol< D > | |
virtual | ~BaseInterpol ()=default |
Destructor. | |
virtual Vector< D > | operator() (const double t) const |
Gets value of the interpolation function at a certain point. More... | |
A natural cubic spline.
Given a set of poses, this class interpolates a path. However, only the velocity for the first and last poses need to be known. This class will determine velocities for the other positions such that the second derivatives match.
This class takes in an std::vector of poses and interpolates from that vector. This vector should be obtained using the Hermite class's Hermite::getAllWaypoints() method. Although the vector can be created yourself, you need to be careful and make sure there are no repeated points in time, or it may lead to undefined behavior.
The advantage of using this over Hermite is that you obtain C2 continuity. However, the path must be regenerated after changing one position, and it will affect the entire curve, giving up local control. Additionally, you cannot specify the velocities of the waypoints in between the start and end point.
Note that this class can be only used for one unique set of points. To use it for another set, it is highly recommended to insert/delete points from the Hermite class and use the output of Hermite::getAllWaypoints() to generate the points in the constructor to ensure defined behavior.
|
default |
Default constructor.
Initializes with zero waypoints
|
inline |
Constructor.
It is highly recommended to insert the points in the Hermite class first, and then use the output of Hermite::getAllWaypoints() for the constructor.
waypoints | A list of waypoints |
|
inlineoverridevirtual |
Gets acceleration of the function at a certain time.
t | Time |
Implements hermite::BaseSpline< D >.
|
inline |
Gets a list of all waypoints.
|
inlineoverridevirtual |
Gets the upper bound of the domain of the piecewise spline function, which is the first time (lowest t-value) listed in the waypoints.
Implements hermite::BaseSpline< D >.
|
inlineoverridevirtual |
Gets arc length.
timeStep | The time step to try for the arc length |
Implements hermite::BaseSpline< D >.
|
inlineoverridevirtual |
Gets the lower bound of the domain of the piecewise spline function, which is the first time (lowest t-value) listed in the waypoints.
Implements hermite::BaseSpline< D >.
|
inlineoverridevirtual |
Gets position at a certain time.
Same as calling operator()()
t | Time |
Implements hermite::BaseSpline< D >.
|
inlineoverridevirtual |
Gets velocity at a certain time.
t | Time |
Implements hermite::BaseSpline< D >.