Class Trajectory

Class Documentation

class Trajectory

Represents a smooth trajectory through a set of waypoints.

Public Functions

~Trajectory() noexcept

Destructor cleans up resources for trajectory.

inline size_t getJointCount() const

The number of independent position trajectories over the same time domain that are managed by this object.

inline size_t getWaypointCount() const

The number of fixed waypoints that each joint is moving through.

inline double getStartTime() const

Get the time (in seconds) at which the defined trajectory begins.

inline double getEndTime() const

Get the time (in seconds) at which the defined trajectory ends.

double getDuration() const

The time (in seconds) between the start and end of this trajectory.

bool getState(double time, Eigen::VectorXd *position, Eigen::VectorXd *velocity, Eigen::VectorXd *acceleration) const

Returns the position, velocity, and acceleration for a given point in time along the trajectory.

Parameters:
  • time – The time for which the trajectory state is being queried. This should be between the start and end of the trajectory.

  • position – If not nullptr, this vector is filled in with the position along the trajectory for each joint at the given time.

  • velocity – If not nullptr, this vector is filled in with the velocity along the trajectory for each joint at the given time.

  • acceleration – If not nullptr, this vector is filled in with the acceleration along the trajectory for each joint at the given time.

Public Static Functions

static std::shared_ptr<Trajectory> createUnconstrainedQp(const Eigen::VectorXd &time_vector, const Eigen::MatrixXd &positions, const Eigen::MatrixXd *velocities = nullptr, const Eigen::MatrixXd *accelerations = nullptr)

Creates a smooth trajectory through a set of waypoints (position velocity and accelerations defined at particular times). This trajectory wrapper object can create multi-dimensional trajectories (i.e., multiple joints moving together using the same time reference).

Parameters:
  • time_vector – A vector of desired times at which to reach each waypoint; this must be defined (and not NAN for any element).

  • positions – A matrix of waypoint joint positions (in SI units). The number of rows should be equal to the number of joints, and the number of columns equal to the number of waypoints. Any elements that are NAN will be considered free parameters when solving for a trajectory. Values of +/-infinity are not allowed.

  • velocities – An optional matrix of velocity constraints at the corresponding waypoints; should either be nullptr or matching the size of the positions matrix. Any elements that are NAN will be considered free parameters when solving for a trajectory. Values of +/-infinity are not allowed.

  • accelerations – An optional matrix of acceleration constraints at the corresponding waypoints; should either be nullptr or matching the size of the positions matrix. Any elements that are NAN will be considered free parameters when solving for a trajectory. Values of +/-infinity are not allowed.

Returns:

A HebiTrajectory object if there were no errors, and the trajectory has been created. An empty shared_ptr indicates that there was an error in creating the trajectory.