Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to launch Gazebo, RTAB-Map and RViz multiple times from a single file?

I followed the simulation part of the Mapping and Navigation on Turtlebot tutorial to try SLAM with RTAB-Map. I want to be able to launch Gazebo, rtabmap_ros and RVIZ from a single launch file/script and repeat the process over multiple iterations and pass arguments to RTAB-Map.

  1. I found a somewhat similar question where the person created a python script using roslaunch API. I tried to follow the simple examples in the tutorial to try and launch Gazebo and RTAB-Map to no avail. As I am not familiar with python codes, I seem to be missing something when I try to execute the examples. Has anyone tried this or something similar before? If yes, could you share a sample to launch Gazebo and RTAB-Map?
  2. As suggested in the same question, I also tried a shell script and was successfully able to launch Gazebo, RTAB-Map and Rviz. However, when trying to launch them in a loop, for 3 iterations, Gazebo launches thrice and then RTAB-Map tries to launch thrice, which breaks the code. I am looking for a way to launch the packages in the following sequence for multiple iterations:
$ roslaunch turtlebot_gazebo turtlebot_world.launch
$ roslaunch rtabmap_ros demo_turtlebot_mapping.launch simulation:=true
$ roslaunch rtabmap_ros demo_turtlebot_rviz.launch

Is there another way I could approach this?

PS: I am using ROS Kinetic on an Ubuntu 16.04 VM.