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

Stereo Baseline evaluates to 60m based on provided Ros calibration files #9

Open
antoan opened this issue Aug 3, 2017 · 3 comments

Comments

@antoan
Copy link

antoan commented Aug 3, 2017

When viewing the output pointcloud of Tara in Rviz, the rendered poincloud cluster always appears very far out in relation to the sensor position.

In addition, when I ran the sensor with RTABMAP Slam algoritm on ros, I had warning messages reporting a baseline of 60m. So I decided to have a look at the calibration files saved in ./ros/camera_info directory to check this.

Calculating resultant baseline

From http://docs.ros.org/jade/api/sensor_msgs/html/msg/CameraInfo.html


# Projection/camera matrix 
#     [fx'  0  cx' Tx] 
# P = [ 0  fy' cy' Ty] 
#     [ 0   0   1   0] 

 For a stereo pair, the fourth column [Tx Ty 0]' is related to the 
#  position of the optical center of the second camera in the first 
#  camera's frame. We assume Tz = 0 so both cameras are in the same 
#  stereo image plane. The first camera always has Tx = Ty = 0. For 
#  the right (second) camera of a horizontal stereo pair, Ty = 0 and 
#  Tx = -fx' * B, where B is the baseline between the cameras. 
# Given a 3D point [X Y Z]', the projection (x, y) of the point onto 
#  the rectified image is given by: 
#  [u v w]' = P * [X Y Z 1]' 
#         x = u / w 
#         y = v / w 
#  This holds for both images of a stereo pair. 

By inspecting the above implementation we can obtain the following expression for the camera
B. = Tx/ -fx' .

To plugin clibration values into this expresion:

rostopic echo /stereo/right/camera_info yields the following calibration data:


baseline:
 header:  
seq: 58353 
  

stamp:  
    secs: 1487095146 
    nsecs: 395846011 
  frame_id: cameraRight 
  height: 480 
  width: 640 
distortion_model: plumb_bob 
 

D: [0.07605147268718865, -0.10460650838049133, -0.0007509911020167615, 0.00132543597977628, 0.0] 
K: [716.48014094073, 0.0, 372.7554435232446, 0.0, 716.48014094073, 207.9128389238769, 0.0, 0.0, 1.0] 
R: [0.9999239895914122, 0.0006505711472601458, 0.012312262049520396, -0.0006210945657670888, 0.99999693250006, -0.002397755619488692, -0.012313784192281496, 0.002389926286053135, 0.9999213263908381] 
 

P: [739.0412675724488, 0.0, 368.44042587280273, -44485.417759835844,  

    0.0, 739.0412675724488,  211.154052734375, 0.0,  

    0.0, 0.0, 1.0, 0.0] 

 
binning_x: 0 
binning_y: 0 
roi:  
  x_offset: 0 
  y_offset: 0 
  height: 0 
  width: 0 
  do_rectify: False 

This further yeilds:

Tx = -44485.417759835844, fx' = 739.0412675724488

Baseline = Tx/-fx' = -44485.417759835844/ - 739.0412675724488 = 60.193415052

@antoan
Copy link
Author

antoan commented Aug 5, 2017

screenshot from 2017-08-05 15 50 37
The attached screenshot shows the rendered Tara output in Rviz, set up so that the sensor is pointing up using a static frame publisher and the ros package stereo_proc .

The rectangles in red on the right hand side of the screen contain the rviz grid (10x10m) and rendered point cloud above it (visible as a sparse line).

@antoan
Copy link
Author

antoan commented Aug 5, 2017

To fix this I tried to do a manual stereo calibration using the ROS camera calibrator package with no luck:


tony@Mordor:~/catkin_ws$ roslaunch tara_launch.launch &
[1] 16034
tony@Mordor:~/catkin_ws$ ... logging to /home/tony/.ros/log/c372cdc2-76de-11e7-ad0f-14dae91b4fe9/roslaunch-Mordor-16034.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://Mordor:46780/

SUMMARY
========

PARAMETERS
 * /rosdistro: indigo
 * /rosversion: 1.11.21
 * /stereo/uvc_camera/cameraLeft_info_url: file://${ROS_HOME...
 * /stereo/uvc_camera/cameraRight_info_url: file://${ROS_HOME...
 * /stereo/uvc_camera/device: /dev/video0
 * /stereo/uvc_camera/exposureValue: 1
 * /stereo/uvc_camera/fps: 30
 * /stereo/uvc_camera/frame: webcam
 * /stereo/uvc_camera/height: 480
 * /stereo/uvc_camera/width: 640

NODES
  /stereo/
    uvc_camera (uvc_camera/tara_node)

ROS_MASTER_URI=http://localhost:11311

core service [/rosout] found
process[stereo/uvc_camera-1]: started with pid [16052]
[ERROR] [1501945752.714151475]: Tried to advertise a service that is already advertised in this node [/stereo/set_camera_info]

firmwareversion of the camera is 1 : 2 : 131 : 652
Left camera matrix not found
Right camera matrix not found
[ INFO] [1501945755.250379602]: camera calibration URL: file:///home/tony/.ros/camera_info/cameraLeft.yaml
[ INFO] [1501945755.264008500]: camera calibration URL: file:///home/tony/.ros/camera_info/cameraRight.yaml
current value of Brightness is 4



$ ROS_NAMESPACE=stereo rosrun stereo_image_proc stereo_image_proc

tony@Mordor:~/catkin_ws$ rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.034 right:=/right/image_raw left:=/left/image_raw left_camera:=/left right_camera:=/right &
[2] 16308
tony@Mordor:~/catkin_ws$ ('Waiting for service', '/left/set_camera_info', '...')
Service not found
('Waiting for service', '/right/set_camera_info', '...')
Service not found

@dilipkumar25
Copy link
Owner

Hi @antoan ,

The formula you are using to calculate baseline is correct (B. = Tx/ -fx' ). But I'm not sure how you derive at the unit of baseline. The value of 60 mm is the correct baseline for this camera. It should be in millimeters and not in meters like you have derived.

e-con systems currently does not support calibrating its cameras by end users. All Tara cameras come precalibrated from the factory. So, you are on your own in that regard. Unless you played around with the casing or the lenses, recalibration will not be necessary.

This is an open-source project with the primary intention of enabling beginners to get started with using the Tara camera on ROS. If you have any radical questions or require priority support, I'd suggest you contact e-con's support team directly via mail ([email protected]).

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

No branches or pull requests

2 participants