Skip to content

Add custom point cloud frame ID support to Depth and RGBD camera sensors #582

Open
david-wb wants to merge 1 commit intogazebosim:mainfrom
david-wb:feat/points_frame_id
Open

Add custom point cloud frame ID support to Depth and RGBD camera sensors #582
david-wb wants to merge 1 commit intogazebosim:mainfrom
david-wb:feat/points_frame_id

Conversation

@david-wb
Copy link

@david-wb david-wb commented Jan 15, 2026

🎉 New feature

Closes #488

Summary

The problem
Currently, the depth and rgbd cameras use the content from the <frame_id> tag or the default frameId for both the
the images and the point cloud. However, the images typically need an optical frame id while the point cloud needs a "sensor" frame id.

The Solution
This proposed change enables depth and rbgd camera sensors to include a new <points_frame_id> tag to use for the point cloud messages. This is not a breaking change, because when the tag is not included, behavior is unchanged.

Example:

      <sensor name="camera_with_points_frame_id" type="depth">
        <update_rate>10</update_rate>
        <frame_id>optical_frame</frame_id>
        <points_frame_id>points_frame</points_frame_id>
        <topic>/camera2/image</topic>
        <camera>
          <horizontal_fov>1.0472</horizontal_fov>
          <image>
            <width>1000</width>
            <height>1000</height>
          </image>
          <lens>
            <projection>
              <p_fx>866.23</p_fx>
              <p_fy>866.23</p_fy>
              <p_cx>500</p_cx>
              <p_cy>500</p_cy>
              <tx>300</tx>
              <ty>200</ty>
            </projection>
          </lens>
        </camera>
      </sensor>

Test it

To test manually, launch gazebo sim with a urdf containing a depth camera that uses the new tag. Then verify frame ids on the images and point clouds are correct.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers
  • Was GenAI used to generate this PR? If so, make sure to add "Generated-by" to your commits. (See this policy for more info.)

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by and Generated-by messages.

@david-wb david-wb marked this pull request as ready for review January 15, 2026 09:51
@david-wb david-wb requested a review from iche033 as a code owner January 15, 2026 09:51
@david-wb david-wb force-pushed the feat/points_frame_id branch from a74e34e to 3cec41b Compare January 15, 2026 10:50
@iche033
Copy link
Contributor

iche033 commented Jan 15, 2026

my understanding from going over #488 again is that a separate frame id field is not desired for reasons mentioned in #488 (comment) - mainly that the separate frame is needed by ROS and so that frame should be created in ros_gz. I started the work on this in gazebosim/ros_gz#703 but haven't had the chance to get back to it.

@roncapat
Copy link

Only one frame is needed on ROS side IMHO.

@david-wb
Copy link
Author

david-wb commented Jan 15, 2026

@iche033 ros_gz_bridge is meant to be a translation layer and should not worry about this frame id detail. The optical and sensor frames are not the same, and it should be possible to specify both in the depth and rgbd sensor sdf. So I respectfully disagree with comment #488, but this PR is just a proposed solution. No problem if you choose to do it another way, I just hope the issue is resolved. Thanks for reviewing.

@iche033
Copy link
Contributor

iche033 commented Jan 17, 2026

Ok I don't want to go back and forth between different solutions to the optical frame problem as that caused other complaints before. If you're ok with any solution and just want the problem resolved, I just updated gazebosim/ros_gz#703 - Would you able to give that PR a try?

- Introduced `pointCloudFrameId` member variable to store custom frame ID.
- Updated `Load` method to check for `points_frame_id` in SDF and set the frame ID accordingly.
- Modified point cloud initialization to use the custom frame ID if specified.
- Added integration tests for custom point cloud frame ID functionality.
- Created SDF files for testing with and without custom frame IDs.

Signed-off-by: David Brown <davewbrwn@gmail.com>
@david-wb david-wb force-pushed the feat/points_frame_id branch from 3cec41b to 0e90f16 Compare January 21, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

3 participants