Localizing two Kinects in one map

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Localizing two Kinects in one map

bolt
Hi.

I have a Kinect on my robot from which I create a map. I then switch to localization mode and use the rgbd_odometry node to help track position. This all works great.

I am now trying to take the map created by the robot and localize a Kinect 2 (in handheld mode) within that map, whilst the robot is still running, so that their relative positions are correct. In order to do this I am running separate instances of rtabmap and rgbd_odometry for the Kinect 2. I have set the odom_frame_id in rtabmap and rgbd_odometry to kinect2_odom so that it is different to odom which is the frame for the robot. I am not sure if this is the correct approach? I am also running the Kinect 2 nodes under a different namespace so that they don't clash.

When I visualize the Kinect 2 and the robot within the map generated by the Kinect 2 nodes, the Kinect 2 is in the correct position but the robot is not:



When I visualize the Kinect 2 and the robot within the map generated by the robot nodes, the robot is in the correct position but the Kinect 2 is not:



Here is my tf tree:



Where am I going wrong here? Is there a way to configure it so that the maps generated by the two instances of rtabmap are aligned and the relative positions of the Kinect 2 and the robot are correct?

Many thanks for your help,
Jon.
Reply | Threaded
Open this post in threaded view
|

Re: Localizing two Kinects in one map

matlabbe
Administrator
Hi,

You are very close to have something working. I did a small example with two hand-held Kinect360 based on what you have done. See test_two_kinects_one_map.launch

First, I followed this tutorial to create a map with one of the kinect, this created the default ~/.ros/rtabmap.db. The launch file above uses that default database in localization mode for both rtabmap instances.

Second, I launched test_two_kinects_one_map.launch:



When both cameras are localized in the map, they appear at the same time in RVIZ with corresponding TF. In first screenshot above, I put the cloud map of rtabmap1 and the occupancy grid map of rtabmap2. They correspond correctly.

For your problem, it is like the map are not optimized from the same nodes in both rtabmap instances. Make sure RGBD/OptimizeFromGraphEnd is false (default is false). You may try to reproduce the example above with your Kinect2.

cheers,
Mathieu