38 #include <boost/thread/mutex.hpp> 52 static ActiveContexts& getActiveContexts()
54 static ActiveContexts ac;
62 std::string default_pipeline;
63 if (nh.
getParam(
"default_planning_pipeline", default_pipeline) &&
64 nh.
hasParam(
"planning_pipelines/" + default_pipeline))
71 ActiveContexts& ac = getActiveContexts();
72 boost::mutex::scoped_lock _(ac.mutex_);
73 ac.contexts_.insert(
this);
78 ActiveContexts& ac = getActiveContexts();
79 boost::mutex::scoped_lock _(ac.mutex_);
80 ac.contexts_.erase(
this);
91 if (
request_.allowed_planning_time <= 0.0)
94 "The timeout for planning must be positive (%lf specified). Assuming one second instead.",
96 request_.allowed_planning_time = 1.0;
98 if (
request_.num_planning_attempts < 0)
99 ROS_ERROR_NAMED(
"planning_interface",
"The number of desired planning attempts should be positive. " 100 "Assuming one attempt.");
101 request_.num_planning_attempts = std::max(1,
request_.num_planning_attempts);
117 moveit_msgs::MoveItErrorCodes dummy;
118 return getPlanningContext(planning_scene, req, dummy);
129 config_settings_ = pcs;
134 ActiveContexts& ac = getActiveContexts();
135 boost::mutex::scoped_lock _(ac.mutex_);
136 for (std::set<PlanningContext*>::iterator it = ac.contexts_.begin(); it != ac.contexts_.end(); ++it)
void setMotionPlanRequest(const MotionPlanRequest &request)
Set the planning request for this context.
#define ROS_INFO_NAMED(name,...)
ros::NodeHandle getConfigNodeHandle(const ros::NodeHandle &nh=ros::NodeHandle("~"))
Retrieve NodeHandle/namespace defining the PlanningPipeline parameters Traditionally, these were directly defined in the private namespace of the move_group node. Since MoveIt 1.1.2 multiple pipeline configs are supported in parallel. In Melodic we support this new scheme by allowing to choose the default pipeline, specified via the parameter ~default_planning_pipeline.
std::set< PlanningContext * > contexts_
std::map< std::string, PlannerConfigurationSettings > PlannerConfigurationMap
Map from PlannerConfigurationSettings.name to PlannerConfigurationSettings.
void terminate() const
Request termination, if a solve() function is currently computing plans.
virtual PlanningContextPtr getPlanningContext(const planning_scene::PlanningSceneConstPtr &planning_scene, const MotionPlanRequest &req, moveit_msgs::MoveItErrorCodes &error_code) const =0
Construct a planning context given the current scene and a planning request. If a problem is encounte...
virtual void getPlanningAlgorithms(std::vector< std::string > &algs) const
Get the names of the known planning algorithms (values that can be filled as planner_id in the planni...
planning_scene::PlanningSceneConstPtr planning_scene_
The planning scene for this context.
bool getParam(const std::string &key, std::string &s) const
virtual bool initialize(const robot_model::RobotModelConstPtr &model, const std::string &ns)
virtual std::string getDescription() const
Get.
void setPlanningScene(const planning_scene::PlanningSceneConstPtr &planning_scene)
Set the planning scene for this context.
virtual void setPlannerConfigurations(const PlannerConfigurationMap &pcs)
Specify the settings to be used for specific algorithms.
bool hasParam(const std::string &key) const
This namespace includes the central class for representing planning contexts.
moveit_msgs::MotionPlanRequest MotionPlanRequest
virtual ~PlanningContext()
#define ROS_ERROR_NAMED(name,...)
PlanningContext(const std::string &name, const std::string &group)
Construct a planning context named name for the group group.
This namespace includes the base class for MoveIt! planners.
MotionPlanRequest request_
The planning request for this context.