39 #include <rclcpp/logger.hpp>
40 #include <rclcpp/logging.hpp>
45 static const rclcpp::Logger LOGGER = rclcpp::get_logger(
"moveit_planning_interface.planning_interface");
56 static ActiveContexts& getActiveContexts()
58 static ActiveContexts ac;
65 ActiveContexts& ac = getActiveContexts();
66 std::scoped_lock _(ac.mutex_);
67 ac.contexts_.insert(
this);
72 ActiveContexts& ac = getActiveContexts();
73 std::scoped_lock _(ac.mutex_);
74 ac.contexts_.erase(
this);
85 if (
request_.allowed_planning_time <= 0.0)
87 RCLCPP_INFO(LOGGER,
"The timeout for planning must be positive (%lf specified). Assuming one second instead.",
89 request_.allowed_planning_time = 1.0;
91 if (
request_.num_planning_attempts < 0)
92 RCLCPP_ERROR(LOGGER,
"The number of desired planning attempts should be positive. "
93 "Assuming one attempt.");
94 request_.num_planning_attempts = std::max(1,
request_.num_planning_attempts);
98 const rclcpp::Node::SharedPtr& ,
const std::string& )
111 moveit_msgs::msg::MoveItErrorCodes dummy;
128 ActiveContexts& ac = getActiveContexts();
129 std::scoped_lock _(ac.mutex_);
void terminate() const
Request termination, if a solve() function is currently computing plans.
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...
virtual std::string getDescription() const
Get.
virtual void setPlannerConfigurations(const PlannerConfigurationMap &pcs)=0
Specify the settings to be used for specific algorithms.
virtual bool initialize(const moveit::core::RobotModelConstPtr &model, const rclcpp::Node::SharedPtr &node, const std::string ¶meter_namespace)
virtual PlanningContextPtr getPlanningContext(const planning_scene::PlanningSceneConstPtr &planning_scene, const MotionPlanRequest &req, moveit_msgs::msg::MoveItErrorCodes &error_code) const =0
Construct a planning context given the current scene and a planning request. If a problem is encounte...
PlannerConfigurationMap config_settings_
All the existing planning configurations. The name of the configuration is the key of the map....
Representation of a particular planning context – the planning scene and the request are known,...
void setPlanningScene(const planning_scene::PlanningSceneConstPtr &planning_scene)
Set the planning scene for this context.
planning_scene::PlanningSceneConstPtr planning_scene_
The planning scene for this context.
MotionPlanRequest request_
The planning request for this context.
virtual bool terminate()=0
If solve() is running, terminate the computation. Return false if termination not possible....
virtual ~PlanningContext()
void setMotionPlanRequest(const MotionPlanRequest &request)
Set the planning request for this context.
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.
std::map< std::string, PlannerConfigurationSettings > PlannerConfigurationMap
Map from PlannerConfigurationSettings.name to PlannerConfigurationSettings.
moveit_msgs::msg::MotionPlanRequest MotionPlanRequest
This namespace includes the central class for representing planning contexts.
std::set< PlanningContext * > contexts_