本文叙述了在gazebo仿真环境和rviz可视化工具的背景下,使用gmapping算法和turtlebot3-burger机器人在自己构建的室内场景中建图过程
1. 建立工作空间
(1)建立基本工作空间
mkdir catkin_ws_robotroom
cd catkin_ws_robotroom
mkdir src
catkin_init_workspace
catkin_create_pkg turtlebot3_room std_msgs rospy roscpp
cd ..
catkin_make
(2)刷新环境并确定模型
cd ~/catkin_ws_robotroom/src
git clone https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
git clone https://github.com/ROBOTIS-GIT/turtlebot3.git
git clone https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
cd ~/catkin_ws_robotroom
rosdep install --from-paths src -i -y
catkin_make
echo "source ~/catkin_ws_robotroom/devel/setup.bash " >> ~/.bashrc
source ~/.bashrc
echo "export TURTLEBOT3_MODEL=burger" >> ~/.bashrc
source ~/.bashrc
2. 配置launch文件
(参考上一条博客)
3. 建图
(1)启动gazebo仿真环境
roslaunch turtlebot3_room turtlebot3_room.launch
(2)启动gmapping建图
roslaunch turtlebot3_slam turtlebot3_slam.launch slam_methods:=gmapping
(3)打开键盘,控制turtlebot3四处移动,直到建图满意
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
(4)保存地图
rosrun map_server map_saver -f ~/map
参考资料
Turtlebot3仿真环境搭建
ROS探索总结(八)——键盘控制
(三)ROS中控制机器人运动的实现(在gazebo中显示)
ROS笔记(三)用键盘控制模型在gazebo中移动