Rosanswers logo

Hello, I'm using the viso2_ros' stereo node with Ubuntu 12.04 and ROS Hydro. My setup consists of two webcams attached to a steady surface at a distance of 17.3 cm from each other and calibrated with the stereo camera_calibration.

I am viewing in Rviz the Pose and Point_cloud published by the node and after a few seconds of running, the Pose starts shooting up:

the pose vector goes up from the point where the pink arrow is at

I also get a the "Visual Odometry got Lost!" message frequently. I checked the ~info topic and this was the outcome:

Messages published by the ~info topic

I read the FAQs for the package and I tried to apply the solutions given to people with similar issues. So I reset the odometer by calling the stereo_odometer/reset_pose service and changed the match_disp_tolerance parameter.

Reseting the odometer didn't work because the pose went back down to the grid but after a few seconds it was going up again.

I increased the match_disp_tolerance parameter from 5 (the value that it had by default) to 20 and then to 100. For some reason the number of "Visual Odometry got Lost!" messages increased with the parameter, and I think it worked the best with the original value.

changing match_disp_tolerance to 20

I thought the problem might be that the number of inliers was too low, but even if i changed the background drastically the number of inliers didn't remain high for long (sometimes I get a lot of inliers but after a few seconds, without moving the camera, they decrease to less than 10, then they go up again and so on). This is the image I was viewing for the messages on some of the screenshots above:


And this is the launch file I'm using:

<!-- Arguments -->
<arg name="camera" default="/stereo" /> <!-- The namespace where images are published -->

<!-- Run the camera -->
    <group ns="stereo" >
        <node pkg="uvc_camera" type="uvc_stereo_node" name="uvc_stereo_node">
            <param name="left/device" type="string" value="/dev/video1" />
            <param name="right/device" type="string" value="/dev/video2" />

<!-- Run the ROS package stereo_image_proc -->
<group ns="$(arg camera)" >
    <node pkg="stereo_image_proc" type="stereo_image_proc" name="stereo_image_proc">

<!-- Publish transforms -->

<node pkg="tf" type="static_transform_publisher" name="camera_broadcaster" args="0 0 0 0 0 0 1 base_link camera 100" />

<!-- Run the viso2_ros package -->

<node pkg="viso2_ros" type="stereo_odometer" name="stereo_odometer" output="screen">
    <remap from="stereo" to="$(arg camera)"/>
    <remap from="image" to="image_rect"/>
    <param name="match_disp_tolerance" type="int" value=“20” />  <!-- Set to 5 by default -->

<!-- Run Rviz -->   
<node pkg="rviz" type="rviz" name="rviz">

Since I was getting the "Visual Odometry got Lost!" message constantly, I decided to test the odometry of the stereo camera without the robot, that's why I publish the tf with arguments 0 0 0 0 0 0 1 base_link camera 100. I still have some trouble grasping the tfs so I didn't want to add any mistake with them to my current problem.

I'm not sure if I'm doing something wrong or if my cameras are not good enough to use the package, so I would really appreciate any ideas or corrections about it.

Thank you in advance.

---- Question Update ----

Hello, Thank you very much for both answers, I followed your advice and recalibrated sticking the calibration paper to a rigid surface, the reprojection error went down a bit and I think the disparity image is showing some structure as Miquel Massot said it should. I used the new calibration with viso2_ros following the same steps as before and this time the pose remains completely stills, but the Lost Odometry flag is always set, because the node is always recognising 3 inliers or less. I repeated the calibration a couple more times but the result was the same. The following are images from my last attempt:

Best Calibration Achieved Reprojection Error odometry lost flag always set

I tried moving the cameras around to check if it was my background that didn't have enough inliers, but the result was the same. Is my calibration still too bad for the package to function properly?

Sorry for editing my original answer and making the question so long. The comment section was too short and I didn't want to spam with several comments.

Thank you again for your time.

Originally posted by Athria on ROS Answers with karma: 78 on 2015-02-07

Post score: 0


1 Answer 1


Rosanswers logo

In my opinion, your stereo pair does not look well calibrated. The disparity image should show at least some structure. Could you tell me which was your score when you calibrated the stereo rig? The number that appears after the calibration is the reprojection error in pixels. A number below 0.6 or 0.4 is desirable.

The calibration should also show that a particular feature in the left image can be found in the same row in the right image. By visual inspection at your image pairs, these images are not correctly calibrated.

As suggested by Stephan, use a rigid calibration pattern or glue that piece of paper to something rigid and flat. Now is looking better, but you should achieve a better calibration.

Try to follow this tutorial with your images. Your disparity image should look like this image looks in the tutorial. Which are your stereo params?

Originally posted by Miquel Massot with karma: 1471 on 2015-02-11

This answer was ACCEPTED on the original site

Post score: 2

Original comments

Comment by Athria on 2015-02-11:
Hello, thank you very much for the answer, I didn't know the value of the error, so I recalibrated again. This was the best calibration I could get:

Calibration outcome Calibration outcome reprojection error

Comment by Athria on 2015-02-11:
Sometimes the error is as low as 0.42 and others as high as 1.8 (if i move the pattern fast) for that calibration. I tried again to use Viso2 but I got pretty much the same results, so I guess the calibration is still bad. Is there a way to improve it? I can't get the Size bar higher. Thank you!

Comment by Stephan on 2015-02-11:
That looks better then before. Be sure to move the calibration pattern to each corner, very close, very far away and tilted to all sides. Move slowly. It looks like it is just a piece of paper? You have to make sure that it does not bend so glue it onto something rigid.

Comment by Athria on 2015-02-13:
Hello, I was using the default stereo params, I had tried to follow that tutorial before but I never managed to get anything similar to their images. I've been trying again and this is as close as I could get by following the tutorial's advice: best image

Comment by Athria on 2015-02-13:
I also tweaked my stereo camera params a bit, to try and get a better image and I ended up with this parameters: With tweaked params1 and With tweaked params2

Comment by Miquel Massot on 2015-03-16:
Sorry for the late comment. We are using these params.

Comment by Athria on 2015-03-21:
Thank you very much! I'll keep working on my params

Comment by Sai Anirudh Kondaveeti on 2015-07-28:
Are you getting good odometry results?

Comment by Athria on 2015-10-12:
Sorry Sai, I missed your comment, I did not manage to get good results in the end. I ended up working with a different monocular camera.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.