Loading...
Searching...
No Matches
CommonMath::Trajectory Class Reference

Represents a qunitic polynomial in 3D. More...

#include </home/thodoris/src/ompl/demos/multicopter/CommonMath/Trajectory.h>

Public Member Functions

 Trajectory (std::vector< Vec3 > coeffs, double startTime, double endTime)
 Constructor.
 Trajectory (Vec3 c0, Vec3 c1, Vec3 c2, Vec3 c3, Vec3 c4, Vec3 c5, double startTime, double endTime)
 Constructor.
Vec3 GetVelocity (double t) const
 Returns the 3D velocity of the polynomial at a given time.
Vec3 GetValue (double t) const
 Returns the 3D position of the polynomial at a given time.
std::vector< Vec3GetCoeffs ()
 Return the 3D vector of coefficients.
double GetStartTime () const
 Return the start time of the trajectory.
double GetEndTime () const
 Return the end time of the trajectory.
std::vector< Vec3GetDerivativeCoeffs () const
 Returns the coefficient of the time derivative of the trajectory.
Trajectory operator- (const Trajectory rhs)
 Returns the difference between this trajectory and a given trajectory.
Vec3 operator[] (int i) const
 Returns the i-th 3D vector of coefficients.

Detailed Description

Represents a qunitic polynomial in 3D.

The polynomial is a function of time and is of the form c[0]*t^5 + c[1]*t^4 + c[2]*t^3 + c[3]*t^2 + c[4]*t + c[5] where each coefficient is a vector with three dimensions. The polynomial is only defined between given start and end times.

Definition at line 34 of file Trajectory.h.

Constructor & Destructor Documentation

◆ Trajectory() [1/2]

CommonMath::Trajectory::Trajectory ( std::vector< Vec3 > coeffs,
double startTime,
double endTime )
inline

Constructor.

Parameters
coeffsThe six 3D coefficients defining the polynomial. The coefficients are ordered such that coeffs[0] corresponds to t^5, coeffs[1] to t^4 and so forth.
startTimeThe earliest time at which the polynomial is defined
endTimeThe latest time at which the polynomial is defined

Definition at line 45 of file Trajectory.h.

◆ Trajectory() [2/2]

CommonMath::Trajectory::Trajectory ( Vec3 c0,
Vec3 c1,
Vec3 c2,
Vec3 c3,
Vec3 c4,
Vec3 c5,
double startTime,
double endTime )
inline

Constructor.

Parameters
c0Coefficients for t^5
c1Coefficients for t^4
c2Coefficients for t^3
c3Coefficients for t^2
c4Coefficients for t
c5Constant terms
startTimeThe earliest time at which the polynomial is defined
endTimeThe latest time at which the polynomial is defined

Definition at line 63 of file Trajectory.h.

Member Function Documentation

◆ GetCoeffs()

std::vector< Vec3 > CommonMath::Trajectory::GetCoeffs ( )
inline

Return the 3D vector of coefficients.

Definition at line 96 of file Trajectory.h.

◆ GetDerivativeCoeffs()

std::vector< Vec3 > CommonMath::Trajectory::GetDerivativeCoeffs ( ) const
inline

Returns the coefficient of the time derivative of the trajectory.

Returns
A 5D vector of 3D coefficients representing the time derivative of the trajectory, where derivCoeffs[0] is a 3D vector of coefficients corresponding to t^4, derivCoeffs[1] corresponds to t^3, etc.

Definition at line 119 of file Trajectory.h.

◆ GetEndTime()

double CommonMath::Trajectory::GetEndTime ( ) const
inline

Return the end time of the trajectory.

Definition at line 108 of file Trajectory.h.

◆ GetStartTime()

double CommonMath::Trajectory::GetStartTime ( ) const
inline

Return the start time of the trajectory.

Definition at line 102 of file Trajectory.h.

◆ GetValue()

Vec3 CommonMath::Trajectory::GetValue ( double t) const
inline

Returns the 3D position of the polynomial at a given time.

Parameters
tTime at which to evaluate the polynomial (must be between startTime and endTime)
Returns
Position of trajectory at time t

Definition at line 87 of file Trajectory.h.

◆ GetVelocity()

Vec3 CommonMath::Trajectory::GetVelocity ( double t) const
inline

Returns the 3D velocity of the polynomial at a given time.

Parameters
tTime at which to evaluate the polynomial (must be between startTime and endTime)
Returns
Position of trajectory at time t

Definition at line 74 of file Trajectory.h.

◆ operator-()

Trajectory CommonMath::Trajectory::operator- ( const Trajectory rhs)
inline

Returns the difference between this trajectory and a given trajectory.

The trajectory that is returned is only defined at times where both trajectories are defined (both trajectories must overlap in time). The returned trajectory is the relative position of the two trajectories in time.

Definition at line 137 of file Trajectory.h.

◆ operator[]()

Vec3 CommonMath::Trajectory::operator[] ( int i) const
inline

Returns the i-th 3D vector of coefficients.

Definition at line 146 of file Trajectory.h.


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