Combine Art and Sciences.

——powered by Sonictl. All rights reserved.

ROS 进阶学习笔记(17):ROS导航2:关于 move_base Package(底盘移动包)

== 关于move_base 包(底盘移动包?移动底盘包?) ==

开始之前,我sonictl@CSDN有几个问题(Link on ROS_Answer)需要搞定:

  1. costmap_2d包 与 move_base包 是什么关系?
  2. 导航时,在RviZ工具中,可以看到,inflate 地图是由一个叫做 /move_base/local_costmap/costmap 主题生成的,这个主题的发布者又是move_base,怎么发布的?
  3. 到底是costmap_2d发布的/move_base/local_costmap/costmap还是move_base发布的它?又回到第1个问题,关系问题。
  4. 这里是不是可以探寻一点东西出来,以调整obstacle层的刷新机制
  5. 我sonictl@CSDN要解决的就是inflated obstacle层的刷新机制

How to solve the problem:

=== 我学这个包的时候,尽量总结wiki page上的内容如下,算是sonictl@CSDN读书笔记:===
move_base package 所属Stack: navigation
关于这个包在 ROS Navigation 框架中的位置,参见:ROS探索总结(十三)——导航与定位框架


The move_base package provides an implementation of an action (see the actionlib package) that, given a goal in the world, will attempt to reach it with a mobile base. The move_base node links together a global and local planner to accomplish its global navigation task. It supports any global planner adhering to the nav_core::BaseGlobalPlanner interface specified in the nav_core package and any local planner adhering to the nav_core::BaseLocalPlanner interface specified in thenav_core package. The move_base node also maintains two costmaps, one for the global planner, and one for a local planner (see thecostmap_2d package) that are used to accomplish navigation tasks.

这个包就是一个Action的实现,关于action,是一个ROS里的概念,需要到链接去学习。这个action就是要有几个输入,比如goal,然后它要给出的就是你的mobile base怎么到那里去的一个action输出。the move_base node实际上是一个link, 把全局规划器、局部规划器连接起来,以达成导航到目的地的目标。nav_core::BaseGlobalPlanner 接口里由nav_core指定的那些全局或 nav_core::BaseLocalPlanner 接口里由nav_core指定的局部规划器都被 move_base 支持。move_base node 还维护了俩costmap, 一个是为全局规划器准备的 global costmap, 一个是local的,这俩costmap也是为了完成sonictl@CSDN导航的任务。

【关于 move_base Nodes】

This package provides the move_base ROS Node which is a major component of thenavigation stack. A detailed description of this Node and its configuration options is found below. 主要的结构就是见下图咯:


    The move_base node provides a ROS interface for configuring, running, and interacting with thenavigation stack on a robot. A high-level view of the move_base node and its interaction with other components is shown above. The blue vary based on the robot platform, the gray are optional but are provided for all systems, and the white nodes are required but also provided for all systems. For more information on configuration of themove_base node, and the navigation stack as a whole, please see thenavigation setup and configuration tutorial.

    这里讲了各个颜色的方框代表的含义,给了一个tutorial的链接,教你怎么配置 navigation setup and configuration. 配置导航stack肯定会用到的link




Running the move_base node on a robot that is properly configured (please seenavigation stack documentation for more details) results in a robot that will attempt to achieve a goal pose with its base to within a user-specified tolerance. In the absence of dynamic obstacles, the move_base node will eventually get within this tolerance of its goal or signal failure to the user. Themove_base node may optionally perform recovery behaviors when the robot perceives itself as stuck. By default, themove_base node will take the following actions to attempt to clear out space(sonictl@CSDN):

First, obstacles outside of a user-specified region will be cleared from the robot's map. Next, if possible, the robot will perform an in-place rotation to clear out space. If this too fails, the robot will more aggressively clear its map, removing all obstacles outside of the rectangular region in which it can rotate in place. This will be followed by another in-place rotation. If all this fails, the robot will consider its goal infeasible and notify the user that it has aborted. These recovery behaviors can be configured using the recovery_behaviors parameter, and disabled using therecovery_behavior_enabled parameter.

对图作一下解释: 在你已经配置得比较好的机器人上运行 move_base node就会让你的机器人跑到指定的位姿去,在tolerance,容错值允许的范围内到达。In the absence of dynamic obstacles,要么 move_base node会最终到达,要么会返回一个失败信号。当机器人感觉被卡住stuck时,the move_base node可能会选择性地执行recovery 恢复行为。默认的,这个 move_base node 会采取以下的措施来clear out space: 搞清楚自己的处境?

  • 首先,机器人清扫地图,无关紧要的障碍就不处理了。
  • 然后,机器人会原地转圈来搞清楚自己处境clear out space
  • 如果这个失败,机器人会变得更勇敢地clear its map, 移除矩形区域以外的所有的障碍,而这个矩形区域是它可以在其中原地转圈的区域。
  • 接下来就是另一个 in-place 转圈原地转圈。
  • 如果上述所有步骤都失败了,机器人可能会考虑它的goal达不到了并通知用户aborted任务失败。
        sonictl@CSDN: 这些恢复行为可以在 the recovery_behaviors parameter 里配置,或者开关这些行为:and be disabled using the recovery_behavior_enabled parameter

【Action API】

The move_base node provides an implementation of theSimpleActionServer (seeactionlib documentation), that takes in goals containinggeometry_msgs/PoseStamped messages. You can communicate with themove_base node over ROS directly, but the recommended way to send goals tomove_base if you care about tracking their status is by using theSimpleActionClient. Please see actionlib documentation for more information.

The move_base node 提供的是一个SimpleActionServer (seeactionlib documentation)的动作服务器,它吃进 goals containinggeometry_msgs/PoseStamped messages。你可以在ROS架构上和move_base node 通信,但如果你关心它们的状态的话,推荐的方式是通过使用 theSimpleActionClient给它发goals, 详见actionlib documentation for more information。(看来 actionlib documentation 是必须要搞一搞才行了~~)

sonictl: 这里面涉及到ROS里的几个值得总结的概念分类问题: 1. What is Service/Actionlib/plugin...     2. What is message/topic/parameter/node/tf   3. ...other concepts

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 themove_base action.
move_base/result (move_base_msgs/MoveBaseActionResult)Result is empty for the move_base action.

【Subscribed Topics】

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.

【Published Topics】

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



~make_plan (nav_msgs/GetPlan)

  • Allows an external user to ask for a plan to a given pose frommove_base without causingmove_base to execute that plan.  请求一个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


这些参数一般是写在 ~/ws_catkin/rbx1/rbx1_nav/config/turtlebot/base_local_planner_params.yaml 文件里(MyBook: ros_by_example_hydro_volume1)

~base_global_planner (string, default:"navfn/NavfnROS"For 1.1+ series)

  • The name of the plugin for the global planner to use withmove_base, seepluginlib documentation for more details on plugins. This plugin must adhere to thenav_core::BaseGlobalPlanner interface specified in thenav_core package. (1.0 series default:"NavfnROS")
    全局规划器的名字,让move_base拿来用的,关于pluginlib, 要看文档。这个plugin 必须要粘在nave_core::BaseGlobalPlanner 的接口上使用,nav_core定义了那些接口。1.0 系列的默认的全局规划器名字是:NavfnROS
~base_local_planner (string, default:"base_local_planner/TrajectoryPlannerROS"For 1.1+ series)
  • The name of the plugin for the local planner to use withmove_base seepluginlib documentation for more details on plugins. This plugin must adhere to thenav_core::BaseLocalPlanner interface specified in thenav_core package. (1.0 series default:"TrajectoryPlannerROS")
    局部规划器的插件名,关于插件的事情就还是那个链接了。这个plugin 必须要粘在nave_core::BaseLocalPlanner 的接口上使用,nav_core定义了那些接口。1.0 系列的默认的全局规划器名字是:TrajectoryPlannerROS
~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)
  • A list of recovery behavior plugins to use with move_base, see pluginlib documentation for more details on plugins. These behaviors will be run whenmove_base fails to find a valid plan in the order that they are specified. After each behavior completes,move_base will attempt to make a plan. If planning is successful,move_base will continue normal operation. Otherwise, the next recovery behavior in the list will be executed. These plugins must adhere to thenav_core::RecoveryBehavior interface specified in the nav_core package. (1.0 series default: [{name: conservative_reset, type: ClearCostmapRecovery}, {name: rotate_recovery, type: RotateRecovery}, {name: aggressive_reset, type: ClearCostmapRecovery}]).
    Note: For the default parameters, the aggressive_reset behavior will clear out to a distance of 4 *~/local_costmap/circumscribed_radius.
~controller_frequency (double, default: 20.0)
  • The rate in Hz at which to run the control loop and send velocity commands to the base.
~planner_patience (double, default: 5.0)
  • How long the planner will wait in seconds in an attempt to find a valid plan before space-clearing operations are performed.
    字面意思是:规划器在一个操作执行前等几秒钟就去找合适的路径,那个操作就是 space-clearing 。这个有点confusing
  • 理解看的话,应该是 全局/局部 规划器要在 space-clearing 操作(obstacle就会被清掉)执行几秒之后开始规划路径。而不是之前~~疑问不懂~
~controller_patience (double, default: 15.0)
  • How long the controller will wait in seconds without receiving a valid control before space-clearing operations are performed.
~conservative_reset_dist (double, default: 3.0)
  • The distance away from the robot in meters at which obstacles will be cleared from thecostmap when attempting to clear space in the map. Note, this parameter is only used when the default recovery behaviors are used formove_base.
    距离机器人多远的距离的obstacle就会被从costmap上清掉。注意,只有 default recovery behaviors are used for move_base 时,这个参数才有用。
~recovery_behavior_enabled (bool, default:true)
  • Whether or not to enable the move_base recovery behaviors to attempt to clear out space.
    是否允许 move_base 的恢复动作来clear out space.
  • clear out space 究竟是什么意思?刷新costmap上的obstacle?
~clearing_rotation_allowed (bool, default:true)
  • Determines whether or not the robot will attempt an in-place rotation when attempting to clear out space. Note: This parameter is only used when the default recovery behaviors are in use, meaning the user has not set therecovery_behaviors parameter to anything custom.
    要不要机器人在clear out space时执行一个原地转圈。注意,只有 default recovery behaviors are used for move_base 时,这个参数才有用。这意味着用户sonictl并没有把 recovery_behaviors 这个参数设置为 anything custom(定制的任何值)。
~shutdown_costmaps (bool, default:false)
  • Determines whether or not to shutdown the costmaps of the node whenmove_base is in an inactive state
    当move_base在不活动状态时,是不是要关掉move_base node的 costmap
~oscillation_timeout (double, default: 0.0)
  • How long in seconds to allow for oscillation before executing recovery behaviors. A value of 0.0 corresponds to an infinite timeout.New in navigation 1.3.1
    在执行恢复动作前等多久,来 oscillation (晃荡),如果是 0.0 的话,意味着可以永久晃荡下去.sonictl at CSDN。
~oscillation_distance (double, default: 0.5)
  • How far in meters the robot must move to be considered not to be oscillating. Moving this far resets the timer counting up to the~oscillation_timeoutNew in navigation 1.3.1
    机器人跑多远才不被认为是在晃荡,超过这个值就会重设那个定时器,而定时器的timeout时间是由 ~oscillation_timeout 参数指定的。
~planner_frequency (double, default: 0.0)
  • The rate in Hz at which to run the global planning loop. If the frequency is set to 0.0, the global planner will only run when a new goal is received or the local planner reports that its path is blocked.New in navigation 1.6.0
    频率 - 就是全局规划器循环的频率Hz. 0.0 = 只有当收到一个新的goal时或收到local planner发的path is blocked报告时才进行一次全局规划。sonictl认为这个也很重要

【Component APIs】

The move_base node 包含的这些组件都有它们自己的ROS API, 也许因为这些组件的值而会不同,具体的Links就在下面列出供查询。
The move_base node contains components that have their own ROS APIs. These components may vary based on the values of the~base_global_planner,~base_local_planner, and~recovery_behaviors respectively. Links to the APIs for the default components can be found below:

Class Diagram (partially & not strictly drawn) is available here.

======== 以上就是我sonictl的读书笔记 ======

个人分类: 机器人+ROS
下一篇ROS 进阶学习笔记(19)-- Add Extra Gyro Sensor for ROOMBA-Based Turtlebot
想对作者说点什么? 我来说一句