ros中的move_base

学习ros了很长时间,也跑过很多很多的例子,玩了kobuki也一个月还适配turtlebot的minilauncher到一个新的地盘上。最后才发现在navigation stack中最重要的就是move base这个节点。

move_base用于在robot中的路径规划,根据路径发布运动命令和动态障碍规避。基本上导航的重点功能都在这里

1.

见图如下

attachment:overview_tf.png


蓝色模块:根据平台不同而不同,但是必须的。比如base controller基于设备地盘,sensor sources和sensor transform基于传感器

灰色模块:不是必须的,但是如果存在可以对地图或tf提供很好的参考和矫正。amcl用于根据传感器的信息(scan)输出机器人定位信息,map_server用于提供地图数据,例如hector_mapping和gmapping就是map_server节点,但地图可以提前构建好,并在配置中进行指定使用配置好的地图。

白色模块:move_base的内部模块,分成5个:

global_planner:全局路线规划,用于提供一个完整的,基于地图上当前位置到目的位置的规划路线。根据设置参数的不同,提供的路线的曲直度稍有不同。当给定目标地址后不间断地发布路线。参考:http://wiki.ros.org/global_planner

global_costmap:全局地图,根据map_server发布的地图信息,不停地构建地图。在运动中根据实时的传感器信息,对动态障碍决定是否进行recovery动作。在rviz中就是全局地图

local_planner:局部路线规划,我个人认为更像是一个控制器,它根据global_planner提供的路线向robot发送运动命令(x,y,w,对于kobuki通常就两个值,x和w),并实时监听robot的odom,odom就是robot实际的运动轨迹。根据odom和local_costmap,矫正或调整下一次的运动命令。 参考:http://wiki.ros.org/base_local_planner

local_costmap:基于local_planner的局部地图,在rviz中就是robot周围的深色颜色区。同时和global_costmap一样,监听实时的传感器信息,对动态障碍决定是否进行recovery动作。

recovery_behaviors:由一系列参数控制,对动态障碍是否规避,如何规避

recovery行为:目前在move_base中是简单的360度清理,就是在路线规划受阻时让robot旋转360度,根据传感器的信息重新清理区域里面的动态障碍,清理分成两次,第一次是保守清理,只清理用户制定区域之外的障碍信息,第二次是全部清理,清理robot全转扫描区域内的全部障碍。如果还是不行,则会告诉用户路线不同。


2.action api

movebase使用SimpleActionServer东东,简单来说就是,类似与client/server,有请求也有响应,不过请求和响应都是以主题形式即pub/sub。

Action Subscribed Topics

move_base/goal (move_base_msgs/MoveBaseActionGoal):A goal for move_base to pursue in the world.
move_base/cancel (actionlib_msgs/GoalID):A request to cancel a specific goal.

Action Published Topics

move_base/feedback (move_base_msgs/MoveBaseActionFeedback):Feedback contains the current position of the base in the world.
move_base/status (actionlib_msgs/GoalStatusArray):Provides status information on the goals that are sent to the move_base action.
move_base/result (move_base_msgs/MoveBaseActionResult):Result is empty for the move_base action.

3.订阅的主题

move_base_simple/goal (geometry_msgs/PoseStamped)
Provides a non-action interface to move_base for users that don't care about tracking the execution status of their goals.

4.发布的主题

cmd_vel (geometry_msgs/Twist)
A stream of velocity commands meant for execution by a mobile base.

5.服务

都是服务给额外的用户,让其他的用户也知道robot的路线与行程

~make_plan (nav_msgs/GetPlan)
Allows an external user to ask for a plan to a given pose from move_base without causing move_base to execute that plan.
~clear_unknown_space (std_srvs/Empty)
Allows an external user to tell move_base to clear unknown space in the area directly around the robot. This is useful when move_base has its costmaps stopped for a long period of time and then started again in a new location in the environment. - Available in versions from 1.1.0-groovy
~clear_costmaps (std_srvs/Empty)
Allows an external user to tell move_base to clear obstacles in the costmaps used by move_base. This could cause a robot to hit things and should be used with caution. - New in 1.3.1


6.参数
~base_global_planner (string, default: "navfn/NavfnROS" For 1.1+ series) : global_planner插件名称
~base_local_planner (string, default: "base_local_planner/TrajectoryPlannerROS" For 1.1+ series):local_planner插件名称
~recovery_behaviors (list, default: [{name: conservative_reset, type: clear_costmap_recovery/ClearCostmapRecovery}, {name: rotate_recovery, type: rotate_recovery/RotateRecovery}, {name: aggressive_reset, type: clear_costmap_recovery/ClearCostmapRecovery}] For 1.1+ series)
recovery行为定义,默认顺序是conservative_reset->rotate_recovery->aggressive_reset->rotate_recovery
~controller_frequency (double, default: 20.0):命令发送频率
~planner_patience (double, default: 5.0):在空间清理后试图找寻一个有效路径,planner最长等待时间
~controller_patience (double, default: 15.0):在空间清理后控制器接收运动命令的最长等待时间
~conservative_reset_dist (double, default: 3.0):recovery有效时参数,在默认3米内的障碍将要被清理
~recovery_behavior_enabled (bool, default: true):recovery enabled参数
~clearing_rotation_allowed (bool, default: true):recovery有效时参数,是否使用in-place rotation
~shutdown_costmaps (bool, default: false):move base在无效状态是否关闭costmaps节点
~oscillation_timeout (double, default: 0.0):在recovery行为前,多长时间的震荡。
~oscillation_distance (double, default: 0.5):震荡的最远距离
~planner_frequency (double, default: 0.0):路线的发布频率,当为0时,只有新目标或者local planner上报路线阻塞时才发布路线
~max_planning_retries (int32_t, default: -1):在recovery前多少次路线重新规划,-1为无限重试。

参考链接:http://wiki.ros.org/move_base

你可能感兴趣的:(ROS)