05-Navigation导航

小芽科技 2022-07-26 11:44:33
Categories: Tags:

本文档由北京小芽科技翻译,原文来自于ROBOTIS官方技术文档

Navigation 导航

警告:在本指令中,TurtleBot3可能会移动和旋转。请将机器人放在安全的地面上。

**导航**是在一个给定的环境中,将机器人从一个位置移动到指定的目的地。为此,需要一张包含给定环境中的家具、物体和墙壁等几何信息的地图。如前文SLAM部分所述,地图是用传感器获得的距离信息和机器人本身的姿势信息创建的。

导航通过使用地图、机器人的编码器、IMU传感器和距离传感器,使机器人从当前姿势移动到地图上的指定目标姿势。执行这一任务的程序如下。

5.1 运行 Navigation 节点

  1. 如果roscore没有在远程计算机上运行,请运行roscore。如果roscore已经在运行,请跳过这一步

    1
    $ roscore
  2. 如果 “Bringup “没有在TurtleBot3 SBC上运行,启动Bringup。如果你之前已经启动了Bringup,请跳过此步骤

    • Ctrl+Alt+T在远程电脑上打开一个新的终端,用Raspberry Pi的IP地址连接到它。默认密码是turtlebot

      1
      2
      $ ssh pi@{IP_ADDRESS_OF_RASPBERRY_PI}
      $ roslaunch turtlebot3_bringup turtlebot3_robot.launch
  3. 启动导航。

    请在 TURTLEBOT3_MODEL 参数中使用 burgerwafflewaffle_pi 中的适当关键字。

    1
    2
    $ export TURTLEBOT3_MODEL=burger
    $ roslaunch turtlebot3_navigation turtlebot3_navigation.launch map_file:=$HOME/map.yaml

 如何保存TURTLEBOT3_MODEL参数?

The $ export TURTLEBOT3_MODEL=${TB3_MODEL} command can be omitted if the TURTLEBOT3_MODEL parameter is predefined in the .bashrc file.
The .bashrc file is automatically loaded when a terminal window is created.

  • Example of defining TurtlBot3 Burger as a default model.
    $ echo 'export TURTLEBOT3_MODEL=burger' >> ~/.bashrc
    $ source ~/.bashrc
    
  • Example of defining TurtlBot3 Waffle Pi as a default model.
    $ echo 'export TURTLEBOT3_MODEL=waffle_pi' >> ~/.bashrc
    $ source ~/.bashrc
    

5.2 估算初始姿态

Initial Pose Estimation 在运行导航之前必须进行Initial Pose Estimation,因为这个过程初始化了导航中至关重要的AMCL参数。TurtleBot3必须用LDS传感器数据在地图上正确定位,并与显示的地图整齐地重叠起来。

  1. 在RViz中点击 2D Pose Estimate按钮。
    img

  2. 点击实际机器人所在的地图,将绿色的大箭头拖向机器人所面对的方向。

  3. 重复步骤1和2,直到LDS传感器数据叠加到保存的地图上。

  4. 启动键盘远程操作节点,在地图上精确定位机器人。

    1
    $ roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
  5. 来回移动一下机器人,收集周围的环境信息,缩小TurtleBot3在地图上的估计位置,地图上有微小的绿色箭头显示。
    img img

  6. 通过在远程操作节点终端输入Ctrl'+C’终止键盘远程操作节点,以防止在导航过程中从多个节点发布不同的cmd_vel值。

5.3 设置Navigation目标

  1. 在RViz中点击 2D Nav Goal按钮。
    img
    • 在地图上点击设置机器人的目的地,将绿色箭头拖向机器人将要面对的方向。
      • 这个绿色箭头是一个标记,可以指定机器人的目的地。
      • 箭头的根部是目的地的xy坐标,而角度θ则由箭头的方向决定。
      • 一旦x、y、θ被设定,TurtleBot3将立即开始向目的地移动。img

 Read more about Navigation

  • The robot will create a path to reach to the Navigation Goal based on the global path planner. Then, the robot moves along the path. If an obstacle is placed in the path, the Navigation will use local path planner to avoid the obstacle.

  • Setting a Navigation Goal might fail if the path to the Navigation Goal cannot be created. If you wish to stop the robot before it reaches to the goal position, set the current position of TurtleBot3 as a Navigation Goal.

  • Official ROS Navigation Wiki

5.4 调试指南

导航栈有许多参数,可以改变不同机器人的性能。

你可以从 [Basic Navigation Tuning Guide](http://wiki.ros.org/navigation/Tutorials/Navigation Tuning Guide), ROS Navigation Tuning Guide by Kaiyu Zheng, 和[ ROS Robot Programming一书的第11章获得更多关于导航调整的信息。

5.4.1 inflation_radius

img

5.4.2 cost_scaling_factor

img

最佳路径是让机器人通过障碍物之间的中心。为了远离障碍物,将这个系数设置得更小。

5.4.3 max_vel_x

5.4.4 min_vel_x

5.4.5 max_trans_vel

5.4.6 min_trans_vel

5.4.7 max_rot_vel

5.4.8 min_rot_vel

5.4.9 acc_lim_x

5.4.10 acc_lim_theta

5.4.11 xy_goal_tolerance

5.4.12 yaw_goal_tolerance

5.4.13 sim_time

img