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

syncronize camera_info with images #38

Open
wants to merge 17 commits into
base: noetic-devel
Choose a base branch
from

Conversation

LeroyR
Copy link
Contributor

@LeroyR LeroyR commented Nov 15, 2024

Description

camera_info needs to have the same timestamp as the images. (e.g. for usage with message_filters.TimeSynchronizer)

  • give each image from cameras its own CameraInfo
  • add configuration for camera topics

This changes cameras to publish a syncronized camera_info for each image. e.g for rgb image:
/mujoco_server/cameras/camera_name/rgb/camera_info
/mujoco_server/cameras/camera_name/rgb/image_raw

Additional configuration options to change topics:
camera_name/topic: defaults to "/mujoco_server/cameras/camera_name"
camera_name/name_rgb: default to "rbg"
camera_name/name_depth: default to "depth"
camera_name/name_segment: default to "segmented"

Checklist

  • Required by CI: Code is auto formatted using clang-format.
  • Add a brief explanation of your changes to the changelog.

@LeroyR LeroyR requested a review from DavidPL1 as a code owner November 15, 2024 16:36
mujoco_ros/src/offscreen_camera.cpp Outdated Show resolved Hide resolved
mujoco_ros/src/offscreen_camera.cpp Outdated Show resolved Hide resolved
mujoco_ros/src/offscreen_camera.cpp Show resolved Hide resolved
@DavidPL1
Copy link
Contributor

I think this PR should be extended to allow different resolutions per stream type (probably RGB and SEGMENT should use the same) , justifying the need of individual camera infos. To better replicate real setups.
Following rep-0104 we then can keep the model of only publishing camera info when an image was rendered, but change the rendering condition to a subscription of either the Image or the info topic.
I suppose the information on how to align RGB and Depth needs to be specified, too, in case resolutions differ.

@rhaschke
Copy link
Member

camera_info needs to have the same timestamp as the images

Are you sure. Usually, camera_info topics are latched and simply provide a fixed message. Therefore, the timestamp shouldn't be relevant.

@LeroyR
Copy link
Contributor Author

LeroyR commented Nov 18, 2024

camera_info needs to have the same timestamp as the images

Are you sure. Usually, camera_info topics are latched and simply provide a fixed message. Therefore, the timestamp shouldn't be relevant.

Atleast our cameras do that. By rep-0104 camera_info is send with every image:

Publish CameraInfo Only When Parameters Change
One FAQ is, "Why send CameraInfo with every Image message? Why not only once?" The main answer is that operational parameters (binning, ROI) may change, perhaps rapidly, from image to image.

@LeroyR LeroyR force-pushed the syncronized_camera_info branch from 442d16f to ad25935 Compare November 18, 2024 12:35
@LeroyR
Copy link
Contributor Author

LeroyR commented Nov 18, 2024

I changed the offscreen_camera to have a CameraInfo publisher for each of the images.

The topics are now configurable such that:

/mujoco_server/cameras/camera_name/rgb/image_raw
/mujoco_server/cameras/camera_name/rgb/camera_info

is used as default - which should match real camera setups.

@DavidPL1 DavidPL1 force-pushed the syncronized_camera_info branch from ad25935 to 36b6f99 Compare November 20, 2024 08:44
previously, in case a render request is still active, freeing the context
would case a segfault. Instead now the render mutex is locked, the
pending request is canceled and the context freed.
Default build tries the following:
If GLFW is found, it will be used for GUI and offscreen rendering.
Otherwise GUI functionality is not provided. As fallback for offscreen
rendering first GLE is searched, otherwise osmesa. In case neither can
be found, offscreen rendering is disabled, too.
* fixes edge case where model was missing fields because of a missing
forward computation which caused issues when applying the model to the
offscreen scene.
* fixes possible deadlock during shutdown when waiting to join the render
loop.
@DavidPL1 DavidPL1 force-pushed the syncronized_camera_info branch from 36b6f99 to 543b8d5 Compare November 28, 2024 15:43
@DavidPL1 DavidPL1 requested a review from rhaschke as a code owner November 28, 2024 15:43
Copy link

codecov bot commented Nov 28, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 20 lines in your changes missing coverage. Please review.

Project coverage is 58.82%. Comparing base (f640ba0) to head (b8ce3da).
Report is 1 commits behind head on noetic-devel.

Files with missing lines Patch % Lines
mujoco_ros/src/mujoco_env.cpp 62.50% 12 Missing ⚠️
mujoco_ros/src/main.cpp 0.00% 7 Missing ⚠️
mujoco_ros/include/mujoco_ros/mujoco_env.h 0.00% 1 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##           noetic-devel      #38      +/-   ##
================================================
- Coverage         59.31%   58.82%   -0.48%     
================================================
  Files                19       19              
  Lines              2860     2972     +112     
  Branches            334      323      -11     
================================================
+ Hits               1696     1748      +52     
- Misses             1164     1224      +60     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

- give each image from cameras its own topic
- add configuration for camera topics

This changes cameras to publish a syncronized camera_info for
each image. e.g for rgb image:
/mujoco_server/cameras/camera_name/rgb/camera_info
/mujoco_server/cameras/camera_name/rgb/image_raw

Additional configuration options to change topics:
  camera_name/topic: defaults to "/mujoco_server/cameras/camera_name"
  camera_name/name_rgb: default to "rbg"
  camera_name/name_depth: default to "depth"
  camera_name/name_segment: default to "segmented"
@DavidPL1 DavidPL1 force-pushed the syncronized_camera_info branch from 543b8d5 to 6f01c4e Compare November 28, 2024 15:51
@DavidPL1 DavidPL1 force-pushed the syncronized_camera_info branch from 73410d3 to b8ce3da Compare December 3, 2024 09:44
@DavidPL1
Copy link
Contributor

DavidPL1 commented Dec 3, 2024

FYI: this is already merged into wip-headless-rendering. And will be available in noetic-devel once we merge the feature branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants