GZ SIM: multiple x500 depth cameras bridged to ROS2

Hi!

I recently found the gz model for x500 with a depth camera, and would like to transfer the images from gz to ROS2. For this, I found that the image_bridge from ros_gz_image is suitable (GitHub - gazebosim/ros_gz: Integration between ROS (1 and 2) and Gazebo simulation). I have no problem using this package after installing the correct version (apt install ros-humble-ros-gzgarden) for one instance. My issue is that I want to use several instances of x500_depth - it seems like all of them publishes camera data on the same topics in gz, namely /camera and /depth_camera. Does anyone know if it is possible to change this in order to incorporate the model name as a namespace parameter in the topics? (/x500_depth_0/camera, /x500_depth_1/camera)

Regards,
Kristoffer

Hi @Kristoffer_Bergman , the depth_camera sensor used in x500_depth does not implements subtopics (which would allow to nest the topic under the model namespace). You can set the topic name, see the sdf file of the camera: https://app.gazebosim.org/RudisLaboratories/fuel/models/OakD-Lite :

<sensor name="StereoOV7251" type="depth_camera">
        <pose>0.01233 -0.03 .01878 0 0 0</pose>
        <camera>
          <horizontal_fov>1.274</horizontal_fov>
          <image>
            <width>640</width>
            <height>480</height>
            <format>R_FLOAT32</format>
          </image>
          <clip>
            <near>0.2</near>
            <far>19.1</far>
          </clip>
        </camera>
        <always_on>1</always_on>
        <update_rate>30</update_rate>
        <visualize>true</visualize>
        <topic>depth_camera</topic>
      </sensor>

but as you say, depth_camera is hardcoded.

Thanks @Benja for your quick reply!

Do you know if sensors in gz support subtopics? If not, do you have any other idea of how to change the sdf file in order to support several camera sensors that does not publish on the same topic?

I checked and my understanding is that that sensor does not support subtopics, you would need to implement that feature.

The workaround would be to dynamically edit the sdf file before using it, and change the topic element. But, the camera model is fetched from fuel, therefore you first need to fetch the camera model from fuel and implement it in x500_depth