1. 安装ROS-Gazebo组件
sudo apt-get install ros-melodic-gazebo-ros-pkgs ros-melodic-gazebo-ros-control
2. 安装turtlebot
sudo apt-get install ros-melodic-turtlebot*
3. 配置文件
echo "export TURTLEBOT3_MODEL=burger" >> ~/.bashrc
4. 启动仿真环境
roslaunch turtlebot3_gazebo turtlebot3_world.launch
5. 启动键盘控制节点
rosrun teleop_twist_keyboard teleop_twist_keyboard.py
6. 启动gmapping建图节点
roslaunch turtlebot3_slam turtlebot3_slam.launch slam_methods:=gmapping
7. 保存建立的静态地图
rosrun map_server map_saver -f ~/map
8. 启动navigation导航节点
roslaunch turtlebot3_navigation turtlebot3_navigation.launch map_file:=$HOME/map.yaml
如果想自己源码编译,怎么做呢?
1. 创建工作空间
mkdir -p turtlebot_ws/src
cd turtlebot_ws/src/
catkin_init_workspace
cd ..
catkin_make
2. 下载源码包
cd src
git clone https://ghproxy.com/https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
git clone https://ghproxy.com/https://github.com/ROBOTIS-GIT/turtlebot3.git
git clone https://ghproxy.com/https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
3. 编译测试
cd ..
catkin_make
source devel/setup.bash
# 依次启动仿真、键盘控制、建图、保存地图、导航节点
roslaunch turtlebot3_gazebo turtlebot3_world.launch
rosrun teleop_twist_keyboard teleop_twist_keyboard.py
roslaunch turtlebot3_slam turtlebot3_slam.launch slam_methods:=gmapping
rosrun map_server map_saver -f ~/map
roslaunch turtlebot3_navigation turtlebot3_navigation.launch map_file:=$HOME/map.yaml
如果想要自定义一些算法,修改参数测试,就可以从源码中turtlebot3
修改,编译,测试验证。