move_base_action.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  * move_base_action.h
34  *
35  * authors:
36  * Sebastian Pütz <spuetz@uni-osnabrueck.de>
37  * Jorge Santos Simón <santos@magazino.eu>
38  *
39  */
40 #ifndef MBF_ABSTRACT_NAV__MOVE_BASE_ACTION_H_
41 #define MBF_ABSTRACT_NAV__MOVE_BASE_ACTION_H_
42 
45 
46 #include <mbf_msgs/MoveBaseAction.h>
47 #include <mbf_msgs/GetPathAction.h>
48 #include <mbf_msgs/ExePathAction.h>
49 #include <mbf_msgs/RecoveryAction.h>
50 
52 
53 #include "mbf_abstract_nav/MoveBaseFlexConfig.h"
54 
55 
56 namespace mbf_abstract_nav
57 {
58 
60 {
61  public:
62 
67 
69 
70  MoveBaseAction(const std::string &name,
71  const mbf_utility::RobotInformation &robot_info,
72  const std::vector<std::string> &controllers);
73 
75 
76  void start(GoalHandle &goal_handle);
77 
78  void cancel();
79 
80  void reconfigure(
81  mbf_abstract_nav::MoveBaseFlexConfig &config, uint32_t level);
82 
83  protected:
84 
85  void actionExePathFeedback(const mbf_msgs::ExePathFeedbackConstPtr &feedback);
86 
87  void actionGetPathDone(
89  const mbf_msgs::GetPathResultConstPtr &result);
90 
91  void actionExePathActive();
92 
93  void actionExePathDone(
95  const mbf_msgs::ExePathResultConstPtr &result);
96 
97  void actionRecoveryDone(
99  const mbf_msgs::RecoveryResultConstPtr &result);
100 
101  bool attemptRecovery();
102 
103  bool replanningActive() const;
104 
105  void replanningThread();
106 
113  template <typename ResultType>
114  void fillMoveBaseResult(const ResultType& result, mbf_msgs::MoveBaseResult& move_base_result)
115  {
116  // copy outcome and message from action client result
117  move_base_result.outcome = result.outcome;
118  move_base_result.message = result.message;
119  move_base_result.dist_to_goal = static_cast<float>(mbf_utility::distance(robot_pose_, goal_pose_));
120  move_base_result.angle_to_goal = static_cast<float>(mbf_utility::angle(robot_pose_, goal_pose_));
121  move_base_result.final_pose = robot_pose_;
122  }
123 
124  mbf_msgs::ExePathGoal exe_path_goal_;
125  mbf_msgs::GetPathGoal get_path_goal_;
126  mbf_msgs::RecoveryGoal recovery_goal_;
127 
128  geometry_msgs::PoseStamped last_oscillation_pose_;
130 
133 
136 
138 
139  std::string name_;
140 
143 
145  geometry_msgs::PoseStamped robot_pose_;
146 
148  geometry_msgs::PoseStamped goal_pose_;
149 
151 
154 
157 
160 
163 
166 
168  boost::thread replanning_thread_;
169 
172 
173  std::vector<std::string> recovery_behaviors_;
174 
175  std::vector<std::string>::iterator current_recovery_behavior_;
176 
177  const std::vector<std::string> &behaviors_;
178 
180  {
189  };
190 
193 };
194 
195 } /* mbf_abstract_nav */
196 
197 #endif //MBF_ABSTRACT_NAV__MOVE_BASE_ACTION_H_
mbf_abstract_nav::MoveBaseAction::oscillation_distance_
double oscillation_distance_
minimal move distance to not detect an oscillation
Definition: move_base_action.h:135
mbf_abstract_nav::MoveBaseAction::start
void start(GoalHandle &goal_handle)
Definition: move_base_action.cpp:107
mbf_abstract_nav::MoveBaseAction::get_path_goal_
mbf_msgs::GetPathGoal get_path_goal_
Definition: move_base_action.h:125
mbf_abstract_nav::MoveBaseAction::~MoveBaseAction
~MoveBaseAction()
Definition: move_base_action.cpp:69
actionlib::ServerGoalHandle
mbf_abstract_nav::MoveBaseAction::MoveBaseAction
MoveBaseAction(const std::string &name, const mbf_utility::RobotInformation &robot_info, const std::vector< std::string > &controllers)
Definition: move_base_action.cpp:50
mbf_utility::RobotInformation
mbf_utility::distance
double distance(const geometry_msgs::PoseStamped &pose1, const geometry_msgs::PoseStamped &pose2)
mbf_abstract_nav::MoveBaseAction::RECOVERY
@ RECOVERY
Definition: move_base_action.h:184
mbf_abstract_nav::MoveBaseAction::ActionClientGetPath
actionlib::SimpleActionClient< mbf_msgs::GetPathAction > ActionClientGetPath
Action clients for the MoveBase action.
Definition: move_base_action.h:64
mbf_abstract_nav::MoveBaseAction::NONE
@ NONE
Definition: move_base_action.h:181
mbf_abstract_nav::MoveBaseAction::recovery_goal_
mbf_msgs::RecoveryGoal recovery_goal_
Definition: move_base_action.h:126
mbf_abstract_nav::MoveBaseAction::actionExePathActive
void actionExePathActive()
Definition: move_base_action.cpp:168
actionlib::SimpleClientGoalState
mbf_abstract_nav::MoveBaseAction::last_oscillation_reset_
ros::Time last_oscillation_reset_
Definition: move_base_action.h:129
mbf_abstract_nav::MoveBaseAction::GET_PATH
@ GET_PATH
Definition: move_base_action.h:182
mbf_abstract_nav::MoveBaseAction::replanningActive
bool replanningActive() const
Definition: move_base_action.cpp:516
mbf_abstract_nav::MoveBaseAction::actionRecoveryDone
void actionRecoveryDone(const actionlib::SimpleClientGoalState &state, const mbf_msgs::RecoveryResultConstPtr &result)
Definition: move_base_action.cpp:436
mbf_abstract_nav::MoveBaseAction::GoalHandle
actionlib::ActionServer< mbf_msgs::MoveBaseAction >::GoalHandle GoalHandle
Definition: move_base_action.h:68
mbf_abstract_nav::MoveBaseAction::SUCCEEDED
@ SUCCEEDED
Definition: move_base_action.h:186
mbf_abstract_nav::MoveBaseAction::actionExePathFeedback
void actionExePathFeedback(const mbf_msgs::ExePathFeedbackConstPtr &feedback)
Definition: move_base_action.cpp:173
mbf_abstract_nav::MoveBaseAction::robot_pose_
geometry_msgs::PoseStamped robot_pose_
current robot pose; updated with exe_path action feedback
Definition: move_base_action.h:145
mbf_abstract_nav::MoveBaseAction::current_recovery_behavior_
std::vector< std::string >::iterator current_recovery_behavior_
Definition: move_base_action.h:175
mbf_abstract_nav
Definition: abstract_controller_execution.h:58
mbf_abstract_nav::MoveBaseAction::FAILED
@ FAILED
Definition: move_base_action.h:188
mbf_abstract_nav::MoveBaseAction::exe_path_goal_
mbf_msgs::ExePathGoal exe_path_goal_
Definition: move_base_action.h:124
mbf_abstract_nav::MoveBaseAction::MoveBaseActionState
MoveBaseActionState
Definition: move_base_action.h:179
actionlib::SimpleActionClient< mbf_msgs::GetPathAction >
mbf_abstract_nav::MoveBaseAction::ActionClientRecovery
actionlib::SimpleActionClient< mbf_msgs::RecoveryAction > ActionClientRecovery
Definition: move_base_action.h:66
simple_action_client.h
mbf_abstract_nav::MoveBaseAction::behaviors_
const std::vector< std::string > & behaviors_
Definition: move_base_action.h:177
mbf_abstract_nav::MoveBaseAction::action_client_recovery_
ActionClientRecovery action_client_recovery_
Action client used by the move_base action.
Definition: move_base_action.h:159
mbf_abstract_nav::MoveBaseAction::actionGetPathDone
void actionGetPathDone(const actionlib::SimpleClientGoalState &state, const mbf_msgs::GetPathResultConstPtr &result)
Definition: move_base_action.cpp:232
mbf_abstract_nav::MoveBaseAction::action_state_
MoveBaseActionState action_state_
Definition: move_base_action.h:191
mbf_utility::angle
double angle(const geometry_msgs::PoseStamped &pose1, const geometry_msgs::PoseStamped &pose2)
mbf_abstract_nav::MoveBaseAction::CANCELED
@ CANCELED
Definition: move_base_action.h:187
mbf_abstract_nav::MoveBaseAction::name_
std::string name_
Definition: move_base_action.h:139
mbf_abstract_nav::MoveBaseAction::replanningThread
void replanningThread()
Definition: move_base_action.cpp:522
mbf_abstract_nav::MoveBaseAction::EXE_PATH
@ EXE_PATH
Definition: move_base_action.h:183
mbf_abstract_nav::MoveBaseAction::last_oscillation_pose_
geometry_msgs::PoseStamped last_oscillation_pose_
Definition: move_base_action.h:128
mbf_abstract_nav::MoveBaseAction::replanning_period_
ros::Duration replanning_period_
Replanning period dynamically reconfigurable.
Definition: move_base_action.h:165
mbf_abstract_nav::MoveBaseAction::action_client_exe_path_
ActionClientExePath action_client_exe_path_
Action client used by the move_base action.
Definition: move_base_action.h:153
mbf_abstract_nav::MoveBaseAction::robot_info_
const mbf_utility::RobotInformation & robot_info_
current robot state
Definition: move_base_action.h:142
action_server.h
mbf_abstract_nav::MoveBaseAction::actionExePathDone
void actionExePathDone(const actionlib::SimpleClientGoalState &state, const mbf_msgs::ExePathResultConstPtr &result)
Definition: move_base_action.cpp:319
robot_information.h
mbf_abstract_nav::MoveBaseAction::fillMoveBaseResult
void fillMoveBaseResult(const ResultType &result, mbf_msgs::MoveBaseResult &move_base_result)
Definition: move_base_action.h:114
ros::Time
mbf_abstract_nav::MoveBaseAction::goal_pose_
geometry_msgs::PoseStamped goal_pose_
current goal pose; used to compute remaining distance and angle
Definition: move_base_action.h:148
mbf_abstract_nav::MoveBaseAction::OSCILLATING
@ OSCILLATING
Definition: move_base_action.h:185
mbf_abstract_nav::MoveBaseAction
Definition: move_base_action.h:59
mbf_abstract_nav::MoveBaseAction::private_nh_
ros::NodeHandle private_nh_
Definition: move_base_action.h:150
mbf_abstract_nav::MoveBaseAction::recovery_enabled_
bool recovery_enabled_
true, if recovery behavior for the MoveBase action is enabled.
Definition: move_base_action.h:171
mbf_abstract_nav::MoveBaseAction::dist_to_goal_
double dist_to_goal_
current distance to goal (we will stop replanning if very close to avoid destabilizing the controller...
Definition: move_base_action.h:162
mbf_abstract_nav::MoveBaseAction::reconfigure
void reconfigure(mbf_abstract_nav::MoveBaseFlexConfig &config, uint32_t level)
Definition: move_base_action.cpp:75
mbf_abstract_nav::MoveBaseAction::replanning_thread_
boost::thread replanning_thread_
Replanning thread, running permanently.
Definition: move_base_action.h:168
mbf_abstract_nav::MoveBaseAction::recovery_trigger_
MoveBaseActionState recovery_trigger_
Definition: move_base_action.h:192
mbf_abstract_nav::MoveBaseAction::attemptRecovery
bool attemptRecovery()
Definition: move_base_action.cpp:404
mbf_abstract_nav::MoveBaseAction::goal_handle_
GoalHandle goal_handle_
Definition: move_base_action.h:137
mbf_abstract_nav::MoveBaseAction::cancel
void cancel()
Definition: move_base_action.cpp:87
ros::Duration
mbf_abstract_nav::MoveBaseAction::recovery_behaviors_
std::vector< std::string > recovery_behaviors_
Definition: move_base_action.h:173
mbf_abstract_nav::MoveBaseAction::action_client_get_path_
ActionClientGetPath action_client_get_path_
Action client used by the move_base action.
Definition: move_base_action.h:156
mbf_abstract_nav::MoveBaseAction::oscillation_timeout_
ros::Duration oscillation_timeout_
timeout after a oscillation is detected
Definition: move_base_action.h:132
mbf_abstract_nav::MoveBaseAction::ActionClientExePath
actionlib::SimpleActionClient< mbf_msgs::ExePathAction > ActionClientExePath
Definition: move_base_action.h:65
ros::NodeHandle


mbf_abstract_nav
Author(s): Sebastian Pütz
autogenerated on Wed Mar 2 2022 00:33:47