Robotics StackExchange | Archived questions

disparity image is displayed but pointcloud shows only a small dot in rviz

Hi all, I am trying to get disparity image and pointclouds from VREP's two vision sensors(assembled like stereo camera) using StereoImageProc. Disparity image is successfully displayed and pointcloud topic (i-e /points2) publishes consistent data at each iteration(I mean its data contains few numbers like 197, 172,0 ,0,0,0 etc repeatedly). I don't know where am I doing mistake. I would be highly grateful if someone please solve my this problem. I have attached rqt_graph, rostopic echo /points2 and rviz display of pointcloud. Thanks

P.S I have uploaded the pics on github link text, please see there

Asked by SIU0598 on 2019-04-17 05:18:45 UTC

Comments

Answers

Gazebo Setup

  • I faced the exact same issue while simulating a custom stereo camera in Gazebo.
    This happens if you don't set the hackBaseline parameter.

  • Following is the Gazebo plugin I had used:

    <!-- SENSOR PLUGIN -->
    
    <gazebo reference="left_stereo_camera">
    
        <sensor type="multicamera" name="stereocamera">
            <always_on>true</always_on>
            <update_rate>10</update_rate>
            <camera name="left">
                <pose>0 0 0 0 0 0</pose>
                <horizontal_fov>${radians(front_camera_horizontal_fov)}</horizontal_fov>
                <image>
                    <width>640</width>
                    <height>480</height>
                    <format>RGB_INT8</format>
                </image>
                <clip>
                    <near>0.1</near>
                    <far>100</far>
                </clip>
            </camera>
            <camera name="right">
                <pose>0 -${front_camera_baseline} 0 0 0 0</pose>
                <horizontal_fov>${radians(front_camera_horizontal_fov)}</horizontal_fov>
                <image>
                    <width>640</width>
                    <height>480</height>
                    <format>RGB_INT8</format>
                </image>
                <clip>
                    <near>0.1</near>
                    <far>100</far>
                </clip>
            </camera>        
            <plugin name="stereo_camera_controller" filename="libgazebo_ros_multicamera.so">
                <robotNamespace>/</robotNamespace>
                <cameraName>stereocamera</cameraName>
                <alwaysOn>true</alwaysOn>
                <updateRate>10</updateRate>
                <imageTopicName>image_raw</imageTopicName>
                <cameraInfoTopicName>camera_info</cameraInfoTopicName>
                <frameName>stereo_optical</frameName>
                <hackBaseline>${front_camera_baseline}</hackBaseline>
                <distortion_k1>0.0</distortion_k1>
                <distortion_k2>0.0</distortion_k2>
                <distortion_k3>0.0</distortion_k3>
                <distortion_t1>0.0</distortion_t1>
                <distortion_t2>0.0</distortion_t2>
            </plugin>
        </sensor>
    </gazebo>
    
  • If hackBaseline is set to 0.00:

    Here you can see the dot in RViz at the centre of the optical frame.

  • If hackBaseline is set to 0.06:

References


Note: Please let me know if this solution doesn't work out for you. If in case it does, feel free to upvote my answer.

Asked by LSD on 2021-06-29 01:56:57 UTC

Comments

Hello, I've got exactly the same issue.
I've set the baseline correctly but I still have only 1point in rviz.
Do you have any other hint ?

Asked by Acwok on 2022-05-04 10:55:30 UTC

Have you spaced the stereo cameras according to your baseline requirement?

Asked by LSD on 2022-05-05 15:33:31 UTC

Hi @LSD, thank you for your quick reply. I finally found the issue. It seems that with the ros2 version of gazebo_ros_pkg the tags <hackBaseline> and <frameName> have been renamed respectively <hack_baseline> and <frame_name> see the code here https://github.com/ros-simulation/gazebo_ros_pkgs/blob/foxy/gazebo_ros/src/utils.cpp#L55

As the <frameName> tag wasn't read/recognized, the only point I had in rviz wasn't placed in my camera_link_optical frame but in the highest parent link of my URDF, that is to say base_footprint. After renaming the tag to <frame_name>, this point was placed at the origin of the camera_link_optical frame. Then I renamed the <hackBaseline> tag and all the points appeared.

The Gazebo documentation really sucks...
They even refer to a libgazebo_ros_multicamera.so for multicameras which doen't exist anymore, it has been included in libgazebo_ros_camera.so.

Asked by Acwok on 2022-05-06 03:11:23 UTC

I'm glad that you have found the solution!


There is a dedicated Wiki to the syntactical changes from ROS1 to ROS2 here.


Since you have faced issues regarding the migration of the camera plugin, I suggest going through the ROS2 Migration changes for the Camera plugin.

Asked by LSD on 2022-05-06 03:33:21 UTC