hermite
0.0.1
|
#include <hermite.hpp>
Public Member Functions | |
Hermite () | |
Default constructor. More... | |
Hermite (const double multiplier) | |
Constructor. More... | |
Hermite (const Hermite< D > &other) | |
Copy constructor. | |
Hermite< D > & | operator= (const Hermite< D > &other) |
Assignment operator. More... | |
~Hermite () override=default | |
Destructor. | |
void | insert (const Pose< D > &waypoint) |
Inserts a waypoint. More... | |
void | replace (const Pose< D > &waypoint) |
Replaces a waypoint. More... | |
void | insertOrReplace (const Pose< D > &waypoint) |
Inserts a waypoint if it doesn't exist, otherwise replaces the waypoint. More... | |
bool | exists (const Pose< D > &waypoint) const |
Checks if a waypoint exists. More... | |
bool | exists (const double time) const |
Checks if a waypoint at a certain time exists. More... | |
void | erase (const Pose< D > &waypoint) |
Removes a waypoint. More... | |
void | erase (const double time) |
Removes a waypoint. More... | |
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 last time (highest 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... | |
Hermite spline class.
Given a set of poses (i.e. a desired position and velocity at a certain time), this class interpolates a path between these poses by using Hermite splines. It does this by interpolating a Hermite function between each pose using HermiteSub, and matching the final position and velocity of one pose with the initial position and velocity of the next.
This class can work with multiple dimensions, specified in the template argument. For example, if the path you want to interpolate is 2-dimensional, then specify "2" in the template argument.
This class acts like a std::map, where the key is the time. This is to ensure maximum efficiency inserting, removing, changing, and searching for the interpoloation equations. However, because time is a floating point number, and they are always imprecise, it needs to be converted into an integer. It does this by multiplying the time by a certain multiplier and truncating the rest of the digits. This is fine for most cases, as the time does not need to be super precise.
Hermite curves allow for fast local control, meaning that inserting and removing points is quick. However, it only provides C1 continuity, which means that there may be high jerk at knot points (as acceleration is discontinuous).
|
inline |
Default constructor.
Sets multiplier to 10, meaning that it shifts the decimal place of the given time by 1 digit before truncating the rest of the number whenever it is stored as a waypoint.
|
inline |
Constructor.
multiplier | Multiplies the time given in the pose by the multiplier, then truncates the rest of the digits when storing the waypoint. |
|
inline |
Removes a waypoint.
time | Time of waypoint to remove |
|
inline |
Removes a waypoint.
waypoint | Waypoint to remove |
|
inline |
Checks if a waypoint at a certain time exists.
time | Checks if a waypoint exists at this time |
|
inline |
Checks if a waypoint exists.
waypoint | Checks if this waypoint exists |
|
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 last time (highest 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 >.
|
inline |
Inserts a waypoint.
waypoint | Waypoint to insert |
|
inline |
Inserts a waypoint if it doesn't exist, otherwise replaces the waypoint.
waypoint | Waypoint to insert or replace |
|
inline |
Assignment operator.
|
inline |
Replaces a waypoint.
waypoint | Waypoint to replace |