ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.

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):

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.