69 virtual Eigen::VectorXd
getConfig(
double s)
const = 0;
84 Path(
const std::list<Eigen::VectorXd>& path,
double max_deviation = 0.0);
87 Eigen::VectorXd
getConfig(
double s)
const;
104 std::list<std::pair<double, bool>> switching_points_;
105 std::list<std::unique_ptr<PathSegment>> path_segments_;
112 Trajectory(
const Path& path,
const Eigen::VectorXd& max_velocity,
const Eigen::VectorXd& max_acceleration,
113 double time_step = 0.001);
134 struct TrajectoryStep
139 TrajectoryStep(
double path_pos,
double path_vel) : path_pos_(path_pos), path_vel_(path_vel)
147 bool getNextSwitchingPoint(
double path_pos, TrajectoryStep& next_switching_point,
double& before_acceleration,
148 double& after_acceleration);
149 bool getNextAccelerationSwitchingPoint(
double path_pos, TrajectoryStep& next_switching_point,
150 double& before_acceleration,
double& after_acceleration);
151 bool getNextVelocitySwitchingPoint(
double path_pos, TrajectoryStep& next_switching_point,
double& before_acceleration,
152 double& after_acceleration);
153 bool integrateForward(std::list<TrajectoryStep>& trajectory,
double acceleration);
154 void integrateBackward(std::list<TrajectoryStep>& start_trajectory,
double path_pos,
double path_vel,
155 double acceleration);
156 double getMinMaxPathAcceleration(
double path_position,
double path_velocity,
bool max);
157 double getMinMaxPhaseSlope(
double path_position,
double path_velocity,
bool max);
158 double getAccelerationMaxPathVelocity(
double path_pos)
const;
159 double getVelocityMaxPathVelocity(
double path_pos)
const;
160 double getAccelerationMaxPathVelocityDeriv(
double path_pos);
161 double getVelocityMaxPathVelocityDeriv(
double path_pos);
163 std::list<TrajectoryStep>::const_iterator getTrajectorySegment(
double time)
const;
166 Eigen::VectorXd max_velocity_;
167 Eigen::VectorXd max_acceleration_;
168 unsigned int joint_num_;
170 std::list<TrajectoryStep> trajectory_;
171 std::list<TrajectoryStep> end_trajectory_;
173 const double time_step_;
175 mutable double cached_time_;
176 mutable std::list<TrajectoryStep>::const_iterator cached_trajectory_segment_;
184 const double min_angle_change = 0.001);
201 const double max_acceleration_scaling_factor = 1.0)
const override;
220 const std::unordered_map<std::string, double>& velocity_limits,
221 const std::unordered_map<std::string, double>& acceleration_limits,
222 const double max_velocity_scaling_factor = 1.0,
223 const double max_acceleration_scaling_factor = 1.0)
const override;
241 const std::vector<moveit_msgs::msg::JointLimits>&
joint_limits,
242 const double max_velocity_scaling_factor = 1.0,
243 const double max_acceleration_scaling_factor = 1.0)
const override;
247 const Eigen::VectorXd& max_velocity,
248 const Eigen::VectorXd& max_acceleration)
const;
263 double verifyScalingFactor(
const double requested_scaling_factor,
const LimitType limit_type)
const;
265 const double path_tolerance_;
266 const double resample_dt_;
267 const double min_angle_change_;
287 const double max_velocity_scaling_factor = 1.0,
288 const double max_acceleration_scaling_factor = 1.0);
Maintain a sequence of waypoints and the time durations between these waypoints.
virtual Eigen::VectorXd getConfig(double s) const =0
virtual std::list< double > getSwitchingPoints() const =0
virtual PathSegment * clone() const =0
virtual Eigen::VectorXd getCurvature(double s) const =0
virtual Eigen::VectorXd getTangent(double s) const =0
PathSegment(double length=0.0)
Eigen::VectorXd getTangent(double s) const
std::list< std::pair< double, bool > > getSwitchingPoints() const
Return a list of all switching points as a pair (arc length to switching point, discontinuity)
Eigen::VectorXd getConfig(double s) const
Eigen::VectorXd getCurvature(double s) const
double getNextSwitchingPoint(double s, bool &discontinuity) const
Get the next switching point.
Path(const std::list< Eigen::VectorXd > &path, double max_deviation=0.0)
TimeOptimalTrajectoryGeneration(const double path_tolerance=0.1, const double resample_dt=0.1, const double min_angle_change=0.001)
bool computeTimeStamps(robot_trajectory::RobotTrajectory &trajectory, const double max_velocity_scaling_factor=1.0, const double max_acceleration_scaling_factor=1.0) const override
Compute a trajectory with waypoints spaced equally in time (according to resample_dt_)....
Eigen::VectorXd getAcceleration(double time) const
Return the acceleration vector for a given point in time.
bool isValid() const
Call this method after constructing the object to make sure the trajectory generation succeeded witho...
Eigen::VectorXd getPosition(double time) const
Return the position/configuration vector for a given point in time.
Trajectory(const Path &path, const Eigen::VectorXd &max_velocity, const Eigen::VectorXd &max_acceleration, double time_step=0.001)
Generates a time-optimal trajectory.
double getDuration() const
Returns the optimal duration of the trajectory.
Eigen::VectorXd getVelocity(double time) const
Return the velocity vector for a given point in time.
const std::unordered_map< LimitType, std::string > LIMIT_TYPES
MOVEIT_CLASS_FORWARD(TimeOptimalTrajectoryGeneration)
bool totgComputeTimeStamps(const size_t num_waypoints, robot_trajectory::RobotTrajectory &trajectory, const double max_velocity_scaling_factor=1.0, const double max_acceleration_scaling_factor=1.0)
Compute a trajectory with the desired number of waypoints. Resampling the trajectory doesn't change t...