Ask Your Question
0

Stereo Camera Info Subscriber Throws Error

asked 2019-02-18 05:25:40 -0500

Jägermeister gravatar image

updated 2019-02-18 11:18:41 -0500

I am trying to subscribe to the camera info topic provided by my stereo-camera using Python:

self.camera_info = rospy.Subscriber("/nerian_stereo/stereo_camera_info", CameraInfo)

however, I get the following error:

[ERROR] [1550489001.885020747]: Client [/ros_node] wants topic /nerian_stereo/stereo_camera_info to have datatype/md5sum [sensor_msgs/CameraInfo/c9a58c1b0b154e0e6da7578cb991d214], but our version has [nerian_stereo/StereoCameraInfo/eca3b527e5502c28c9f17e8c40cf1d1c]. Dropping connection.

I did check if that topic publishes or not, and it does publish the following:

header: 
  seq: 0
  stamp: 
    secs: 1550489069
    nsecs: 658059275
  frame_id: "map"
left_info: 
  header: 
    seq: 195108
    stamp: 
      secs: 1550489069
      nsecs: 658059275
    frame_id: "map"
  height: 592
  width: 800
  distortion_model: "plumb_bob"
  D: [-0.06367426558562306, 0.09877103851635476, 0.00031019558294633924, -0.00034850082816263023, -0.035294875542571706]
  K: [684.0436298696771, 0.0, 383.8977028127636, 0.0, 681.8825674053443, 291.46442657960296, 0.0, 0.0, 1.0]
  R: [0.9999975506787532, 0.0020932805291636923, 0.0007188971558162386, -0.0020925240090497767, 0.9999972578637527, -0.0010514790758340117, -0.000721096225178569, 0.00104997219086539, 0.9999991887889872]
  P: [677.5530232455858, 0.0, 380.73382568359375, 0.0, 0.0, 677.5530232455858, 298.38965225219727, 0.0, 0.0, 0.0, 1.0, 0.0]
  binning_x: 1
  binning_y: 1
  roi: 
    x_offset: 0
    y_offset: 0
    height: 0
    width: 0
    do_rectify: False
right_info: 
  header: 
    seq: 195108
    stamp: 
      secs: 1550489069
      nsecs: 658059275
    frame_id: "map"
  height: 592
  width: 800
  distortion_model: "plumb_bob"
  D: [-0.07050014821240644, 0.15121497345155674, 0.001179938195432741, 0.0005238836140711377, -0.13054262535915223]
  K: [688.81655046723, 0.0, 378.2111821877113, 0.0, 686.8626877361024, 304.3933390790509, 0.0, 0.0, 1.0]
  R: [0.9999990871452151, -0.0007296095146042925, 0.0011372680829972413, 0.0007284141541189546, 0.9999991822576714, 0.0010511407178051629, -0.0011380340752739026, -0.0010503113560976435, 0.9999988008615304]
  P: [677.5530232455858, 0.0, 380.73382568359375, -67.95124548529029, 0.0, 677.5530232455858, 298.38965225219727, 0.0, 0.0, 0.0, 1.0, 0.0]
  binning_x: 1
  binning_y: 1
  roi: 
    x_offset: 0
    y_offset: 0
    height: 0
    width: 0
    do_rectify: False
Q: [1.0, 0.0, 0.0, -380.7133483886719, 0.0, 1.0, 0.0, -298.3891296386719, 0.0, 0.0, 0.0, 677.5579223632812, 0.0, 0.0, 9.971163749694824, 0.0]
T_left_right: [-0.1002891008148319, 7.317194896777106e-05, -0.00011405569753621334]
R_left_right: [0.9999959342341739, 0.0028204958709017384, -0.00041990256476554416, -0.0028213726499287835, 0.9999938100485598, -0.00210231323429016, 0.00041397039979239043, 0.0021034893883887227, 0.99999770197781]
---

What am I doing wrong?

EDIT: Okay, I found out the message the camera publishes, it's a different type indeed: http://docs.ros.org/api/nerian_stereo... . And I can now read the message from here. But I still need to find a way to get the left and right info from the message.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2019-02-18 11:23:07 -0500

Jägermeister gravatar image

updated 2019-02-18 11:23:32 -0500

First of all, the message had to be imported like this:

from nerian_stereo.msg import StereoCameraInfo

Then, in the subscriber, it had to be referred like this:

self.camera_info = rospy.Subscriber("/nerian_stereo/stereo_camera_info", StereoCameraInfo ,self.stereo_camera_cb) # get the camera info for TF and more

and the callback, should have been like this:

 def stereo_camera_cb(self, stereoInfo):

        # get both of the camera infos
        left_camera_info = stereoInfo.left_info 
        right_camera_info = stereoInfo.right_info 

        # Disparity-to-depth mapping matrix in 4x4 row-major format. Use this
        # matrix together with the  Reconstruct3D class from libvisiontransfer
        # to transform a disparity map to 3D points.
        q = stereoInfo.Q # float64[16]

        # Translation vector between the coordinate systems of the left and right camera.
        t_left_right = stereoInfo.T_left_right #float64[3]

        # Rotation matrix between the coordinate systems of the left and right camera in 3x3 row-major format.
        r_left_right = stereoInfo.R_left_right # float64[9]

Now I have the camera infos of both.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2019-02-18 05:25:40 -0500

Seen: 56 times

Last updated: Feb 18