Class Trajectory

Class Documentation

class Trajectory

Holder class for trajectories of D dimensions, of K segments, and polynomial order N-1.

(N=12 -> 11th order polynomial, with 12 coefficients).

Public Functions

Trajectory()
~Trajectory()
bool operator==(const Trajectory &rhs) const
bool operator!=(const Trajectory &rhs) const
int D() const
int N() const
int K() const
bool empty() const
void clear()
void setSegments(const Segment::Vector &segments)
void addSegments(const Segment::Vector &segments)
void getSegments(Segment::Vector *segments) const
const Segment::Vector &segments() const
double getMinTime() const
double getMaxTime() const
std::vector<double> getSegmentTimes() const
Trajectory getTrajectoryWithSingleDimension(int dimension) const

Functions to create new trajectories by splitting (getting a NEW trajectory with a single dimension) or compositing (create a new trajectory with another trajectory appended).

bool getTrajectoryWithAppendedDimension(const Trajectory &trajectory_to_append, Trajectory *new_trajectory) const
bool addTrajectories(const std::vector<Trajectory> &trajectories, Trajectory *merged) const

Add trajectories with same dimensions and coefficients to this trajectory.

Vertex getVertexAtTime(double t, int max_derivative_order) const

Evaluate the vertex constraint at time t.

Vertex getStartVertex(int max_derivative_order) const

Evaluate the vertex constraint at start time.

Vertex getGoalVertex(int max_derivative_order) const

Evaluate the vertex constraint at goal time.

Eigen::VectorXd evaluate(double t, int derivative_order = derivative_order::POSITION) const

Evaluation functions.

Evaluate at a single time, and a single derivative. Return type of dimension D.

void evaluateRange(double t_start, double t_end, double dt, int derivative_order, std::vector<Eigen::VectorXd> *result, std::vector<double> *sampling_times = nullptr) const

Evaluates the trajectory in a specified range and derivative.

Outputs are a vector of the sampled values (size of VectorXd is D) by time and optionally the actual sampling times.

bool computeMinMaxMagnitude(int derivative, const std::vector<int> &dimensions, Extremum *minimum, Extremum *maximum) const

Compute the analytic minimum and maximum of magnitude for a given derivative and dimensions, e.g., [0, 1, 2] for position or [3] for yaw.

Returns false in case of extremum calculation failure.

bool computeMaxVelocityAndAcceleration(double *v_max, double *a_max) const

Compute max velocity and max acceleration. Shorthand for the method above.

bool scaleSegmentTimesToMeetConstraints(double v_max, double a_max)

This method SCALES the segment times evenly to ensure that the trajectory is feasible given the provided v_max and a_max.

Does not change the shape of the trajectory, and only increases segment times.