Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue visualizing Depth image in rviz2 #473

Open
EnzoGhisoni opened this issue Sep 27, 2024 · 3 comments
Open

Issue visualizing Depth image in rviz2 #473

EnzoGhisoni opened this issue Sep 27, 2024 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@EnzoGhisoni
Copy link

EnzoGhisoni commented Sep 27, 2024

Environment

  • OS Version: Ubuntu 22.04
  • Binary build
  • Version: Fortress version 6.16.0 and ROS2 Humble

Description

  • Expected behavior:
    I try to add the depth sensors in the sdf of my robot in order to have the depth image available in ROS2.
  • Actual behavior:
    I have the good output for the depth image in Gazebo Image display viewer:
    Screenshot from 2024-09-27 10-04-00

But when I visualize it in rviz2 the image is fully black or is in reverse color pattern in function of the settings:
Screenshot from 2024-09-27 10-20-57

Screenshot from 2024-09-27 10-19-18

Steps to reproduce

I have implement the sensor in this way in my model.sdf:
`

    <sensor name="camera_center" type="depth_camera">
      <gz_frame_id>camera_base_link</gz_frame_id>
      <always_on>1</always_on>
      <update_rate>30</update_rate>
      <visualize>0</visualize>
      <topic>/model/diff_drive/depth_camera</topic>
      <pose>0 0 0 0 -0 0</pose>
      <camera name="camera">
        <horizontal_fov>1</horizontal_fov>
        <image>
          <width>640</width>
          <height>360</height>
          <format>RGB_INT8</format>
        </image>
        <clip>
          <near>0.3</near>
          <far>50.0</far>
        </clip>
      </camera>
  </sensor>

I have this for the bridge:

  • ros_topic_name: "/depth"
    gz_topic_name: "/model/diff_drive/depth_camera"
    ros_type_name: "sensor_msgs/msg/Image"
    gz_type_name: "gz.msgs.Image"
    direction: GZ_TO_ROS
    `

I'm not sure if the difference come from the encoding, the bridge or simply the rviz2 configuration (if it is it could be interesting to know the default settings to visualize the data).

@EnzoGhisoni EnzoGhisoni added the bug Something isn't working label Sep 27, 2024
@iche033
Copy link
Contributor

iche033 commented Oct 9, 2024

I think it's just that the "visualization" is different but the depth image data encoding and depth values should be the same. The image consists of float32 depth values. In gazebo, from this description, large depth values are darker (black) while smaller depth values are brighter (white), which just happens to be opposite of how rviz visualizes depth data.

@azeey
Copy link
Contributor

azeey commented Nov 5, 2024

There doesn't seem to be a standard on how to display depth images. A quick look on the web shows both approaches being used in different places. Since the behavior in Gazebo has been around for a long time, I don't think we should change it. Perhaps a flag in the "Image Display" plugin to revert the colors could be an option.

@azeey azeey added enhancement New feature or request and removed bug Something isn't working labels Dec 16, 2024
@azeey
Copy link
Contributor

azeey commented Dec 16, 2024

@EnzoGhisoni I'm going to assign the "help wanted" label to this. If you're able to submit a PR with the suggested changes in #473 (comment), we would greatly appreciate it.

@azeey azeey added good first issue Good for newcomers help wanted Extra attention is needed labels Dec 16, 2024
@azeey azeey removed this from Core development Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants