I am trying to create a map of an unknown environment using 2 robots which are moving simultaneously. I am able to build map using one robot but how do I combine it with the map from other? How should I go about this?
Currently, you cannot combine maps on runtime, but you can offline. Assuming the robot 1 created a map called map_robot1.db and the robot 2created a map called map_robot2.db, then you can combine them together on command line with :
Ok, thanks for the response. I am launching mapping mode for both robots but I am only able to visualize mapping from one robot at a time on rviz. How is it possible to build maps from 2 robot simultaneously?
Are the two robots running an independent ROS master? or are they running with same ROS master? If they run with same ROS master, you have to launch both rtabmap nodes in different namespaces (same for all nodes running on each robot actually). You should also change the name of the TF frames (map_frame_id) accordingly (including robot's static TF too). Once the TF trees of the robots are in their respective namespace, you may launch two rviz, one with global frame set to root frame of robot 1, and the other one with root frame of robot 2.
If the robots are running their own ROS master, you may open two terminals on your remote computer and set the ROS_MASTER_URI accordingly in the terminals, then launch two rviz. I guess it is the easiest way to do it.
They are running on one ros-master and they have unique namespaces. After, I build the map which are w.r.t their /odom frame. How do I combine the maps build w.r.t /odom frame to one global frame (/map)?
If you want to see both robots at the same time in RVIZ, you will need to add an arbitrary transform between the two map frames. Assuming the map frame of robot 1 is in "robot1" namespace and map from of robot 2 is in "robot2" namespace: