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

cv::StereoBM (in rtabmap) may not be able to generate a disparity image, so the point cloud sent to PCLVisualizer is empty and not added, causing other functions assuming that the cloud is there to throw this error. If you send your stereo images to stereo_img_proc, can it produce a valid disparity image and a point cloud? Can you also update your question with an example of left and right images (those sent to rtabmap) with corresponding camera_info?

cv::StereoBM (in rtabmap) may not be able to generate a disparity image, so the point cloud sent to PCLVisualizer is empty and not added, causing other functions assuming that the cloud is there to throw this error. If you send your stereo images to stereo_img_proc, can it produce a valid disparity image and a point cloud? Can you also update your question with an example of left and right images (those sent to rtabmap) with corresponding camera_info?

EDIT

After trying the bag, here some problems:

  1. Baseline is large: from right camera_info above, -(-263.97/212.49) = 1.24 m. What is the actual baseline between cameras (measured manually or from spec)?
  2. Because of (1), the scale of the point cloud generated is huge. By default on older rtabmap versions, the point clouds are filtered up to 4 meters in 3d Rendering settings. Set max depth to 0 to avoid filtering the clouds.
  3. The images (when comparing left and right) are not correctly rectified, there are some pixel errors along Y axis in images.
  4. You may need to set frame_id of images/camera_infos to "left_optical_frame" for example, and add a static_transform_publisher base_link -> left_optical_frame with transform "0 0 0 -1.570796327 0 -1.570796327" to that point clouds are correctly transformed in ROS coordinates.

A screenshot of the problems: image description Note the y error on left with superposed left and right images. On right the grid is 1 meter, frustums of both cameras are shown for reference (looking upward as there is no optical rotation).

cv::StereoBM (in rtabmap) may not be able to generate a disparity image, so the point cloud sent to PCLVisualizer is empty and not added, causing other functions assuming that the cloud is there to throw this error. If you send your stereo images to stereo_img_proc, can it produce a valid disparity image and a point cloud? Can you also update your question with an example of left and right images (those sent to rtabmap) with corresponding camera_info?

EDIT

After trying the bag, here some problems:

  1. Baseline is large: from right camera_info above, -(-263.97/212.49) = 1.24 m. What is the actual baseline between cameras (measured manually or from spec)?
  2. Because of (1), the scale of the point cloud generated is huge. By default on older rtabmap versions, the point clouds are filtered up to 4 meters in 3d Rendering settings. Set max depth to 0 to avoid filtering the clouds.
  3. The images (when comparing left and right) are not correctly rectified, there are some pixel errors along Y axis in images.
  4. You may need to set frame_id of images/camera_infos to "left_optical_frame" for example, and add a static_transform_publisher base_link -> left_optical_frame with transform "0 0 0 -1.570796327 0 -1.570796327" to that point clouds are correctly transformed in ROS coordinates.

A screenshot of the problems: image description Note the y error on left with superposed left and right images. On right the grid is 1 meter, frustums of both cameras are shown for reference (looking upward as there is no optical rotation).

EDIT2: When I tested the bag, I didn't see problem with the number of disparities. See doc of StereoBM. Note that the number of disparities will create a border without disparity values of the same size on the left of the image. On images of 200 pixels width and StereoBM/NumDisparities set to 128, you will have more than half of the image without disparity values. This can create empty clouds if no disparity can be computed for the other half. Thus number of disparities should be lowered for small images. Last note, if you are trying to map a white wall (textureless surface), disparity will be null, causing also an empty cloud. The recent code should not add to PCL visualizer an empty cloud, so the pcl error would not appear anymore.