更多细节请查看

https://emanual.robotis.com/docs/en/platform/turtlebot3/quick-start/#pc-setup

0、先拉取代码和配置环境变量

sudo apt install ros-humble-gazebo-*
sudo apt install ros-humble-cartographer
sudo apt install ros-humble-cartographer-ros
sudo apt install ros-humble-navigation2
sudo apt install ros-humble-nav2-bringup



mkdir turtlebot3_ws/src
cd ~/turtlebot3_ws/src/
$ git clone -b humble https://github.com/ROBOTIS-GIT/DynamixelSDK.git
$ git clone -b humble https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
$ git clone -b humble https://github.com/ROBOTIS-GIT/turtlebot3.git

sudo apt install python3-colcon-common-extensions

cd ~/turtlebot3_ws
$ colcon build --symlink-install

echo 'source ~/turtlebot3_ws/install/setup.bash' >> ~/.bashrc
echo 'export ROS_DOMAIN_ID=30 #TURTLEBOT3' >> ~/.bashrc
echo 'source /usr/share/gazebo/setup.sh' >> ~/.bashrc
echo 'source /opt/ros/humble/setup.bash' >> ~/.bashrc
source ~/.bashrc

1、启动 gazebo 加载机器人模型和地图

ros2 launch turtlebot3_gazebo turtlebot3_house.launch.py

# 或者下面这个
ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py

2、启动 rviz

# 开启 cartographer 建图并打开 rviz
ros2 launch turtlebot3_cartographer cartographer.launch.py use_sim_time:=True 

# 或者只打开 rviz,自行启动建图算法
ros2 launch turtlebot3_bringup rviz2.launch.py 

3、使用键盘控制 gazebo 中的机器人到处走,完成建图

ros2 run turtlebot3_teleop teleop_keyboard

#如果懒的话也可以使用下面的命令,小车会自己乱走
ros2 run turtlebot3_gazebo turtlebot3_drive

4、在 rviz 中保存配置,并且在命令行中保存地图

ros2 run nav2_map_server map_saver_cli -f ~/map

Logo

中国智能体开发者社区,聚焦智能体与大模型开发,提供前沿资讯、实用工具链、开源项目及行业案例。通过技术沙龙、开发者大赛等活动,促进经验交流与协作,助力开发者快速构建创新智能应用。

更多推荐