47
47
#include < mbf_msgs/CheckPath.h>
48
48
#include < mbf_msgs/CheckPose.h>
49
49
#include < mbf_msgs/CheckPoint.h>
50
+ #include < mbf_msgs/FindValidPose.h>
50
51
51
52
#include < nav_core/base_global_planner.h>
52
53
#include < nav_core/base_local_planner.h>
@@ -71,8 +72,8 @@ namespace mbf_costmap_nav
71
72
* @brief Classes belonging to the Move Base Server level.
72
73
*/
73
74
74
-
75
- typedef boost::shared_ptr<dynamic_reconfigure::Server<mbf_costmap_nav::MoveBaseFlexConfig> > DynamicReconfigureServerCostmapNav;
75
+ typedef boost::shared_ptr<dynamic_reconfigure::Server<mbf_costmap_nav::MoveBaseFlexConfig> >
76
+ DynamicReconfigureServerCostmapNav;
76
77
77
78
// / @brief A mapping from a string to a map-ptr.
78
79
typedef boost::unordered_map<std::string, CostmapWrapper::Ptr > StringToMap;
@@ -88,14 +89,13 @@ typedef boost::unordered_map<std::string, CostmapWrapper::Ptr> StringToMap;
88
89
class CostmapNavigationServer : public mbf_abstract_nav ::AbstractNavigationServer
89
90
{
90
91
public:
91
-
92
92
typedef boost::shared_ptr<CostmapNavigationServer> Ptr ;
93
93
94
94
/* *
95
95
* @brief Constructor
96
96
* @param tf_listener_ptr Shared pointer to a common TransformListener
97
97
*/
98
- CostmapNavigationServer (const TFPtr & tf_listener_ptr);
98
+ CostmapNavigationServer (const TFPtr& tf_listener_ptr);
99
99
100
100
/* *
101
101
* @brief Destructor
@@ -105,62 +105,56 @@ class CostmapNavigationServer : public mbf_abstract_nav::AbstractNavigationServe
105
105
virtual void stop ();
106
106
107
107
private:
108
-
109
108
/* *
110
109
* @brief Create a new planner execution.
111
110
* @param plugin_name Name of the planner to use.
112
111
* @param plugin_ptr Shared pointer to the plugin to use.
113
112
* @return Shared pointer to a new @ref planner_execution "PlannerExecution".
114
113
*/
115
- virtual mbf_abstract_nav::AbstractPlannerExecution::Ptr newPlannerExecution (
116
- const std::string &plugin_name,
117
- const mbf_abstract_core::AbstractPlanner::Ptr &plugin_ptr);
114
+ virtual mbf_abstract_nav::AbstractPlannerExecution::Ptr
115
+ newPlannerExecution (const std::string& plugin_name, const mbf_abstract_core::AbstractPlanner::Ptr & plugin_ptr);
118
116
119
117
/* *
120
118
* @brief Create a new controller execution.
121
119
* @param plugin_name Name of the controller to use.
122
120
* @param plugin_ptr Shared pointer to the plugin to use.
123
121
* @return Shared pointer to a new @ref controller_execution "ControllerExecution".
124
122
*/
125
- virtual mbf_abstract_nav::AbstractControllerExecution::Ptr newControllerExecution (
126
- const std::string &plugin_name,
127
- const mbf_abstract_core::AbstractController::Ptr &plugin_ptr);
123
+ virtual mbf_abstract_nav::AbstractControllerExecution::Ptr
124
+ newControllerExecution (const std::string& plugin_name, const mbf_abstract_core::AbstractController::Ptr & plugin_ptr);
128
125
129
126
/* *
130
127
* @brief Create a new recovery behavior execution.
131
128
* @param plugin_name Name of the recovery behavior to run.
132
129
* @param plugin_ptr Shared pointer to the plugin to use
133
130
* @return Shared pointer to a new @ref recovery_execution "RecoveryExecution".
134
131
*/
135
- virtual mbf_abstract_nav::AbstractRecoveryExecution::Ptr newRecoveryExecution (
136
- const std::string &plugin_name,
137
- const mbf_abstract_core::AbstractRecovery::Ptr &plugin_ptr);
132
+ virtual mbf_abstract_nav::AbstractRecoveryExecution::Ptr
133
+ newRecoveryExecution (const std::string& plugin_name, const mbf_abstract_core::AbstractRecovery::Ptr & plugin_ptr);
138
134
139
135
/* *
140
136
* @brief Loads the plugin associated with the given planner_type parameter.
141
137
* @param planner_type The type of the planner plugin to load.
142
138
* @return true, if the local planner plugin was successfully loaded.
143
139
*/
144
- virtual mbf_abstract_core::AbstractPlanner::Ptr loadPlannerPlugin (const std::string & planner_type);
140
+ virtual mbf_abstract_core::AbstractPlanner::Ptr loadPlannerPlugin (const std::string& planner_type);
145
141
146
142
/* *
147
143
* @brief Initializes the controller plugin with its name and pointer to the costmap
148
144
* @param name The name of the planner
149
145
* @param planner_ptr pointer to the planner object which corresponds to the name param
150
146
* @return true if init succeeded, false otherwise
151
147
*/
152
- virtual bool initializePlannerPlugin (
153
- const std::string &name,
154
- const mbf_abstract_core::AbstractPlanner::Ptr &planner_ptr
155
- );
148
+ virtual bool initializePlannerPlugin (const std::string& name,
149
+ const mbf_abstract_core::AbstractPlanner::Ptr & planner_ptr);
156
150
157
151
/* *
158
152
* @brief Loads the plugin associated with the given controller type parameter
159
153
* @param controller_type The type of the controller plugin
160
154
* @return A shared pointer to a new loaded controller, if the controller plugin was loaded successfully,
161
155
* an empty pointer otherwise.
162
156
*/
163
- virtual mbf_abstract_core::AbstractController::Ptr loadControllerPlugin (const std::string & controller_type);
157
+ virtual mbf_abstract_core::AbstractController::Ptr loadControllerPlugin (const std::string& controller_type);
164
158
165
159
/* *
166
160
* @brief Initializes the controller plugin with its name, a pointer to the TransformListener
@@ -169,69 +163,82 @@ class CostmapNavigationServer : public mbf_abstract_nav::AbstractNavigationServe
169
163
* @param controller_ptr pointer to the controller object which corresponds to the name param
170
164
* @return true if init succeeded, false otherwise
171
165
*/
172
- virtual bool initializeControllerPlugin (
173
- const std::string &name,
174
- const mbf_abstract_core::AbstractController::Ptr &controller_ptr
175
- );
166
+ virtual bool initializeControllerPlugin (const std::string& name,
167
+ const mbf_abstract_core::AbstractController::Ptr & controller_ptr);
176
168
177
169
/* *
178
170
* @brief Loads a Recovery plugin associated with given recovery type parameter
179
171
* @param recovery_name The name of the Recovery plugin
180
172
* @return A shared pointer to a Recovery plugin, if the plugin was loaded successfully, an empty pointer otherwise.
181
173
*/
182
- virtual mbf_abstract_core::AbstractRecovery::Ptr loadRecoveryPlugin (const std::string & recovery_type);
174
+ virtual mbf_abstract_core::AbstractRecovery::Ptr loadRecoveryPlugin (const std::string& recovery_type);
183
175
184
176
/* *
185
177
* @brief Initializes a recovery behavior plugin with its name and pointers to the global and local costmaps
186
178
* @param name The name of the recovery behavior
187
179
* @param behavior_ptr pointer to the recovery behavior object which corresponds to the name param
188
180
* @return true if init succeeded, false otherwise
189
181
*/
190
- virtual bool initializeRecoveryPlugin (
191
- const std::string &name,
192
- const mbf_abstract_core::AbstractRecovery::Ptr &behavior_ptr);
182
+ virtual bool initializeRecoveryPlugin (const std::string& name,
183
+ const mbf_abstract_core::AbstractRecovery::Ptr & behavior_ptr);
184
+
185
+ /* *
186
+ * @brief If mbf_msgs::CheckPose::Request::LOCAL_COSTMAP the local costmap is returned
187
+ * if mbf_msgs::CheckPose::Request::GLOBAL_COSTMAP, the global costmap is returned.
188
+ * Otherwise, it returns an empty pointer.
189
+ * @param costmap_type The type of the costmap to return
190
+ * @return A pair: string which is the type of the costmap; and the shared pointer to the requested costmap.
191
+ * If costmap is not valid, it returns an empty pointer and an empty string.
192
+ */
193
+ std::pair<std::string, CostmapWrapper::Ptr >
194
+ requestedCostmap (mbf_msgs::CheckPose::Request::_costmap_type costmap_type) const ;
193
195
194
196
/* *
195
197
* @brief Callback method for the check_point_cost service
196
198
* @param request Request object, see the mbf_msgs/CheckPoint service definition file.
197
199
* @param response Response object, see the mbf_msgs/CheckPoint service definition file.
198
200
* @return true, if the service completed successfully, false otherwise
199
201
*/
200
- bool callServiceCheckPointCost (mbf_msgs::CheckPoint::Request &request,
201
- mbf_msgs::CheckPoint::Response &response);
202
+ bool callServiceCheckPointCost (mbf_msgs::CheckPoint::Request& request, mbf_msgs::CheckPoint::Response& response);
202
203
203
204
/* *
204
205
* @brief Callback method for the check_pose_cost service
205
206
* @param request Request object, see the mbf_msgs/CheckPose service definition file.
206
207
* @param response Response object, see the mbf_msgs/CheckPose service definition file.
207
208
* @return true, if the service completed successfully, false otherwise
208
209
*/
209
- bool callServiceCheckPoseCost (mbf_msgs::CheckPose::Request &request,
210
- mbf_msgs::CheckPose::Response &response);
210
+ bool callServiceCheckPoseCost (mbf_msgs::CheckPose::Request& request, mbf_msgs::CheckPose::Response& response);
211
211
212
212
/* *
213
213
* @brief Callback method for the check_path_cost service
214
214
* @param request Request object, see the mbf_msgs/CheckPath service definition file.
215
215
* @param response Response object, see the mbf_msgs/CheckPath service definition file.
216
216
* @return true, if the service completed successfully, false otherwise
217
217
*/
218
- bool callServiceCheckPathCost (mbf_msgs::CheckPath::Request &request,
219
- mbf_msgs::CheckPath::Response &response);
218
+ bool callServiceCheckPathCost (mbf_msgs::CheckPath::Request& request, mbf_msgs::CheckPath::Response& response);
220
219
221
220
/* *
222
221
* @brief Callback method for the make_plan service
223
222
* @param request Empty request object.
224
223
* @param response Empty response object.
225
224
* @return true, if the service completed successfully, false otherwise
226
225
*/
227
- bool callServiceClearCostmaps (std_srvs::Empty::Request &request, std_srvs::Empty::Response &response);
226
+ bool callServiceClearCostmaps (std_srvs::Empty::Request& request, std_srvs::Empty::Response& response);
227
+
228
+ /* *
229
+ * @brief Callback method for the find valid pose service
230
+ * @param request FindValidPose request object.
231
+ * @param response FindValidPose response object.
232
+ * @return true, if the service completed successfully, false otherwise
233
+ */
234
+ bool callServiceFindValidPose (mbf_msgs::FindValidPose::Request& request, mbf_msgs::FindValidPose::Response& response);
228
235
229
236
/* *
230
237
* @brief Reconfiguration method called by dynamic reconfigure.
231
238
* @param config Configuration parameters. See the MoveBaseFlexConfig definition.
232
239
* @param level bit mask, which parameters are set.
233
240
*/
234
- void reconfigure (mbf_costmap_nav::MoveBaseFlexConfig & config, uint32_t level);
241
+ void reconfigure (mbf_costmap_nav::MoveBaseFlexConfig& config, uint32_t level);
235
242
236
243
pluginlib::ClassLoader<mbf_costmap_core::CostmapRecovery> recovery_plugin_loader_;
237
244
pluginlib::ClassLoader<nav_core::RecoveryBehavior> nav_core_recovery_plugin_loader_;
@@ -275,6 +282,11 @@ class CostmapNavigationServer : public mbf_abstract_nav::AbstractNavigationServe
275
282
276
283
// ! Service Server for the clear_costmap service
277
284
ros::ServiceServer clear_costmaps_srv_;
285
+
286
+ // ! Service Server for the find_valid_pose service
287
+ ros::ServiceServer find_valid_pose_srv_;
288
+
289
+ static constexpr double ANGLE_INCREMENT = 5.0 * M_PI / 180.0 ; // 5 degrees
278
290
};
279
291
280
292
} /* namespace mbf_costmap_nav */
0 commit comments