move_base.h
Go to the documentation of this file.
1 /*********************************************************************
2 *
3 * Software License Agreement (BSD License)
4 *
5 * Copyright (c) 2008, Willow Garage, Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer in the documentation and/or other materials provided
17 * with the distribution.
18 * * Neither the name of the Willow Garage nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 *
35 * Author: Eitan Marder-Eppstein
36 *********************************************************************/
37 #ifndef NAV_MOVE_BASE_ACTION_H_
38 #define NAV_MOVE_BASE_ACTION_H_
39 
40 #include <vector>
41 #include <string>
42 
43 #include <ros/ros.h>
44 
46 #include <move_base_msgs/MoveBaseAction.h>
47 
51 #include <geometry_msgs/PoseStamped.h>
53 #include <costmap_2d/costmap_2d.h>
54 #include <nav_msgs/GetPlan.h>
55 
56 #include <pluginlib/class_loader.h>
57 #include <std_srvs/Empty.h>
58 
59 #include <dynamic_reconfigure/server.h>
60 #include "move_base/MoveBaseConfig.h"
61 
62 namespace move_base {
63  //typedefs to help us out with the action server so that we don't hace to type so much
65 
70  };
71 
73  {
77  };
78 
83  class MoveBase {
84  public:
91 
95  virtual ~MoveBase();
96 
103  bool executeCycle(geometry_msgs::PoseStamped& goal, std::vector<geometry_msgs::PoseStamped>& global_plan);
104 
105  private:
112  bool clearCostmapsService(std_srvs::Empty::Request &req, std_srvs::Empty::Response &resp);
113 
120  bool planService(nav_msgs::GetPlan::Request &req, nav_msgs::GetPlan::Response &resp);
121 
128  bool makePlan(const geometry_msgs::PoseStamped& goal, std::vector<geometry_msgs::PoseStamped>& plan);
129 
136 
141 
147  void clearCostmapWindows(double size_x, double size_y);
148 
152  void publishZeroVelocity();
153 
157  void resetState();
158 
159  void goalCB(const geometry_msgs::PoseStamped::ConstPtr& goal);
160 
161  void planThread();
162 
163  void executeCb(const move_base_msgs::MoveBaseGoalConstPtr& move_base_goal);
164 
165  bool isQuaternionValid(const geometry_msgs::Quaternion& q);
166 
167  bool getRobotPose(tf::Stamped<tf::Pose>& global_posee, costmap_2d::Costmap2DROS* costmap);
168 
169  double distance(const geometry_msgs::PoseStamped& p1, const geometry_msgs::PoseStamped& p2);
170 
171  geometry_msgs::PoseStamped goalToGlobalFrame(const geometry_msgs::PoseStamped& goal_pose_msg);
172 
176  void wakePlanner(const ros::TimerEvent& event);
177 
179 
180  MoveBaseActionServer* as_;
181 
184 
187 
188  std::vector<boost::shared_ptr<nav_core::RecoveryBehavior> > recovery_behaviors_;
189  unsigned int recovery_index_;
190 
202 
205 
207  geometry_msgs::PoseStamped oscillation_pose_;
211 
212  //set up plan triple buffer
213  std::vector<geometry_msgs::PoseStamped>* planner_plan_;
214  std::vector<geometry_msgs::PoseStamped>* latest_plan_;
215  std::vector<geometry_msgs::PoseStamped>* controller_plan_;
216 
217  //set up the planner's thread
219  boost::recursive_mutex planner_mutex_;
221  geometry_msgs::PoseStamped planner_goal_;
222  boost::thread* planner_thread_;
223 
224 
225  boost::recursive_mutex configuration_mutex_;
226  dynamic_reconfigure::Server<move_base::MoveBaseConfig> *dsrv_;
227 
228  void reconfigureCB(move_base::MoveBaseConfig &config, uint32_t level);
229 
230  move_base::MoveBaseConfig last_config_;
231  move_base::MoveBaseConfig default_config_;
234  };
235 };
236 #endif
237 
void executeCb(const move_base_msgs::MoveBaseGoalConstPtr &move_base_goal)
Definition: move_base.cpp:639
boost::condition_variable_any planner_cond_
Definition: move_base.h:220
boost::thread * planner_thread_
Definition: move_base.h:222
void wakePlanner(const ros::TimerEvent &event)
This is used to wake the planner at periodic intervals.
Definition: move_base.cpp:551
ros::ServiceServer make_plan_srv_
Definition: move_base.h:199
double distance(const geometry_msgs::PoseStamped &p1, const geometry_msgs::PoseStamped &p2)
Definition: move_base.cpp:785
pluginlib::ClassLoader< nav_core::BaseLocalPlanner > blp_loader_
Definition: move_base.h:209
MoveBaseActionServer * as_
Definition: move_base.h:180
bool isQuaternionValid(const geometry_msgs::Quaternion &q)
Definition: move_base.cpp:498
costmap_2d::Costmap2DROS * controller_costmap_ros_
Definition: move_base.h:183
int32_t max_planning_retries_
Definition: move_base.h:194
bool planService(nav_msgs::GetPlan::Request &req, nav_msgs::GetPlan::Response &resp)
A service call that can be made when the action is inactive that will return a plan.
Definition: move_base.cpp:339
double clearing_radius_
Definition: move_base.h:196
pluginlib::ClassLoader< nav_core::BaseGlobalPlanner > bgp_loader_
Definition: move_base.h:208
boost::recursive_mutex configuration_mutex_
Definition: move_base.h:225
double planner_frequency_
Definition: move_base.h:192
double inscribed_radius_
Definition: move_base.h:192
ros::Publisher action_goal_pub_
Definition: move_base.h:197
virtual ~MoveBase()
Destructor - Cleans up.
Definition: move_base.cpp:432
ros::Time last_oscillation_reset_
Definition: move_base.h:206
bool getRobotPose(tf::Stamped< tf::Pose > &global_posee, costmap_2d::Costmap2DROS *costmap)
Definition: move_base.cpp:1140
bool recovery_behavior_enabled_
Definition: move_base.h:200
ros::Publisher vel_pub_
Definition: move_base.h:197
actionlib::SimpleActionServer< move_base_msgs::MoveBaseAction > MoveBaseActionServer
Definition: move_base.h:64
std::string global_frame_
Definition: move_base.h:186
tf::Stamped< tf::Pose > global_pose_
Definition: move_base.h:191
std::vector< geometry_msgs::PoseStamped > * planner_plan_
Definition: move_base.h:213
boost::shared_ptr< nav_core::BaseGlobalPlanner > planner_
Definition: move_base.h:185
double planner_patience_
Definition: move_base.h:193
bool clearing_rotation_allowed_
Definition: move_base.h:200
unsigned int recovery_index_
Definition: move_base.h:189
dynamic_reconfigure::Server< move_base::MoveBaseConfig > * dsrv_
Definition: move_base.h:226
RecoveryTrigger recovery_trigger_
Definition: move_base.h:204
ros::ServiceServer clear_costmaps_srv_
Definition: move_base.h:199
move_base::MoveBaseConfig default_config_
Definition: move_base.h:231
ros::Time last_valid_plan_
Definition: move_base.h:206
void loadDefaultRecoveryBehaviors()
Loads the default recovery behaviors for the navigation stack.
Definition: move_base.cpp:1084
std::vector< boost::shared_ptr< nav_core::RecoveryBehavior > > recovery_behaviors_
Definition: move_base.h:188
bool loadRecoveryBehaviors(ros::NodeHandle node)
Load the recovery behaviors for the navigation stack from the parameter server.
Definition: move_base.cpp:999
void reconfigureCB(move_base::MoveBaseConfig &config, uint32_t level)
Definition: move_base.cpp:174
double controller_patience_
Definition: move_base.h:193
void goalCB(const geometry_msgs::PoseStamped::ConstPtr &goal)
Definition: move_base.cpp:264
A class that uses the actionlib::ActionServer interface that moves the robot base to a goal location...
Definition: move_base.h:83
RecoveryTrigger
Definition: move_base.h:72
pluginlib::ClassLoader< nav_core::RecoveryBehavior > recovery_loader_
Definition: move_base.h:210
double controller_frequency_
Definition: move_base.h:192
costmap_2d::Costmap2DROS * planner_costmap_ros_
Definition: move_base.h:183
boost::recursive_mutex planner_mutex_
Definition: move_base.h:219
void publishZeroVelocity()
Publishes a velocity command of zero to the base.
Definition: move_base.cpp:490
geometry_msgs::PoseStamped goalToGlobalFrame(const geometry_msgs::PoseStamped &goal_pose_msg)
Definition: move_base.cpp:528
double oscillation_distance_
Definition: move_base.h:201
boost::shared_ptr< nav_core::BaseLocalPlanner > tc_
Definition: move_base.h:182
void resetState()
Reset the state of the move_base action and send a zero velocity command to the base.
Definition: move_base.cpp:1120
ros::Publisher current_goal_pub_
Definition: move_base.h:197
geometry_msgs::PoseStamped planner_goal_
Definition: move_base.h:221
MoveBaseState state_
Definition: move_base.h:203
ros::Subscriber goal_sub_
Definition: move_base.h:198
tf::TransformListener & tf_
Definition: move_base.h:178
std::vector< geometry_msgs::PoseStamped > * latest_plan_
Definition: move_base.h:214
move_base::MoveBaseConfig last_config_
Definition: move_base.h:230
MoveBase(tf::TransformListener &tf)
Constructor for the actions.
Definition: move_base.cpp:48
bool clearCostmapsService(std_srvs::Empty::Request &req, std_srvs::Empty::Response &resp)
A service call that clears the costmaps of obstacles.
Definition: move_base.cpp:328
uint32_t planning_retries_
Definition: move_base.h:195
double circumscribed_radius_
Definition: move_base.h:192
std::string robot_base_frame_
Definition: move_base.h:186
bool makePlan(const geometry_msgs::PoseStamped &goal, std::vector< geometry_msgs::PoseStamped > &plan)
Make a new global plan.
Definition: move_base.cpp:459
double conservative_reset_dist_
Definition: move_base.h:196
bool executeCycle(geometry_msgs::PoseStamped &goal, std::vector< geometry_msgs::PoseStamped > &global_plan)
Performs a control cycle.
Definition: move_base.cpp:790
ros::Time last_valid_control_
Definition: move_base.h:206
double oscillation_timeout_
Definition: move_base.h:201
geometry_msgs::PoseStamped oscillation_pose_
Definition: move_base.h:207
void clearCostmapWindows(double size_x, double size_y)
Clears obstacles within a window around the robot.
Definition: move_base.cpp:273
std::vector< geometry_msgs::PoseStamped > * controller_plan_
Definition: move_base.h:215


move_base
Author(s): Eitan Marder-Eppstein, contradict@gmail.com
autogenerated on Sun Mar 3 2019 03:44:48