Record a map with a real Turtlebot3 - ovgu-FINken/driving_swarm_infrastructure GitHub Wiki

The general approach of recording a map is described in the Robotis-e-manual.

However, for the Turtlebots in our DrivingSwarm the whole thing needs to be namespaced. Hence, the launch files are adjusted and stored in the driving_swarm_infrastructure/map_creation_pkg/launch/ directory.

  1. Choose a robot where the IP is known to you (e.g. 10.61.10.201). Put it into the arena and boot it.

  2. To start the cartographer for this specific robot, run: ros2 launch map_creation_pkg cartographer_namespaced.launch.py robot_name:=robot201

  3. To let the robot move around the arena, run: ros2 run turtlebot3_teleop teleop_keyboard --ros-args -r __ns:=/robot201

  4. After you recorded everything that needs to be recorded, save the map by running: ros2 run nav2_map_server map_saver_cli -f ~/map --ros-args -r __ns:=/robot201

  5. Give the map file a meaningful name and move it to the src/driving_swarm_bringup/maps/ run colcon build to make it available.

Create a gazebo world from the map

To use a given scenario within a simulation, we can create a world file that is used by gazebo. The first step is to create a 3d-model from the map file. You may need to run pip install pycollada trimesh to install the necessary python packages.

ros2 launch map2gazebo mapfromfile2gazebo.launch.py map_file:=YOUR_MAP.yaml

Then we need to create a gazebo model. Copy the lndw2022 folder in driving_swarm_bringup/models and give it the same name as your map. Then, in the files, replace all instances of lndw2022 with the name of your map. In addition, you have to copy the file lndw2022.world in the directory driving_swarm_bringup/worlds and modify its content to match your newly created folder and map file.

Test to use a simulation with your map, and the simulated environment for your map to verify the results.