@@ -48,36 +48,61 @@ namespace planning_request_adapter
48
48
{
49
49
MOVEIT_CLASS_FORWARD (PlanningRequestAdapter); // Defines PlanningRequestAdapterPtr, ConstPtr, WeakPtr... etc
50
50
51
+ /* * @brief Concept in MoveIt which can be used to modify the planning problem and resulting trajectory (pre-processing
52
+ * and/or post-processing) for a motion planner. PlanningRequestAdapter enable using multiple motion planning and
53
+ * trajectory generation algorithms in sequence to produce robust motion plans.
54
+ */
51
55
class PlanningRequestAdapter
52
56
{
53
57
public:
58
+ // / \brief Functional interface to call a planning function
54
59
using PlannerFn =
55
60
std::function<bool (const planning_scene::PlanningSceneConstPtr&, const planning_interface::MotionPlanRequest&,
56
61
planning_interface::MotionPlanResponse&)>;
57
62
58
- PlanningRequestAdapter ()
59
- {
60
- }
61
-
62
- virtual ~PlanningRequestAdapter ()
63
- {
64
- }
63
+ virtual ~PlanningRequestAdapter () = default ;
65
64
66
65
/* * \brief Initialize parameters using the passed Node and parameter namespace.
66
+ * @param node Node instance used by the adapter
67
+ * @param parameter_namespace Parameter namespace for adapter
67
68
If no initialization is needed, simply implement as empty */
68
69
virtual void initialize (const rclcpp::Node::SharedPtr& node, const std::string& parameter_namespace) = 0;
69
70
70
- // / Get a short string that identifies the planning request adapter
71
+ /* * \brief Get a description of this adapter
72
+ * @return Returns a short string that identifies the planning request adapter
73
+ */
71
74
virtual std::string getDescription () const
72
75
{
73
76
return " " ;
74
77
}
75
78
79
+ /* * \brief Adapt the planning request if needed, call the planner
80
+ function \e planner and update the planning response if
81
+ needed.
82
+ * @param planner Pointer to the planner used to solve the passed problem
83
+ * @param planning_scene Representation of the environment for the planning
84
+ * @param req Motion planning request with a set of constraints
85
+ * @param res Reference to which the generated motion plan response is written to
86
+ * @return True if response got generated correctly */
76
87
bool adaptAndPlan (const planning_interface::PlannerManagerPtr& planner,
77
88
const planning_scene::PlanningSceneConstPtr& planning_scene,
78
89
const planning_interface::MotionPlanRequest& req,
79
90
planning_interface::MotionPlanResponse& res) const ;
80
91
92
+ /* * \brief Adapt the planning request if needed, call the planner
93
+ function \e planner and update the planning response if
94
+ needed. If the response is changed, the index values of the
95
+ states added without planning are added to \e
96
+ added_path_index
97
+ * @param planner Pointer to the planner used to solve the passed problem
98
+ * @param planning_scene Representation of the environment for the planning
99
+ * @param req Motion planning request with a set of constraints
100
+ * @param res Reference to which the generated motion plan response is written to
101
+ * @param added_path_index Sometimes planning request adapters may add states on the solution path (e.g.,
102
+ add the current state of the robot as prefix, when the robot started to plan only from near that state, as the
103
+ current state itself appears to touch obstacles). This is helpful because the added states should not be considered
104
+ invalid in all situations.
105
+ * @return True if response got generated correctly */
81
106
bool adaptAndPlan (const planning_interface::PlannerManagerPtr& planner,
82
107
const planning_scene::PlanningSceneConstPtr& planning_scene,
83
108
const planning_interface::MotionPlanRequest& req, planning_interface::MotionPlanResponse& res,
@@ -87,7 +112,16 @@ class PlanningRequestAdapter
87
112
function \e planner and update the planning response if
88
113
needed. If the response is changed, the index values of the
89
114
states added without planning are added to \e
90
- added_path_index */
115
+ added_path_index
116
+ * @param planner Pointer to the planner used to solve the passed problem
117
+ * @param planning_scene Representation of the environment for the planning
118
+ * @param req Motion planning request with a set of constraints
119
+ * @param res Reference to which the generated motion plan response is written to
120
+ * @param added_path_index Sometimes planning request adapters may add states on the solution path (e.g.,
121
+ add the current state of the robot as prefix, when the robot started to plan only from near that state, as the
122
+ current state itself appears to touch obstacles). This is helpful because the added states should not be
123
+ considered invalid in all situations.
124
+ * @return True if response got generated correctly */
91
125
virtual bool adaptAndPlan (const PlannerFn& planner, const planning_scene::PlanningSceneConstPtr& planning_scene,
92
126
const planning_interface::MotionPlanRequest& req,
93
127
planning_interface::MotionPlanResponse& res,
@@ -115,24 +149,35 @@ class PlanningRequestAdapter
115
149
}
116
150
};
117
151
118
- // / Apply a sequence of adapters to a motion plan
152
+ /* * \brief Apply a sequence of adapters to a motion plan */
119
153
class PlanningRequestAdapterChain
120
154
{
121
155
public:
122
- PlanningRequestAdapterChain ()
123
- {
124
- }
125
-
126
- void addAdapter (const PlanningRequestAdapterConstPtr& adapter)
127
- {
128
- adapters_.push_back (adapter);
129
- }
130
-
156
+ /* * \brief Add new adapter to the back of the chain
157
+ * @param adapter Adapter to be added */
158
+ void addAdapter (const PlanningRequestAdapterConstPtr& adapter);
159
+
160
+ /* * \brief Iterate through the chain and call all adapters and planners in the correct order
161
+ * @param planner Pointer to the planner used to solve the passed problem
162
+ * @param planning_scene Representation of the environment for the planning
163
+ * @param req Motion planning request with a set of constraints
164
+ * @param res Reference to which the generated motion plan response is written to
165
+ * @return True if response got generated correctly */
131
166
bool adaptAndPlan (const planning_interface::PlannerManagerPtr& planner,
132
167
const planning_scene::PlanningSceneConstPtr& planning_scene,
133
168
const planning_interface::MotionPlanRequest& req,
134
169
planning_interface::MotionPlanResponse& res) const ;
135
170
171
+ /* * \brief Iterate through the chain and call all adapters and planners in the correct order
172
+ * @param planner Pointer to the planner used to solve the passed problem
173
+ * @param planning_scene Representation of the environment for the planning
174
+ * @param req Motion planning request with a set of constraints
175
+ * @param res Reference to which the generated motion plan response is written to
176
+ * @param added_path_index Sometimes planning request adapters may add states on the solution path (e.g.,
177
+ add the current state of the robot as prefix, when the robot started to plan only from near that state, as the
178
+ current state itself appears to touch obstacles). This is helpful because the added states should not be
179
+ considered invalid in all situations.
180
+ * @return True if response got generated correctly */
136
181
bool adaptAndPlan (const planning_interface::PlannerManagerPtr& planner,
137
182
const planning_scene::PlanningSceneConstPtr& planning_scene,
138
183
const planning_interface::MotionPlanRequest& req, planning_interface::MotionPlanResponse& res,
0 commit comments