@@ -59,10 +59,10 @@ MOVEIT_CLASS_FORWARD(PipelinePlanner);
59
59
class PipelinePlanner : public PlannerInterface
60
60
{
61
61
public:
62
- /* * Simple Constructor to use only a single pipeline
62
+ /* * \brief Simple Constructor to use only a single pipeline
63
63
* \param [in] node ROS 2 node
64
64
* \param [in] pipeline_name Name of the planning pipeline to be used.
65
- * This is also the assumed namespace where the parameters of this pipeline can be found
65
+ * This is also the assumed namespace where the parameters of this pipeline can be found.
66
66
* \param [in] planner_id Planner id to be used for planning. Empty string means default.
67
67
*/
68
68
PipelinePlanner (const rclcpp::Node::SharedPtr& node, const std::string& pipeline_name = " ompl" ,
@@ -71,13 +71,16 @@ class PipelinePlanner : public PlannerInterface
71
71
72
72
/* * \brief Constructor
73
73
* \param [in] node ROS 2 node
74
- * \param [in] pipeline_id_planner_id_map map containing pairs of pipeline and plugin names to be used for planning
75
- * \param [in] stopping_criterion_callback callback to decide when to stop parallel planning
76
- * \param [in] solution_selection_function callback to choose the best solution from multiple ran pipelines
74
+ * \param [in] pipeline_id_planner_id_map Map containing pairs of pipeline and plugin names to be used for planning
75
+ * \param [in] planning_pipelines Optional: A map with the names and initialized corresponding planning pipelines
76
+ * \param [in] stopping_criterion_callback Optional: Callback to decide when to stop parallel planning
77
+ * \param [in] solution_selection_function Optional: Callback to choose the best solution from multiple ran pipelines
77
78
*/
78
79
PipelinePlanner (
79
80
const rclcpp::Node::SharedPtr& node,
80
81
const std::unordered_map<std::string, std::string>& pipeline_id_planner_id_map,
82
+ const std::unordered_map<std::string, planning_pipeline::PlanningPipelinePtr>& planning_pipelines =
83
+ std::unordered_map<std::string, planning_pipeline::PlanningPipelinePtr>(),
81
84
const moveit::planning_pipeline_interfaces::StoppingCriterionFunction& stopping_criterion_callback = nullptr ,
82
85
const moveit::planning_pipeline_interfaces::SolutionSelectionFunction& solution_selection_function =
83
86
&moveit::planning_pipeline_interfaces::getShortestSolution);
@@ -101,7 +104,9 @@ class PipelinePlanner : public PlannerInterface
101
104
void setSolutionSelectionFunction (
102
105
const moveit::planning_pipeline_interfaces::SolutionSelectionFunction& solution_selection_function);
103
106
104
- /* * \brief If not yet done, initialize pipelines from pipeline_id_planner_id_map
107
+ /* * \brief This function is called when an MTC task that uses this solver is initialized. If no pipelines are
108
+ * configured when this function is invoked, the planning pipelines named in the 'pipeline_id_planner_id_map' are
109
+ * initialized with the given robot model.
105
110
* \param [in] robot_model robot model used to initialize the planning pipelines of this solver
106
111
*/
107
112
void init (const moveit::core::RobotModelConstPtr& robot_model) override ;
@@ -113,14 +118,15 @@ class PipelinePlanner : public PlannerInterface
113
118
* \param [in] timeout Maximum planning timeout for an individual stage that is using the pipeline planner in seconds
114
119
* \param [in] result Reference to the location where the created trajectory is stored if planning is successful
115
120
* \param [in] path_constraints Path contraints for the planning problem
116
- * \return true If the solver found a successful solution for the given planning problem
121
+ * \return MoveItErrorCode - Return MoveItErrorCodes::SUCCESS if solver found a successful solution. Otherwise,
122
+ * return an appropriate error type and message explaining why it failed.
117
123
*/
118
- Result plan ( const planning_scene::PlanningSceneConstPtr& from, const planning_scene::PlanningSceneConstPtr& to,
119
- const core::JointModelGroup* joint_model_group, double timeout ,
120
- robot_trajectory::RobotTrajectoryPtr& result,
121
- const moveit_msgs::msg::Constraints& path_constraints = moveit_msgs::msg::Constraints()) override ;
124
+ MoveItErrorCode
125
+ plan ( const planning_scene::PlanningSceneConstPtr& from, const planning_scene::PlanningSceneConstPtr& to ,
126
+ const core::JointModelGroup* joint_model_group, double timeout, robot_trajectory::RobotTrajectoryPtr& result,
127
+ const moveit_msgs::msg::Constraints& path_constraints = moveit_msgs::msg::Constraints()) override ;
122
128
123
- /* * \brief Plan a trajectory from a planning scene 'from' to a Cartesian target pose with an offset
129
+ /* * \brief Plan a trajectory from a planning scene 'from' to a target pose with an offset
124
130
* \param [in] from Start planning scene
125
131
* \param [in] link Link for which a target pose is given
126
132
* \param [in] offset Offset to be applied to a given target pose
@@ -129,18 +135,27 @@ class PipelinePlanner : public PlannerInterface
129
135
* \param [in] timeout Maximum planning timeout for an individual stage that is using the pipeline planner in seconds
130
136
* \param [in] result Reference to the location where the created trajectory is stored if planning is successful
131
137
* \param [in] path_constraints Path contraints for the planning problem
132
- * \return true If the solver found a successful solution for the given planning problem
138
+ * \return MoveItErrorCode - Return MoveItErrorCodes::SUCCESS if solver found a successful solution. Otherwise,
139
+ * return an appropriate error type and message explaining why it failed.
140
+ */
141
+ MoveItErrorCode
142
+ plan (const planning_scene::PlanningSceneConstPtr& from, const moveit::core::LinkModel& link,
143
+ const Eigen::Isometry3d& offset, const Eigen::Isometry3d& target,
144
+ const moveit::core::JointModelGroup* joint_model_group, double timeout,
145
+ robot_trajectory::RobotTrajectoryPtr& result,
146
+ const moveit_msgs::msg::Constraints& path_constraints = moveit_msgs::msg::Constraints()) override ;
147
+
148
+ /* *
149
+ * \brief Get planner name
150
+ * \return Name of the last successful planner
133
151
*/
134
- Result plan (const planning_scene::PlanningSceneConstPtr& from, const moveit::core::LinkModel& link,
135
- const Eigen::Isometry3d& offset, const Eigen::Isometry3d& target,
136
- const moveit::core::JointModelGroup* joint_model_group, double timeout,
137
- robot_trajectory::RobotTrajectoryPtr& result,
138
- const moveit_msgs::msg::Constraints& path_constraints = moveit_msgs::msg::Constraints()) override ;
139
-
140
152
std::string getPlannerId () const override { return last_successful_planner_; }
141
153
142
154
protected:
143
- /* * \brief Actual plan() implementation, targeting the given goal_constraints.
155
+ /* * \brief Function that actually uses the planning pipelines to solve the given planning problem. It is called by
156
+ * the public plan function after the goal constraints are generated. This function uses a predefined number of
157
+ * planning pipelines in parallel to solve the planning problem and choose the best (user-defined) solution.
158
+ * \param [in] planning_scene Scene for which the planning should be solved
144
159
* \param [in] planning_scene Scene for which the planning should be solved
145
160
* \param [in] joint_model_group Group of joints for which this trajectory is created
146
161
* \param [in] goal_constraints Set of constraints that need to be satisfied by the solution
@@ -149,17 +164,18 @@ class PipelinePlanner : public PlannerInterface
149
164
* \param [in] path_constraints Path contraints for the planning problem
150
165
* \return true if the solver found a successful solution for the given planning problem
151
166
*/
152
- Result plan (const planning_scene::PlanningSceneConstPtr& planning_scene,
153
- const moveit::core::JointModelGroup* joint_model_group,
154
- const moveit_msgs::msg::Constraints& goal_constraints, double timeout,
155
- robot_trajectory::RobotTrajectoryPtr& result,
156
- const moveit_msgs::msg::Constraints& path_constraints = moveit_msgs::msg::Constraints());
167
+ MoveItErrorCode plan (const planning_scene::PlanningSceneConstPtr& planning_scene,
168
+ const moveit::core::JointModelGroup* joint_model_group,
169
+ const moveit_msgs::msg::Constraints& goal_constraints, double timeout,
170
+ robot_trajectory::RobotTrajectoryPtr& result,
171
+ const moveit_msgs::msg::Constraints& path_constraints = moveit_msgs::msg::Constraints());
157
172
158
173
rclcpp::Node::SharedPtr node_;
159
174
160
175
std::string last_successful_planner_;
161
176
162
- /* * \brief Map of instantiated (and named) planning pipelines. */
177
+ /* * \brief Map of pipelines names and planning pipelines. This map is used to quickly search for a requested motion
178
+ * planning pipeline when during plan(..) */
163
179
std::unordered_map<std::string, planning_pipeline::PlanningPipelinePtr> planning_pipelines_;
164
180
165
181
moveit::planning_pipeline_interfaces::StoppingCriterionFunction stopping_criterion_callback_;
0 commit comments