Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Stereo Odometry #597

Open
imranhussain14 opened this issue Sep 25, 2024 · 8 comments
Open

Issue with Stereo Odometry #597

imranhussain14 opened this issue Sep 25, 2024 · 8 comments
Labels
question Further information is requested

Comments

@imranhussain14
Copy link

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 imranhussain14 added the question Further information is requested label Sep 25, 2024
@Serafadam
Copy link
Collaborator

Serafadam commented Oct 1, 2024

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

@imranhussain14
Copy link
Author

imranhussain14 commented Oct 2, 2024

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

@mizrex
Copy link

mizrex commented Oct 23, 2024

+1

@Serafadam
Copy link
Collaborator

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?

@mizrex
Copy link

mizrex commented Oct 29, 2024

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.

@Serafadam
Copy link
Collaborator

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

@mizrex
Copy link

mizrex commented Oct 30, 2024

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.

@Serafadam
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants