abstract_navigation_server.h
Go to the documentation of this file.
1 /*
2  * Copyright 2018, Magazino GmbH, Sebastian Pütz, Jorge Santos Simón
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above
12  * copyright notice, this list of conditions and the following
13  * disclaimer in the documentation and/or other materials provided
14  * with the distribution.
15  *
16  * 3. Neither the name of the copyright holder nor the names of its
17  * contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  * abstract_navigation_server.h
34  *
35  * authors:
36  * Sebastian Pütz <spuetz@uni-osnabrueck.de>
37  * Jorge Santos Simón <santos@magazino.eu>
38  *
39  */
40 
41 #ifndef MBF_ABSTRACT_NAV__ABSTRACT_NAVIGATION_SERVER_H_
42 #define MBF_ABSTRACT_NAV__ABSTRACT_NAVIGATION_SERVER_H_
43 
44 #include <string>
45 #include <stdint.h>
46 
47 #include <boost/shared_ptr.hpp>
48 #include <boost/thread/recursive_mutex.hpp>
49 
51 #include <dynamic_reconfigure/server.h>
52 #include <geometry_msgs/PoseStamped.h>
53 #include <tf/transform_listener.h>
54 
56 
61 
66 
67 #include "mbf_abstract_nav/MoveBaseFlexConfig.h"
68 
69 namespace mbf_abstract_nav
70 {
85 
89 
93 
97 
99 const std::string name_action_exe_path = "exe_path";
101 const std::string name_action_get_path = "get_path";
103 const std::string name_action_recovery = "recovery";
105 const std::string name_action_move_base = "move_base";
106 
107 
109 
120  {
121  public:
122 
128  AbstractNavigationServer(const TFPtr &tf_listener_ptr);
129 
133  virtual ~AbstractNavigationServer();
134 
135  virtual void stop();
136 
144  const std::string &plugin_name,
145  const mbf_abstract_core::AbstractPlanner::Ptr plugin_ptr);
146 
154  const std::string &plugin_name,
156 
164  const std::string &plugin_name,
166 
172  virtual mbf_abstract_core::AbstractPlanner::Ptr loadPlannerPlugin(const std::string& planner_type) = 0;
173 
180  virtual mbf_abstract_core::AbstractController::Ptr loadControllerPlugin(const std::string& controller_type) = 0;
181 
187  virtual mbf_abstract_core::AbstractRecovery::Ptr loadRecoveryPlugin(const std::string& recovery_type) = 0;
188 
196  virtual bool initializePlannerPlugin(
197  const std::string& name,
198  const mbf_abstract_core::AbstractPlanner::Ptr& planner_ptr
199  ) = 0;
200 
208  virtual bool initializeControllerPlugin(
209  const std::string& name,
210  const mbf_abstract_core::AbstractController::Ptr& controller_ptr
211  ) = 0;
212 
220  virtual bool initializeRecoveryPlugin(
221  const std::string& name,
222  const mbf_abstract_core::AbstractRecovery::Ptr& behavior_ptr
223  ) = 0;
224 
225 
231  virtual void callActionGetPath(ActionServerGetPath::GoalHandle goal_handle);
232 
233  virtual void cancelActionGetPath(ActionServerGetPath::GoalHandle goal_handle);
234 
240  virtual void callActionExePath(ActionServerExePath::GoalHandle goal_handle);
241 
242  virtual void cancelActionExePath(ActionServerExePath::GoalHandle goal_handle);
243 
249  virtual void callActionRecovery(ActionServerRecovery::GoalHandle goal_handle);
250 
251  virtual void cancelActionRecovery(ActionServerRecovery::GoalHandle goal_handle);
252 
258  virtual void callActionMoveBase(ActionServerMoveBase::GoalHandle goal_handle);
259 
260  virtual void cancelActionMoveBase(ActionServerMoveBase::GoalHandle goal_handle);
261 
265  virtual void startActionServers();
266 
271  virtual void initializeServerComponents();
272 
278  bool getRobotPose(geometry_msgs::PoseStamped &robot_pose);
279 
280  protected:
281 
288  bool transformPlanToGlobalFrame(std::vector<geometry_msgs::PoseStamped> &plan,
289  std::vector<geometry_msgs::PoseStamped> &global_plan);
290 
295  virtual void startDynamicReconfigureServer();
296 
302  virtual void reconfigure(mbf_abstract_nav::MoveBaseFlexConfig &config, uint32_t level);
303 
306 
310 
312  ActionServerRecoveryPtr action_server_recovery_ptr_;
313 
315  ActionServerExePathPtr action_server_exe_path_ptr_;
316 
318  ActionServerGetPathPtr action_server_get_path_ptr_;
319 
321  ActionServerMoveBasePtr action_server_move_base_ptr_;
322 
324  DynamicReconfigureServer dsrv_;
325 
327  boost::mutex configuration_mutex_;
328 
330  mbf_abstract_nav::MoveBaseFlexConfig last_config_;
331 
333  mbf_abstract_nav::MoveBaseFlexConfig default_config_;
334 
337 
339  std::string robot_frame_;
340 
342  std::string global_frame_;
343 
346 
349 
351  geometry_msgs::PoseStamped robot_pose_;
352 
354  geometry_msgs::PoseStamped goal_pose_;
355 
358 
361 
364 
367 
370 
373 
375 
380  };
381 
382 } /* namespace mbf_abstract_nav */
383 
384 #endif /* navigation_controller.h */
bool recovery_enabled_
true, if recovery behavior for the MoveBase action is enabled.
ActionServerRecoveryPtr action_server_recovery_ptr_
shared pointer to the Recovery action server
actionlib::ActionServer< mbf_msgs::MoveBaseAction > ActionServerMoveBase
MoveBase action server.
virtual mbf_abstract_core::AbstractRecovery::Ptr loadRecoveryPlugin(const std::string &recovery_type)=0
Loads a Recovery plugin associated with given recovery type parameter.
actionlib::ActionServer< mbf_msgs::RecoveryAction > ActionServerRecovery
Recovery action server.
ros::Publisher goal_pub_
current_goal publisher for all controller execution objects
virtual void cancelActionRecovery(ActionServerRecovery::GoalHandle goal_handle)
const TFPtr tf_listener_ptr_
shared pointer to the common TransformListener
virtual bool initializePlannerPlugin(const std::string &name, const mbf_abstract_core::AbstractPlanner::Ptr &planner_ptr)=0
Pure virtual method, the derived class has to implement. Depending on the plugin base class...
std::string global_frame_
the global frame, in which the robot is moving
boost::shared_ptr< ActionServerMoveBase > ActionServerMoveBasePtr
std::string robot_frame_
the robot frame, to get the current robot pose in the global_frame_
AbstractPluginManager< mbf_abstract_core::AbstractController > controller_plugin_manager_
virtual void startDynamicReconfigureServer()
Start a dynamic reconfigure server. This must be called only if the extending doesn&#39;t create its own...
virtual mbf_abstract_core::AbstractController::Ptr loadControllerPlugin(const std::string &controller_type)=0
Loads the plugin associated with the given controller type parameter.
virtual bool initializeControllerPlugin(const std::string &name, const mbf_abstract_core::AbstractController::Ptr &controller_ptr)=0
Pure virtual method, the derived class has to implement. Depending on the plugin base class...
const std::string name_action_get_path
GetPath action topic name.
The AbstractNavigationServer is the abstract base class for all navigation servers in move_base_flex ...
virtual void cancelActionMoveBase(ActionServerMoveBase::GoalHandle goal_handle)
virtual void reconfigure(mbf_abstract_nav::MoveBaseFlexConfig &config, uint32_t level)
Reconfiguration method called by dynamic reconfigure.
boost::shared_ptr< dynamic_reconfigure::Server< mbf_abstract_nav::MoveBaseFlexConfig > > DynamicReconfigureServer
actionlib::ActionServer< mbf_msgs::GetPathAction > ActionServerGetPath
GetPath action server.
virtual bool initializeRecoveryPlugin(const std::string &name, const mbf_abstract_core::AbstractRecovery::Ptr &behavior_ptr)=0
Pure virtual method, the derived class has to implement. Depending on the plugin base class...
actionlib::ActionServer< mbf_msgs::ExePathAction > ActionServerExePath
ExePath action server.
virtual mbf_abstract_nav::AbstractRecoveryExecution::Ptr newRecoveryExecution(const std::string &plugin_name, const mbf_abstract_core::AbstractRecovery::Ptr plugin_ptr)
Create a new abstract recovery behavior execution.
geometry_msgs::PoseStamped robot_pose_
current robot pose; moving controller is responsible to update it by calling getRobotPose ...
virtual void callActionExePath(ActionServerExePath::GoalHandle goal_handle)
ExePath action execution method. This method will be called if the action server receives a goal...
ActionServerGetPathPtr action_server_get_path_ptr_
shared pointer to the GetPath action server
const std::string name_action_exe_path
ExePath action topic name.
AbstractPluginManager< mbf_abstract_core::AbstractPlanner > planner_plugin_manager_
bool setup_reconfigure_
true, if the dynamic reconfigure has been setup.
bool clearing_rotation_allowed_
true, if clearing rotate is allowed.
bool getRobotPose(geometry_msgs::PoseStamped &robot_pose)
Computes the current robot pose (robot_frame_) in the global frame (global_frame_).
mbf_abstract_nav::MoveBaseFlexConfig default_config_
the default parameter configuration save
virtual void callActionRecovery(ActionServerRecovery::GoalHandle goal_handle)
Recovery action execution method. This method will be called if the action server receives a goal...
AbstractNavigationServer(const TFPtr &tf_listener_ptr)
Constructor, reads all parameters and initializes all action servers and creates the plugin instances...
ros::Publisher vel_pub_
cmd_vel publisher for all controller execution objects
virtual void cancelActionExePath(ActionServerExePath::GoalHandle goal_handle)
ros::Duration tf_timeout_
timeout after tf returns without a result
boost::shared_ptr< ActionServerGetPath > ActionServerGetPathPtr
virtual void callActionMoveBase(ActionServerMoveBase::GoalHandle goal_handle)
MoveBase action execution method. This method will be called if the action server receives a goal...
geometry_msgs::PoseStamped goal_pose_
current goal pose; used to compute remaining distance and angle
mbf_abstract_nav::MoveBaseFlexConfig last_config_
last configuration save
ActionServerMoveBasePtr action_server_move_base_ptr_
shared pointer to the MoveBase action server
boost::shared_ptr< ActionServerExePath > ActionServerExePathPtr
ActionServerExePathPtr action_server_exe_path_ptr_
shared pointer to the ExePath action server
bool transformPlanToGlobalFrame(std::vector< geometry_msgs::PoseStamped > &plan, std::vector< geometry_msgs::PoseStamped > &global_plan)
Transforms a plan to the global frame (global_frame_) coord system.
const std::string name_action_recovery
Recovery action topic name.
virtual void callActionGetPath(ActionServerGetPath::GoalHandle goal_handle)
GetPath action execution method. This method will be called if the action server receives a goal...
boost::mutex configuration_mutex_
configuration mutex for derived classes and other threads.
AbstractPluginManager< mbf_abstract_core::AbstractRecovery > recovery_plugin_manager_
virtual void cancelActionGetPath(ActionServerGetPath::GoalHandle goal_handle)
virtual void startActionServers()
starts all action server.
virtual mbf_abstract_core::AbstractPlanner::Ptr loadPlannerPlugin(const std::string &planner_type)=0
Loads the plugin associated with the given planner_type parameter.
const std::string name_action_move_base
MoveBase action topic name.
virtual mbf_abstract_nav::AbstractControllerExecution::Ptr newControllerExecution(const std::string &plugin_name, const mbf_abstract_core::AbstractController::Ptr plugin_ptr)
Create a new abstract controller execution.
ros::Duration oscillation_timeout_
timeout after a oscillation is detected
DynamicReconfigureServer dsrv_
dynamic reconfigure server
virtual void initializeServerComponents()
initializes all server components. Initializing the plugins of the Planner, the Controller, and the Recovery Behavior.
virtual mbf_abstract_nav::AbstractPlannerExecution::Ptr newPlannerExecution(const std::string &plugin_name, const mbf_abstract_core::AbstractPlanner::Ptr plugin_ptr)
Create a new abstract planner execution.
double oscillation_distance_
minimal move distance to not detect an oscillation
boost::shared_ptr< ActionServerRecovery > ActionServerRecoveryPtr
ros::NodeHandle private_nh_
Private node handle.


mbf_abstract_nav
Author(s): Sebastian Pütz
autogenerated on Sat Oct 12 2019 04:02:25