Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

Distortion initialization fix with background color #3060

Merged

Conversation

WilliamLewww
Copy link
Contributor

Closes #2527 - Last camera's distortion affects previous cameras' distortions

When setting the background color to a scene, the distortion parameters continue to leak. From #3033 we can infer that setting the scene's background color is effecting the distortion compositor which is causing the improper order for compositor initialization.

To fix the issue, we reinitialize the distortion after setting the scene's color to ensure the distortion compositor is properly set for each camera.

scpeters and others added 14 commits May 14, 2021 15:45
There is a bug in the initialization of cameras with distortion.
Loading multiple cameras with different distortion parameters
at the same time causes some of the same distortion parameters
to be applied to all those cameras. Spawning a model with a single
distorted camera afterwards works fine, even in a world that
already contains distorted cameras.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
…n cameras

Signed-off-by: William Lew <WilliamMilesLew@gmail.com>
Signed-off-by: William Lew <WilliamMilesLew@gmail.com>
Signed-off-by: William Lew <WilliamMilesLew@gmail.com>
Signed-off-by: William Lew <WilliamMilesLew@gmail.com>
Signed-off-by: William Lew <WilliamMilesLew@gmail.com>
Signed-off-by: William Lew <WilliamMilesLew@gmail.com>
Signed-off-by: William Lew <WilliamMilesLew@gmail.com>
…heckDistortion test

Signed-off-by: William Lew <WilliamMilesLew@gmail.com>
Signed-off-by: William Lew <WilliamMilesLew@gmail.com>
Signed-off-by: William Lew <WilliamMilesLew@gmail.com>
Signed-off-by: William Lew <WilliamMilesLew@gmail.com>
@scpeters
Copy link
Member

this has merge conflicts that need to be resolved

@scpeters scpeters self-requested a review August 11, 2021 21:11
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
@scpeters
Copy link
Member

I tightened some test expectations in 0fe817c

@scpeters
Copy link
Member

for some reason, there is a regressions in CameraSensor.CheckNewAndLegacyDistortionModes:

I added a getchar() statement to the end of the test so I could open a gzclient instance and view the images generated in the test. It appears that with this pull request, the distortion of the pincushion_legacy camera images has changed (all other images appeared unchanged).

Since the pincushion_legacy camera is the first one spawned in the test, I tried changing the order in which they are spawned, and I noticed that the distortion of the first spawned camera seems to be different than if it was spawned later. I'm still debugging this, but I think it's something we need to fix

Spawn the first distorted camera twice and expect
both instances to produce the same images. This
illustrates a bug observed in which the first distorted
camera has too much distortion.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
@scpeters
Copy link
Member

for some reason, there is a regressions in CameraSensor.CheckNewAndLegacyDistortionModes:

I added a getchar() statement to the end of the test so I could open a gzclient instance and view the images generated in the test. It appears that with this pull request, the distortion of the pincushion_legacy camera images has changed (all other images appeared unchanged).

Since the pincushion_legacy camera is the first one spawned in the test, I tried changing the order in which they are spawned, and I noticed that the distortion of the first spawned camera seems to be different than if it was spawned later. I'm still debugging this, but I think it's something we need to fix

I've added a test to detect the problems with the first distorted images in edd5d43

Signed-off-by: William Lew <WilliamMilesLew@gmail.com>
@WilliamLewww
Copy link
Contributor Author

The tests are working now! Turns out that the distortion effect was magnified because refreshing the compositor just adds another compositor on top of the existing one. To fix the issue, I remove the compositor right before adding the new one.

@scpeters
Copy link
Member

The tests are working now! Turns out that the distortion effect was magnified because refreshing the compositor just adds another compositor on top of the existing one. To fix the issue, I remove the compositor right before adding the new one.

great work!

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
@scpeters
Copy link
Member

I noticed you relaxed some test tolerances in ff32b82 by necessity; I've tightened them back a bit in 4d284d7

I also squeezed in some fixes for clang warnings in c6d3bb9 and e47c87e and merged with gazebo11 to fix the ABI checker build

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

Successfully merging this pull request may close these issues.

Last camera's distortion affects previous cameras' distortions
2 participants