【ROS】ROS2

编程入门 行业动态 更新时间:2024-10-23 21:38:45

【<a href=https://www.elefans.com/category/jswz/34/1768665.html style=ROS】ROS2"/>

【ROS】ROS2

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 .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不同环境

参考链接:  

更多推荐

【ROS】ROS2

本文发布于:2023-11-15 20:54:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1606195.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:ROS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!