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

Depth camera intrinsics do not update #367

Open
Veng97 opened this issue Mar 6, 2023 · 3 comments
Open

Depth camera intrinsics do not update #367

Veng97 opened this issue Mar 6, 2023 · 3 comments

Comments

@Veng97
Copy link

Veng97 commented Mar 6, 2023

I'm using the depth camera plugin and describe my camera with the following SDF:

   <gazebo reference="${name}_left_camera_frame">
      <sensor name="depth_camera" type="depth_camera">
        <topic>${name}/depth/image_rect</topic>
        <ignition_frame_id>${name}_left_camera_optical_frame</ignition_frame_id>
        <update_rate>${camera_update_rate}</update_rate>
        <visualize>true</visualize>
        <always_on>1</always_on>
        <camera name="${name}_left_camera_depth">
          <!-- <horizontal_fov>${horizontal_fov_deg*pi/180.0}</horizontal_fov> -->
          <!-- <vertical_fov>${vertical_fov_deg*pi/180.0}</vertical_fov> -->
          <image>
            <!-- <width>${image_width}</width> -->
            <!-- <height>${image_height}</height> -->
            <format>R_FLOAT32</format>
          </image>
          <clip>
            <near>${minimum_depth_m}</near>
            <far>${maximum_depth_m}</far>
          </clip>
          <noise>
		<type>gaussian</type>
		<mean>0</mean>
		<stddev>0.01</stddev>
		</noise>
        </camera>
      </sensor>
    </gazebo>

I noticed that the camera info topic doesn't update when i override the default image width and height properties - that means that the camera intrinsics are incorrect when i specify non-default width and height parameters.
Note that i set the image frame by using the <ignition_frame_id> property.

@osrf-triage osrf-triage added this to Inbox in Core development Mar 6, 2023
@azeey
Copy link
Contributor

azeey commented Mar 7, 2023

Hi @Veng97 , this looks like a bug request. Would you mind providing information requested in the Bug Report template?

@iche033
Copy link
Contributor

iche033 commented Mar 7, 2023

There's been some work done on this recently: gazebosim/gz-sensors#308. Maybe worth checking if you have the latest gz-sensors / ignition-sensors version

@azeey azeey moved this from Inbox to In progress in Core development Mar 7, 2023
@agonzat
Copy link

agonzat commented May 31, 2023

I can confirm that this bug is still present using the latest binary packages for ROS Humble on Ubuntu 22.04.

I tried to build a minimal example based on ros2 launch ros_ign_gazebo_demos camera.launch.py but these demos seem to be currently broken.

In our case, the intended sensor configuration was the following, which will produce CameraInfo messages that don't match the sensor parameters:

<sensor name="cameradepth" type="depth_camera">
  <topic>/cameradepth/depth_image</topic>
  <ignition_frame_id>camera_depth_optical_frame</ignition_frame_id>
  <camera name="camera">
    <horizontal_fov>1.57</horizontal_fov>
    <image>
      <width>1280</width>
      <height>720</height>
    </image>
    <clip>
      <near>0.1</near>
      <far>100</far>
    </clip>
    <noise>
      <type>gaussian</type>
      <mean>0.0</mean>
      <stddev>0.100</stddev>
    </noise>
  </camera>
  <always_on>1</always_on>
  <update_rate>30</update_rate>
  <visualize>0</visualize>
</sensor>

I obtain the following CameraInfo regardless of the configuration (width, height or horizontal_fov):

header:
  stamp:
    sec: 11
    nanosec: 220000000
  frame_id: L_camera_depth_optical_frame
height: 240
width: 320
distortion_model: plumb_bob
d:
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
k:
- 277.0
- 0.0
- 160.0
- 0.0
- 277.0
- 120.0
- 0.0
- 0.0
- 1.0
r:
- 1.0
- 0.0
- 0.0
- 0.0
- 1.0
- 0.0
- 0.0
- 0.0
- 1.0
p:
- 277.0
- 0.0
- 160.0
- -0.0
- 0.0
- 277.0
- 120.0
- 0.0
- 0.0
- 0.0
- 1.0
- 0.0
binning_x: 0
binning_y: 0
roi:
  x_offset: 0
  y_offset: 0
  height: 0
  width: 0
  do_rectify: false

While removing the following lines makes the obtained CameraInfo messages match the Image:

<horizontal_fov>1.57</horizontal_fov>
<image>
    <width>1280</width>
    <height>720</height>
</image>

I experience the same issues on RGB cameras.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In progress
Core development
In progress
Development

No branches or pull requests

4 participants