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);
140 double max_acceleration_scaling_factor,
141 const std::unique_ptr<KDL::Path>& path)
const;
155 virtual void extractMotionPlanInfo(
const planning_scene::PlanningSceneConstPtr& scene,
158 virtual void plan(
const planning_scene::PlanningSceneConstPtr& scene,
160 double sampling_time, trajectory_msgs::msg::JointTrajectory& joint_trajectory) = 0;
210 const trajectory_msgs::msg::JointTrajectory& joint_trajectory,
215 void checkForValidGroupName(
const std::string& group_name)
const;
228 void checkStartState(
const moveit_msgs::msg::RobotState& start_state,
const std::string& group)
const;
230 void checkGoalConstraints(
const moveit_msgs::msg::MotionPlanRequest::_goal_constraints_type& goal_constraints,
233 void checkJointGoalConstraint(
const moveit_msgs::msg::Constraints& constraint,
const std::string& group_name)
const;
235 void checkCartesianGoalConstraint(
const moveit_msgs::msg::Constraints& constraint,
243 sensor_msgs::msg::JointState filterGroupValues(
const sensor_msgs::msg::JointState& robot_state,
244 const std::string& group)
const;
249 static bool isScalingFactorValid(
double scaling_factor);
250 static void checkVelocityScaling(
double scaling_factor);
251 static void checkAccelerationScaling(
double scaling_factor);
257 static bool isCartesianGoalGiven(
const moveit_msgs::msg::Constraints& constraint);
262 static bool isJointGoalGiven(
const moveit_msgs::msg::Constraints& constraint);
268 static bool isOnlyOneGoalTypeGiven(
const moveit_msgs::msg::Constraints& constraint);
276 const std::unique_ptr<rclcpp::Clock>
clock_;
279inline bool TrajectoryGenerator::isScalingFactorValid(
double scaling_factor)
284inline bool TrajectoryGenerator::isCartesianGoalGiven(
const moveit_msgs::msg::Constraints& constraint)
286 return constraint.position_constraints.size() == 1 && constraint.orientation_constraints.size() == 1;
289inline bool TrajectoryGenerator::isJointGoalGiven(
const moveit_msgs::msg::Constraints& constraint)
291 return !constraint.joint_constraints.empty();
294inline bool TrajectoryGenerator::isOnlyOneGoalTypeGiven(
const moveit_msgs::msg::Constraints& constraint)
296 return (isJointGoalGiven(constraint) && !isCartesianGoalGiven(constraint)) ||
297 (!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::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
Base class of trajectory generators.
const moveit::core::RobotModelConstPtr robot_model_
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
moveit_msgs::msg::MotionPlanRequest MotionPlanRequest
Response to a planning query.
#define CREATE_MOVEIT_ERROR_CODE_EXCEPTION(EXCEPTION_CLASS_NAME, ERROR_CODE)