depthai-ros icon indicating copy to clipboard operation
depthai-ros copied to clipboard

Issue with Stereo Odometry

Open imranhussain14 opened this issue 1 year ago • 8 comments

Hello, I a using the OAK-D-PRO-W-POE camera for mapping the outdoor environment. I a using the visual odometry from rtabmap. When i launch the depthai_example/ stereo_inertial_node with depth_aligned=true, the rgbd_odometry and rtabmap_slam both are working good. but when i try to launch the stereo_inertial node with depth_aligned = false. i am getting the erroe with stereo_odometry.

Error: The stereo baseline (-0.075725) should be positive (baseline=-Tx/fx). We assume a horizontal left/right stereo setup where the Tx (or P(0,3)) is negative in the right camera info msg.

I need help to solve this issue. Anyone have an idea about this kind of problem? Thank You

imranhussain14 avatar Sep 25 '24 13:09 imranhussain14

Hi, the DepthAI library has a different convention for stereo pair (in OpenCV/ROS format, the "first" sensor is the left one, whereas in DepthAI it is the right one), so the baseline is reported as negative. Since stereo_inertial_node is just a static example and not a proper driver there is no option to change this convention (unless someone will want to add is as PR), but it is an option in depthai_ros_driver, you can change it with a parameter i_reverse_stereo_socket_order for both stereo node (as described here) or for individual sensors

Serafadam avatar Oct 01 '24 05:10 Serafadam

Thank You for your reply, I tried to look at the link you given but i didn't understand how i reverse the stereo_socket order. But, what i did is to just change the camera_info topic of both left and right sensors and i didn't get the baseline error and the mapping result is also quite better than the rgbd ones. I am not sure is it the right way or not. I comman i use to launch the rtabmap is :

roslaunch rtabmap_launch rtabmap.launch
args:="--delete_db_on_start"
stereo:=true
left_image_topic:=/stereo_inertial_publisher/left/image_rect
right_image_topic:=/stereo_inertial_publisher/right/image_rect
left_camera_info_topic:=/stereo_inertial_publisher/right/camera_info
right_camera_info_topic:=/stereo_inertial_publisher/left/camera_info
imu_topic:=/stereo_inertial_publisher/imu/data
frame_id:=oak-d_frame
approx_sync:=true
approx_sync_max_interval:=0.001
wait_imu_to_init:=true and the mapping result i get is : stereo_lab and with rgbs densor its like : rgbd_lab

Now, I want to ask this is it the right way or not . Or i have to change the socket order if i want to use the stereo sensor for this?.

Regards, Imran

imranhussain14 avatar Oct 02 '24 01:10 imranhussain14

+1

mizrex avatar Oct 23 '24 16:10 mizrex

Hi, I think the differences between could be caused by different configurations inside RTABMap but I can't be sure. Did you try to run the driver from depthai_ros_driver?

Serafadam avatar Oct 25 '24 15:10 Serafadam

Hi @Serafadam , the depthai_ros_driver route, which has the rtabmap.launch.py example, is pretty slow in performance, compared to the depthai.launch.py example which uses the stereo_inertial_node. The stereo_inertial_node route is better to go with, but how would we go about flipping the left and right cameras inside the stereo_inertial_node . As the /odom topic computed using the stereo_inertial_node is completely flipped. Which will cause further issues if it were to be used in other packages.

mizrex avatar Oct 29 '24 19:10 mizrex

Hi, for that you would need to modify the code of stereo_inertial_node.cpp to switch the baselines around

Serafadam avatar Oct 30 '24 13:10 Serafadam

Hi @Serafadam , thank you for getting back. I thought it was the stereo_inertial_publisher.cpp. I believe the stereo_inertial_node.launch.py is invoking the stereo_inertial_publisher.cpp node. Please correct me if I'm wrong. I have tried playing with the stereo_inertial_publisher.cpp file yesterday. Tried swapping the cam_B and cam_C here. But it would break rtabmap, and also not flip the /odom topic. Have also tried adding left-camera instead of right-camera here in this block. But it didn't work either. If you have any insight on how to go about flipping it?

Thanks again.

mizrex avatar Oct 30 '24 13:10 mizrex

Hi, for switching them I think you would need to call reverseStereoSocketOrder on respective image converters. You also can use depthai_ros_driver to publish stereo images, with that it's only a parameter change

Serafadam avatar Nov 06 '24 16:11 Serafadam