本文主要是介绍【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_Workstationmkdir src
step 2. 下载Nav2项目的对应版本
cd srcgit 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.bashexport TURTLEBOT3_MODEL=waffleexport GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/humble/share/turtlebot3_gazebo/modelsros2 launch nav2_bringup tb3_simulation_launch.py headless:=False
ros2与turtlebot3仿真教程-启动gazebo不同环境
参考链接: https://blog.51cto.com/u_1790502/6087725
这篇关于【ROS】ROS2-humble安装navigation2与使用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!