ROS2 Humble仿真turtlebot3

本文详细介绍了在Ubuntu22.04系统上安装ROS2Humble及相关包,如turtlebot3、DynamixelSDK等,包括建图、启动仿真环境、键盘控制以及使用nav2进行导航的步骤。每次新开终端前需重新编译环境。
摘要由CSDN通过智能技术生成

环境:ubuntu22.04+ROS2 humble,事先已安装gazebo

一、准备工作

安装turtlebot3功能包

mkdir -p ~/turtlebot3_ws_my/src
cd ~/turtlebot3_ws_my/src/
git clone -b humble-devel https://github.com/ROBOTIS-GIT/DynamixelSDK.git
git clone -b humble-devel https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
git clone -b humble-devel https://github.com/ROBOTIS-GIT/turtlebot3.git
git clone -b humble-devel https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git

编译

cd ..
colcon build --symlink-install

添加环境变量

echo 'source ~/turtlebot3_ws_my/install/setup.bash' >> ~/.bashrc
echo 'export ROS_DOMAIN_ID=30 #TURTLEBOT3' >> ~/.bashrc
echo 'export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:~/turtlebot3_ws_my/src/turtlebot3/turtlebot3_simulations/turtlebot3_gazebo/models' >> ~/.bashrc
echo 'export TURTLEBOT3_MODEL=burger' >> ~/.bashrc
source ~/.bashrc

二、建图

启动仿真环境

ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py

打开rviz2准备绘图

ros2 launch turtlebot3_cartographer cartographer.launch.py use_sim_time:=True

启动键盘控制

ros2 run turtlebot3_teleop teleop_keyboard

保存地图

ros2 run nav2_map_server map_saver_cli -f ~/路径/地图名称

三、导航

启动仿真环境

ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py

导航(使用刚才保存的地图)

ros2 launch turtlebot3_navigation2 navigation2.launch.py use_sim_time:=true map:=路径/地图名称.yaml

在rviz2可视化界面,先用2D Pose Estimate进行位姿估计,然后用Nav2 Goal选择目标点的位姿进行导航。

-----------------------------------------------------------------------------------------------

注意:在建图或导航过程中,每新开一个终端都需要先编译,编译命令如下

colcon build --symlink-install

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值