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

Allow rendering to be forced externally #1475

Merged
merged 3 commits into from
Jun 15, 2022

Conversation

hidmic
Copy link
Contributor

@hidmic hidmic commented May 4, 2022

🎉 New feature

Summary

ignition::gazebo::systems::Sensors will only update its rendering sensors when there's a need for it. While perfectly reasonable, this also means that any custom rendering sensor relying on pre/post render hooks to do its work must wait for a builtin sensor that is known to this system to require an update.

This patch works around this by introducing a ForceRender event that other systems can emit to force a rendering pass.

Test it

...

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)

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

@github-actions github-actions bot added the 🌱 garden Ignition Garden label May 4, 2022
@hidmic
Copy link
Contributor Author

hidmic commented May 4, 2022

Early push, to get feedback. I'll go implement a custom rendering sensor on top of this now.

@codecov
Copy link

codecov bot commented May 4, 2022

Codecov Report

Merging #1475 (fa8f465) into main (e399431) will not change coverage.
The diff coverage is n/a.

❗ Current head fa8f465 differs from pull request most recent head 9113a0d. Consider uploading reports for the commit 9113a0d to get more accurate results

@@           Coverage Diff           @@
##             main    #1475   +/-   ##
=======================================
  Coverage   35.01%   35.01%           
=======================================
  Files          44       44           
  Lines        2356     2356           
=======================================
  Hits          825      825           
  Misses       1531     1531           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9370793...9113a0d. Read the comment docs.

@chapulina chapulina added rendering Involves Ignition Rendering MBARI-LRAUV Sponsored by MBARI-LRAUV project: https:/osrf/lrauv labels May 5, 2022
@@ -65,6 +65,16 @@ namespace ignition
/// \endcode
using PostRender = ignition::common::EventT<void(void),
struct PostRenderTag>;

/// \brief The force render event may be emitted outside the
/// rendering thread to force rendering calls.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approach looks reasonable to me.

I'd just improve the documentation a bit to explain that "forcing" rendering means that when the time comes, a plugin that performs rendering will do so even if it wasn't planning to.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 010b191, and rebased to deal with the ignition -> gz migration.

@codecov
Copy link

codecov bot commented May 31, 2022

Codecov Report

Merging #1475 (46c47f9) into main (0184de3) will increase coverage by 0.00%.
The diff coverage is 75.00%.

@@           Coverage Diff           @@
##             main    #1475   +/-   ##
=======================================
  Coverage   63.62%   63.62%           
=======================================
  Files         330      330           
  Lines       25837    25846    +9     
=======================================
+ Hits        16438    16444    +6     
- Misses       9399     9402    +3     
Impacted Files Coverage Δ
src/systems/sensors/Sensors.cc 65.75% <75.00%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0184de3...46c47f9. Read the comment docs.

Includes an event during rendering for downstream use.

Signed-off-by: Michel Hidalgo <[email protected]>
@hidmic hidmic force-pushed the hidmic/force-render-event branch from 010b191 to 69294dd Compare June 9, 2022 15:18
@hidmic hidmic marked this pull request as ready for review June 9, 2022 15:25
@hidmic hidmic requested a review from chapulina June 9, 2022 15:25
@hidmic
Copy link
Contributor Author

hidmic commented Jun 9, 2022

@chapulina @iche033 A couple notes about tests and examples for this patch (which we're lacking). You can see in osrf/lrauv#213 that putting together a plugin to make meaningful use of these new events is very tricky. So I think we have two choices: (a) we defer examples here and ticket a migration of osrf/lrauv#213 into gz-sensors or (b) we try to put together a dummy custom rendering sensor to motivate these changes. I'm biased towards (a), as I know (b) is going to be a rather long detour, full of booby traps, and time is short.

@iche033
Copy link
Contributor

iche033 commented Jun 10, 2022

The changes look fine. One note about going with this approach is that there is no guarantee that the custom rendering sensor's updates are lockstepped with physics. Something to keep in mind in case you are seeing that your sensor is not hitting the target update rate.

Copy link
Contributor

@caguero caguero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks reasonable to me.

@hidmic
Copy link
Contributor Author

hidmic commented Jun 13, 2022

@caguero we have 3 checks not passing that either fail to build some sources or fail some tests. In both cases, issues are in other source files. How do we go about it?

@arjo129 arjo129 mentioned this pull request Jun 15, 2022
15 tasks
@hidmic
Copy link
Contributor Author

hidmic commented Jun 15, 2022

Alright, according to @caguero, failing checks are already happening on master.

Moving forward!

@hidmic hidmic merged commit 1c90252 into gazebosim:main Jun 15, 2022
@hidmic hidmic deleted the hidmic/force-render-event branch June 15, 2022 15:09
@hidmic hidmic mentioned this pull request Jun 15, 2022
8 tasks
@j-rivero j-rivero mentioned this pull request Sep 16, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 garden Ignition Garden MBARI-LRAUV Sponsored by MBARI-LRAUV project: https:/osrf/lrauv rendering Involves Ignition Rendering
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants