To suppress the bundle adjustment error, set OdomF2M/BundleAdjustment to 0 and Vis/BundleAdjustment to 0.
The static transforms between the camera on 2_b.db are wrong:
The static transforms between the cameras for 2_a.db seem ok, but there is a missing rotation to put the cameras from image coordinates to ROS coordinates (it is like the first camera is looking up):
Looking at the demo_two_kinects.launch, the difference is that with kinect for xbox 360, the driver publishes the optical rotation between camera_link and rgb optical frame. For the kinect v2, the camera_link to rgb optical frame doesn't have the optical rotation. To copy the approach of demo_two_kinects.launch with kinect v2, we should do this:
Thank you very much, my problem solved but I have another problem with the created map, the floor in the real world is flat but my map shows the floor is like a curve! after loop closure, it improved but still there is a problem with the map, do you have any solution for that?
Thank you for your reply I got the better result, sorry for my multiple questions.
I have a problem with my RosBag file, the recorded rosbag file during running with two cameras I face this warning and rtabmap doesn't work :
[ WARN] [1540822249.021635274, 1539068344.035866149]: /rtabmap/rtabmapviz: Did not receive data since 5 seconds! Make sure the input topics are published ("$ rostopic hz my_topic") and the timestamps in their header are set. If topics are coming from different computers, make sure the clocks of the computers are synchronized ("ntpdate"). If topics are not published at the same rate, you could increase "queue_size" parameter (current=10).
/rtabmap/rtabmapviz subscribed to (approx sync):
when I using this 2kinect_map.launch file in real time it's working but once I recorded in a ros bag and run it later I face this problem.
/camera1/qhd/camera_info /camera1/qhd/image_color_rect /camera1/qhd/image_depth_rect /camera2/qhd/camera_info /camera2/qhd/image_color_rect /camera2/qhd/image_depth_rect /tf
The link doesn't seem to work. You can copy/paste the inside of the file here between raw xml tags (or click More->Raw text). When replaying a bag with TF, make sure you started a roscore with use_sim_time set to true and play the bag with --clock:
$ rosparam set use_sim_time true
$ rosbag play --clock my.bag
Your bag seems to have /map and /odom frames recorded. If you just want to record camera images, don't launch rtabmap and rgbd_odometry at the same time. Otherwise, you may remove /map and /odom frames using a script similar to this one.
You can share a small rosbag to reproduce the problem.
One problem was that running without the camera drivers, there were no nodelet managers. I added one for rgbd_sync nodelets. As Kinect v2 topics are used, I set also approx_sync to false for rgbd_sync nodelets.
Run the bag:
rosbag play --clock test1.bag
The cameras seem tilted towards the ceiling though, adjust TF or make sure that the cameras are physically looking straight forward.