12 namespace trajectory {
22 std::vector<HebiTrajectoryPtr> trajectories_;
27 const size_t number_of_joints_;
32 const size_t number_of_waypoints_;
37 const double start_time_;
42 const double end_time_;
47 Trajectory(std::vector<HebiTrajectoryPtr> trajectories,
size_t number_of_waypoints,
double start_time,
69 static Eigen::VectorXd estimateSegmentTimes(
const Eigen::MatrixXd& positions,
const Eigen::VectorXd& max_velocities,
70 const Eigen::VectorXd& max_accelerations,
71 const HebiTimeEstimationParams& params,
double min_segment_time = 0.01);
103 const Eigen::MatrixXd& positions,
104 const Eigen::MatrixXd* velocities =
nullptr,
105 const Eigen::MatrixXd* accelerations =
nullptr);
157 static std::shared_ptr<Trajectory>
createJerkazoidal(
const Eigen::VectorXd& start_position,
158 const Eigen::VectorXd& end_position,
159 const Eigen::VectorXd& const_speed,
160 double start_ramp_time,
double end_ramp_time,
161 const Eigen::VectorXd* start_velocities =
nullptr,
162 const Eigen::VectorXd* end_velocities =
nullptr,
163 const Eigen::VectorXd* start_accelerations =
nullptr,
164 const Eigen::VectorXd* end_accelerations =
nullptr);
169 static std::shared_ptr<Trajectory>
createJerkazoidal(
double start_position,
double end_position,
double const_speed,
170 double start_ramp_time,
double end_ramp_time,
171 double start_velocity = 0.0,
double end_velocity = 0.0,
172 double start_acceleration = 0.0,
double end_acceleration = 0.0);
222 bool getState(
double time, Eigen::VectorXd* position, Eigen::VectorXd* velocity, Eigen::VectorXd* acceleration)
const;
237 bool getMinMaxPosition(Eigen::VectorXd& min_position, Eigen::VectorXd& max_position);
332 const Eigen::VectorXd& max_velocities,
333 const Eigen::VectorXd& max_accelerations,
334 double fabian_constant = 6.5,
double min_segment_time = 0.01) {
335 HebiTimeEstimationParams params;
336 params.method = HebiTimeEstimationMethod::HebiTimeEstimationNFabian;
337 params.params.n_fabian_params.magic_fabian_constant = fabian_constant;
338 return estimateSegmentTimes(positions, max_velocities, max_accelerations, params, min_segment_time);
363 const Eigen::VectorXd& max_velocities,
364 const Eigen::VectorXd& max_accelerations,
365 double min_segment_time = 0.01) {
366 HebiTimeEstimationParams params;
367 params.method = HebiTimeEstimationMethod::HebiTimeEstimationVelocityRamp;
368 return estimateSegmentTimes(positions, max_velocities, max_accelerations, params, min_segment_time);
static Eigen::VectorXd segmentTimesToWaypointTimes(const Eigen::VectorXd &segment_times)
Converts a vector of segment times to a vector of time values at each waypoint. The first element of ...
Definition: trajectory.cpp:142
double getDuration() const
The time (in seconds) between the start and end of this trajectory.
Definition: trajectory.cpp:87
bool rescale(double scale)
Rescales a trajectory by a time factor.
Definition: trajectory.cpp:131
static Eigen::VectorXd estimateSegmentTimesNFabian(const Eigen::MatrixXd &positions, const Eigen::VectorXd &max_velocities, const Eigen::VectorXd &max_accelerations, double fabian_constant=6.5, double min_segment_time=0.01)
Estimates the time required to move between waypoints using the N-Fabian method. It uses the both dis...
Definition: trajectory.hpp:331
bool getMinMaxPosition(Eigen::VectorXd &min_position, Eigen::VectorXd &max_position)
Returns the minimum and maximum positions reached by each joint over the entire trajectory....
Definition: trajectory.cpp:104
size_t getJointCount() const
The number of independent position trajectories over the same time domain that are managed by this ob...
Definition: trajectory.hpp:183
double getStartTime() const
Get the time (in seconds) at which the defined trajectory begins.
Definition: trajectory.hpp:193
#define HEBI_DISABLE_COPY_MOVE(Class)
Definition: util.hpp:6
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.
Definition: trajectory.cpp:92
static Eigen::VectorXd waypointTimesToSegmentTimes(const Eigen::VectorXd &waypoint_times)
Converts a vector of time values at each waypoint to a vector of segment times.
Definition: trajectory.cpp:158
size_t getWaypointCount() const
The number of fixed waypoints that each joint is moving through.
Definition: trajectory.hpp:188
bool getMaxAcceleration(Eigen::VectorXd &max_acceleration)
Returns the maximum absolute acceleration reached by each joint over the entire trajectory....
Definition: trajectory.cpp:122
bool getMaxVelocity(Eigen::VectorXd &max_velocity)
Returns the maximum absolute velocity reached by each joint over the entire trajectory....
Definition: trajectory.cpp:113
double getEndTime() const
Get the time (in seconds) at which the defined trajectory ends.
Definition: trajectory.hpp:198
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 a...
Definition: trajectory.cpp:17
Represents a smooth trajectory through a set of waypoints.
Definition: trajectory.hpp:17
static std::shared_ptr< Trajectory > createJerkazoidal(const Eigen::VectorXd &start_position, const Eigen::VectorXd &end_position, const Eigen::VectorXd &const_speed, double start_ramp_time, double end_ramp_time, const Eigen::VectorXd *start_velocities=nullptr, const Eigen::VectorXd *end_velocities=nullptr, const Eigen::VectorXd *start_accelerations=nullptr, const Eigen::VectorXd *end_accelerations=nullptr)
Creates a constant velocity trajectory with smooth ramp-up and ramp-down phases.
Definition: trajectory.cpp:227
~Trajectory() noexcept
Destructor cleans up resources for trajectory.
Definition: trajectory.cpp:82
static Eigen::VectorXd estimateSegmentTimesTrapezoidal(const Eigen::MatrixXd &positions, const Eigen::VectorXd &max_velocities, const Eigen::VectorXd &max_accelerations, double min_segment_time=0.01)
Estimates the time required to move between waypoints based on the trapezoidal velocity profiles and ...
Definition: trajectory.hpp:362