40#include <Eigen/Geometry>
41#include <kdl/frames.hpp>
42#include <kdl/trajectory.hpp>
55 moveit_msgs::msg::MoveItErrorCodes::FAILURE);
59 moveit_msgs::msg::MoveItErrorCodes::INVALID_MOTION_PLAN);
65 moveit_msgs::msg::MoveItErrorCodes::INVALID_ROBOT_STATE);
69 moveit_msgs::msg::MoveItErrorCodes::INVALID_GOAL_CONSTRAINTS);
73 moveit_msgs::msg::MoveItErrorCodes::INVALID_GOAL_CONSTRAINTS);
75 moveit_msgs::msg::MoveItErrorCodes::INVALID_GOAL_CONSTRAINTS);
79 moveit_msgs::msg::MoveItErrorCodes::INVALID_GOAL_CONSTRAINTS);
81 moveit_msgs::msg::MoveItErrorCodes::INVALID_GOAL_CONSTRAINTS);
83 moveit_msgs::msg::MoveItErrorCodes::INVALID_GOAL_CONSTRAINTS);
141 double max_acceleration_scaling_factor,
142 const std::unique_ptr<KDL::Path>& path)
const;
161 virtual void extractMotionPlanInfo(
const planning_scene::PlanningSceneConstPtr& scene,
164 virtual void plan(
const planning_scene::PlanningSceneConstPtr& scene,
166 double sampling_time, trajectory_msgs::msg::JointTrajectory& joint_trajectory) = 0;
216 const trajectory_msgs::msg::JointTrajectory& joint_trajectory,
221 void checkForValidGroupName(
const std::string& group_name)
const;
234 void checkStartState(
const moveit_msgs::msg::RobotState& start_state,
const std::string& group)
const;
236 void checkGoalConstraints(
const moveit_msgs::msg::MotionPlanRequest::_goal_constraints_type& goal_constraints,
239 void checkJointGoalConstraint(
const moveit_msgs::msg::Constraints& constraint,
const std::string& group_name)
const;
241 void checkCartesianGoalConstraint(
const moveit_msgs::msg::Constraints& constraint,
249 sensor_msgs::msg::JointState filterGroupValues(
const sensor_msgs::msg::JointState& robot_state,
250 const std::string& group)
const;
255 static bool isScalingFactorValid(
double scaling_factor);
256 static void checkVelocityScaling(
double scaling_factor);
257 static void checkAccelerationScaling(
double scaling_factor);
263 static bool isCartesianGoalGiven(
const moveit_msgs::msg::Constraints& constraint);
268 static bool isJointGoalGiven(
const moveit_msgs::msg::Constraints& constraint);
274 static bool isOnlyOneGoalTypeGiven(
const moveit_msgs::msg::Constraints& constraint);
283 const std::unique_ptr<rclcpp::Clock>
clock_;
286inline bool TrajectoryGenerator::isScalingFactorValid(
double scaling_factor)
291inline bool TrajectoryGenerator::isCartesianGoalGiven(
const moveit_msgs::msg::Constraints& constraint)
293 return constraint.position_constraints.size() == 1 && constraint.orientation_constraints.size() == 1;
296inline bool TrajectoryGenerator::isJointGoalGiven(
const moveit_msgs::msg::Constraints& constraint)
298 return !constraint.joint_constraints.empty();
301inline bool TrajectoryGenerator::isOnlyOneGoalTypeGiven(
const moveit_msgs::msg::Constraints& constraint)
303 return (isJointGoalGiven(constraint) && !isCartesianGoalGiven(constraint)) ||
304 (!isJointGoalGiven(constraint) && isCartesianGoalGiven(constraint));
Representation of a robot's state. This includes position, velocity, acceleration and effort.
This class combines CartesianLimit and JointLimits into on single class.
This class is used to extract needed information from motion plan request.
std::pair< std::string, Eigen::Vector3d > circ_path_point
std::vector< Eigen::Isometry3d > waypoints
MotionPlanInfo(const planning_scene::PlanningSceneConstPtr &scene, const planning_interface::MotionPlanRequest &req)
std::map< std::string, double > goal_joint_position
planning_scene::PlanningSceneConstPtr start_scene
Eigen::Isometry3d start_pose
Eigen::Isometry3d goal_pose
std::map< std::string, double > start_joint_position
const moveit::core::RobotModelConstPtr robot_model_
double max_cartesian_speed_
static constexpr double VELOCITY_TOLERANCE
TrajectoryGenerator(const moveit::core::RobotModelConstPtr &robot_model, const pilz_industrial_motion_planner::LimitsContainer &planner_limits)
static constexpr double MIN_SCALING_FACTOR
virtual ~TrajectoryGenerator()=default
const pilz_industrial_motion_planner::LimitsContainer planner_limits_
const std::unique_ptr< rclcpp::Clock > clock_
void generate(const planning_scene::PlanningSceneConstPtr &scene, const planning_interface::MotionPlanRequest &req, planning_interface::MotionPlanResponse &res, double sampling_time=0.1)
generate robot trajectory with given sampling time
static constexpr double MAX_SCALING_FACTOR
std::unique_ptr< KDL::VelocityProfile > cartesianTrapVelocityProfile(double max_velocity_scaling_factor, double max_acceleration_scaling_factor, const std::unique_ptr< KDL::Path > &path) const
build cartesian velocity profile for the path
void setMaxCartesianSpeed(const moveit_msgs::msg::MotionPlanRequest &req)
Set the max cartesian speed from motion request.
moveit_msgs::msg::MotionPlanRequest MotionPlanRequest
Response to a planning query.
#define CREATE_MOVEIT_ERROR_CODE_EXCEPTION(EXCEPTION_CLASS_NAME, ERROR_CODE)