11.2.1.6. 多個 TB3 的虛擬 SLAM

1) 在 TurtleBot3 House 地圖呼叫 3 個 TB3s

$ roslaunch turtlebot3_gazebo multi_turtlebot3.launch

這些載入的 TB3s 初始位置和方向已設置。

2) 執行 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

3) 將每個 TB3 各自的地圖數據合併為一個地圖數據

在啟動此節點之前,請確認 TB3s 的位置和方向的參數

$ sudo apt-get install ros-kinetic-multirobot-map-merge
$ roslaunch turtlebot3_gazebo multi_map_merge.launch

4) 執行 RViz 工具

$ rosrun rviz rviz -d `rospack find turtlebot3_gazebo`/rviz/multi_turtlebot3_slam.rviz

5) Teleoperation 鍵盤遙控操作

$ 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

6) 儲存地圖

$ rosrun map_server map_saver -f ~/map

Last updated