Robotics StackExchange | Archived questions

Depth Camera Gazebo11 + ROS2 Foxy

Hi!

I have been given the following definition of a depth camera:

<gazebo reference="realsense_camera">
            <sensor name="camera" type="depth">
                <visualize>true</visualize>
                <update_rate>60.0</update_rate>
                <camera name="RS_D455">
                    <horizontal_fov>1.047198</horizontal_fov>
                    <image>
                        <width>640</width>
                        <height>480</height>
                        <format>R8G8B8</format>
                    </image>
                    <clip>
                        <near>0.05</near>
                        <far>10</far>
                    </clip>
                </camera>
                <plugin name="depth_camera_controller" filename="libgazebo_ros_camera.so">
                    <baseline>0.2</baseline>
                    <alwaysOn>true</alwaysOn>
                    <updateRate>0.0</updateRate>
                    <frame_name>camera_frame</frame_name>
                    <pointCloudCutoff>0.2</pointCloudCutoff>
                    <pointCloudCutoffMax>10.0</pointCloudCutoffMax>
                    <distortionK1>0</distortionK1>
                    <distortionK2>0</distortionK2>
                    <distortionK3>0</distortionK3>
                    <distortionT1>0</distortionT1>
                    <distortionT2>0</distortionT2>
                    <CxPrime>0</CxPrime>
                    <Cx>0</Cx>
                    <Cy>0</Cy>
                    <focalLength>0</focalLength>
                    <hackBaseline>0</hackBaseline>
                </plugin>
            </sensor>
        </gazebo>

However, as I read in the Gazebo documentation the actual plugin would be libgazebo_ros_openni_kinect.so. The problem is that this plugin isn't available for Ros2 Foxy, and what's more, the above camera definition actually seems to work as a depth camera. In fact it publishes the following topics:

/camera/camera_info
/camera/depth/camera_info
/camera/depth/image_raw
/camera/depth/image_raw/compressed
/camera/depth/image_raw/compressedDepth
/camera/image_raw
/camera/image_raw/compressed
/camera/image_raw/compressedDepth
/camera/points

The problem is that I don't get how and where those topics are being published. I only found the GazeboRosCamera plugin (http://docs.ros.org/en/diamondback/api/gazebo_plugins/html/classgazebo_1_1GazeboRosCamera.html) where, in addition, there is no PointCloud attributes.

Thank you!

Asked by marpeja on 2022-07-21 14:03:36 UTC

Comments

Answers

You are correct with the usage of libgazebo_ros_camera.so, based from the name I believe libgazebo_ros_openni_kinect.so is the plugin for the Kinect camera (but not a generic depth camera). Within your URDF (or better a XACRO) you are able to define on which topic to publish the camera information. This in done in the plugin context with the <ros> tag, like this:

<plugin name="depth_camera_controller" filename="libgazebo_ros_camera.so">
    <baseline>0.2</baseline>
     ...
     <ros>
        <imageTopicName>[your color image topic]</imageTopicName>
        <cameraInfoTopicName>[your camera info topic]</cameraInfoTopicName>
        <depthImageTopicName>[your depth image topic]</depthImageTopicName>
        <pointCloudTopicName>[your point cloud topic]</pointCloudTopicName>
     </ros>
</plugin>

I suspect if these names are not set, default names are uses for the topics.

Asked by NotARobot on 2022-11-25 10:02:49 UTC

Comments