【ROS软件】ROS2-humble安装navigation2与使用

Part 0. 准备

安装gazebo
sudo apt install ros-humble-gazebo-*
测试gazebo:
ros2 launch gazebo_ros gazebo.launch.py

Part 1. [安装] 直接安装Navigation2

下载与安装:

sudo apt install ros-humble-navigation2
sudo apt install ros-humble-nav2-bringup
sudo apt install ros-humble-turtlebot3-gazebo

启动nav2:

source /opt/ros/humble/setup.bash
export TURTLEBOT3_MODEL=waffle
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/humble/share/turtlebot3_gazebo/models
ros2 launch nav2_bringup tb3_simulation_launch.py headless:=False

使用nav2

首先,通过2d_pose_estimate按键画一个初始节点的大概位置

然后,通过Nav2_Goal按键选择一个目标,则开始运行

Part 2. [安装] 源码编译-navigation2

step 0. 设置环境:

    source /opt/ros/humble/setup.bash

step 1. 进入工作环境

    cd /ROS_Workstation
    mkdir src

step 2. 下载Nav2项目的对应版本

    cd src
    git clone https://github.com/ros-planning/navigation2.git --branch humble ./src/navigation2

在工作环境ROS_Workstation中运行指令:
sudo rosdep install -y --from-paths src --ignore-src --rosdistro humble -r

step 4. 编译工作空间

source /opt/ros/humble/setup.bash
export CC=/usr/bin/gcc-9
export CXX=/usr/bin/g++-9
colcon build --symlink-install --cmake-clean-cache

报错:如果有编译错误,主要修改CMakeLists.txt文件

Part 2. 启动源码编译的nav2,

  source install/setup.bash
  export TURTLEBOT3_MODEL=waffle
  export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/humble/share/turtlebot3_gazebo/models
  ros2 launch nav2_bringup tb3_simulation_launch.py headless:=False

ros2与turtlebot3仿真教程-启动gazebo不同环境

参考链接:  https://blog.51cto.com/u_1790502/6087725

你可能感兴趣的:(ROS系统,Linux-Ubuntu,工程平台,linux,ROS)