TurtleBot3多机建图教程-1.仿真测试
相关依赖安装
安装multirobot-map-merge包
sudo apt-get install ros-$ROS_DISTRO-multirobot-map-merge
说明:
先来一个仿真的案例
步骤:
开启roscore
roscore
在Gazebo中的TurtleBot3 House环境加载三台机器人:
roslaunch turtlebot3_gazebo multi_turtlebot3.launch
分别打开三个新终端,三台机器人启动gmapping SLAM程序:
第一个终端
ROS_NAMESPACE=tb3_0 roslaunch turtlebot3_slam turtlebot3_gmapping.launch set_base_frame:=tb3_0/base_footprint set_odom_frame:=tb3_0/odom set_map_frame:=tb3_0/map
第二个终端
ROS_NAMESPACE=tb3_1 roslaunch turtlebot3_slam turtlebot3_gmapping.launch set_base_frame:=tb3_1/base_footprint set_odom_frame:=tb3_1/odom set_map_frame:=tb3_1/map
第三个终端
ROS_NAMESPACE=tb3_2 roslaunch turtlebot3_slam turtlebot3_gmapping.launch set_base_frame:=tb3_2/base_footprint set_odom_frame:=tb3_2/odom set_map_frame:=tb3_2/map
再次打开一个新终端,启动地图融合程序:
roslaunch turtlebot3_gazebo multi_map_merge.launch
新终端,启动 rviz:
rosrun rviz rviz -d `rospack find turtlebot3_gazebo`/rviz/multi_turtlebot3_slam.rviz
键盘控制
分别打开三个新终端,启动三台机器人的键盘控制程序:
第一个终端
ROS_NAMESPACE=tb3_0 rosrun turtlebot3_teleop turtlebot3_teleop_key
第二个终端
ROS_NAMESPACE=tb3_1 rosrun turtlebot3_teleop turtlebot3_teleop_key
第三个终端
ROS_NAMESPACE=tb3_2 rosrun turtlebot3_teleop turtlebot3_teleop_key
分别用W A X D键移动三台机器人,分区域建图
建图完成后,打开新终端,保存地图:
rosrun map_server map_saver -f ~/map_multi