MoveBase::MoveBase(tf::TransformListener& tf) :
tf_(tf),
as_(NULL),
planner_costmap_ros_(NULL), controller_costmap_ros_(NULL),
bgp_loader_("nav_core","nav_core::BaseGlobalPlanner"),
blp_loader_("nav_core","nav_core::BaseLocalPlanner"),
recovery_loader_("nav_core","nav_core::RecoveryBehavior"),
planner_plan_(NULL), latest_plan_(NULL),controller_plan_(NULL),
runPlanner_(false), setup_(false), p_freq_change_(false),c_freq_change_(false), new_global_plan_(false) {
//这个actionserver使用了actionlib中的逻辑,actionlib提供了一套框架,可以建立一个server,client可以发送可抢断的taskrequest, 可以将之前的taskrequest取消,覆盖。并且可以不断得到反馈的框架。,基于此框架,每当有新的targetgoal被设定时,会执行executeCb函数。
as_ = newMoveBaseActionServer(ros::NodeHandle(), "move_base",boost::bind(&MoveBase::executeCb, this, _1), false);
ros::NodeHandleprivate_nh("~"); 使用privatenamespace的handle,也就是使用move_base作为ns的handle.
ros::NodeHandle nh;
recovery_trigger_ = PLANNING_R;
//get some parameters that will be global to the move basenode
std::string global_planner, local_planner;
private_nh.param("base_global_planner",global_planner, std::string("navfn/NavfnROS"));
private_nh.param("base_local_planner",local_planner,std::string("base_local_planner/TrajectoryPlannerROS"));
//实际使用的global/localplanner