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

Support setting the background color for sensors #1147

Merged
merged 3 commits into from
Oct 29, 2021

Conversation

nkoenig
Copy link
Contributor

@nkoenig nkoenig commented Oct 27, 2021

Signed-off-by: Nate Koenig [email protected]

🎉 New feature

The RenderUtil::SetBackgroundColor and RenderUtil::SetAmbientLight were not useful since the values would always be overwritten by the value in the SDF <scene> element, which is guaranteed to be present. The made it impossible for a system plugin to change/override the background color and ambient light used by sensors.

Here is a concrete use-case:

I have a world that was used to generate a log file. I want to replay the log file, and record a video use a camera sensor along with a different background color such as white instead of black.

This change will continue to use the values in the SDF element, unless someone specifies values in the sensor system plugin.

Test it

A test has been added. Feel free to try it.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • 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

Note to maintainers: Remember to use Squash-Merge

Nate Koenig added 2 commits October 26, 2021 17:49
@github-actions github-actions bot added the 🏰 citadel Ignition Citadel label Oct 27, 2021
@codecov
Copy link

codecov bot commented Oct 27, 2021

Codecov Report

Merging #1147 (280383d) into ign-gazebo3 (63decda) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##           ign-gazebo3    #1147   +/-   ##
============================================
  Coverage        77.45%   77.45%           
============================================
  Files              222      222           
  Lines            12758    12758           
============================================
  Hits              9882     9882           
  Misses            2876     2876           

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 63decda...280383d. Read the comment docs.

Copy link
Contributor

@iche033 iche033 left a comment

Choose a reason for hiding this comment

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

this works for me as advertised.

So now we have 3 ways of changing background color:

  • Scene3D's <background_color>: affects GUI
  • <scene><background>: affects sensors
  • sensors system's <background_color>: affects sensors and overrides <scene><background>

For your use case, is it not an option to just change the <scene><background> color?

@nkoenig
Copy link
Contributor Author

nkoenig commented Oct 27, 2021

this works for me as advertised.

So now we have 3 ways of changing background color:

  • Scene3D's <background_color>: affects GUI
  • <scene><background>: affects sensors
  • sensors system's <background_color>: affects sensors and overrides <scene><background>

For your use case, is it not an option to just change the <scene><background> color?

I can't change the SDF's <scene><background> because it's contained in the log file that I'm re-playing.

@nkoenig nkoenig requested a review from iche033 October 28, 2021 17:36
@nkoenig nkoenig merged commit 6322451 into ign-gazebo3 Oct 29, 2021
@nkoenig nkoenig deleted the sensors_background_color branch October 29, 2021 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏰 citadel Ignition Citadel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants