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

Limit scene broadcast publications when paused #497

Merged
merged 12 commits into from
Feb 26, 2021

Conversation

nkoenig
Copy link
Contributor

@nkoenig nkoenig commented Dec 17, 2020

I don't think the scenebroadcaster needs to send frequent messages when paused.

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

@nkoenig nkoenig requested a review from chapulina as a code owner December 17, 2020 22:22
@github-actions github-actions bot added the 🏰 citadel Ignition Citadel label Dec 17, 2020
@chapulina
Copy link
Contributor

I haven't tried this yet, but have you checked that manipulating models in the GUI while paused still works?

@codecov
Copy link

codecov bot commented Dec 17, 2020

Codecov Report

Merging #497 (9506604) into ign-gazebo3 (4a4951e) will increase coverage by 0.04%.
The diff coverage is 82.14%.

Impacted file tree graph

@@               Coverage Diff               @@
##           ign-gazebo3     #497      +/-   ##
===============================================
+ Coverage        77.74%   77.78%   +0.04%     
===============================================
  Files              210      209       -1     
  Lines            11628    11641      +13     
===============================================
+ Hits              9040     9055      +15     
+ Misses            2588     2586       -2     
Impacted Files Coverage Δ
src/systems/scene_broadcaster/SceneBroadcaster.hh 100.00% <ø> (ø)
src/gui/GuiRunner.cc 72.13% <72.22%> (+12.13%) ⬆️
src/systems/physics/Physics.cc 71.37% <100.00%> (-0.07%) ⬇️
src/systems/scene_broadcaster/SceneBroadcaster.cc 97.86% <100.00%> (ø)
src/SimulationRunner.cc 93.40% <0.00%> (-1.13%) ⬇️
src/systems/user_commands/UserCommands.cc 80.63% <0.00%> (+2.76%) ⬆️

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 4a4951e...9506604. Read the comment docs.

@iche033
Copy link
Contributor

iche033 commented Dec 18, 2020

I was able to move the models through the GUI when paused. On the other hand, setting the model pose through ign service did not move the model since the scene broadcaster is not publishing the new state to the gui. The model moves only after sim is unpaused.

@nkoenig
Copy link
Contributor Author

nkoenig commented Dec 22, 2020

The Physics system removes the pose change component during Update. The SceneBroadcaster's PostUpdate then misses the OneTimeChange state.

I've add a PreUpdate function to the SceneBroadcaster that captures the change event in: 79c6a43. Moving an entity from the CLI should now trigger a broadcast event.

@chapulina
Copy link
Contributor

I've add a PreUpdate function to the SceneBroadcaster that captures the change event

It looks like that broke some things. The problem of checking for changes on pre-update is that systems are adding their changes during that call, and we can't guarantee the order in which systems run. Try for example moving the SceneBroadcaster above the Physics and UserCommands systems on the SDF, and you'll see how the GUI is not working properly anymore, even the component inspector fails to show any data sometimes.

Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

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

the component inspector fails to show any data sometimes.

This is related to the original change, not the pre-update one.

The GUI runner doesn't run its own loop, it just reacts to changes from the server. So all systems' Update functions are only called when there's a new state coming from the server. If we don't publish while paused, systems that rely on periodic Updates don't work properly. For example, selecting a new entity won't update the ComponentInspector completely until the next Update call.

I think this could be solved by changing the way GUI systems' update calls are triggered. Maybe we can add a loop to the GuiRunner so that it calls updates periodically even if there aren't new state messages from the server. Unfortunately, the GuiRunner isn't PIMPLized, so it will be tricky to change a lot in Citadel. Maybe we can target a change like that to Edifice.

@nkoenig
Copy link
Contributor Author

nkoenig commented Dec 23, 2020

Before I go any further with this PR, I want to make sure the general direction is aligned with our goals. @chapulina , I not opposed to declining this if you think there is a different or better way to improve performance while paused.

@chapulina
Copy link
Contributor

Not publishing periodic changes while paused seems reasonable to me. We just need to adjust the GUI's expectations to match that. There may also be other downstream consumers of the state message who would be affected. I worry about such a big change in a released version, so I would suggest we target this at Edifice.

…uiRunner that will periodically update the GUI plugins

Signed-off-by: Nate Koenig <[email protected]>
@nkoenig
Copy link
Contributor Author

nkoenig commented Dec 23, 2020

Not publishing periodic changes while paused seems reasonable to me. We just need to adjust the GUI's expectations to match that. There may also be other downstream consumers of the state message who would be affected. I worry about such a big change in a released version, so I would suggest we target this at Edifice.

I think I've addressed the problems in 17bb8f1

@nkoenig nkoenig requested a review from chapulina January 4, 2021 17:19
@chapulina chapulina added the performance Runtime performance label Jan 5, 2021
@nkoenig nkoenig requested a review from chapulina February 8, 2021 19:50
// \todo(anyone) Pimplize GuiRunner and move these global variables to the
// private class.
gRunning = true;
gUpdateThread = std::thread([&]()
Copy link
Contributor

Choose a reason for hiding this comment

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

This will increase the number of updates while unpaused. I don't think it may cause immediate issues though, just something to keep an eye on.

@nkoenig nkoenig requested a review from azeey as a code owner February 26, 2021 00:46
Signed-off-by: Louise Poubel <[email protected]>
@chapulina chapulina enabled auto-merge (squash) February 26, 2021 01:41
@chapulina chapulina merged commit 65a18cb into ign-gazebo3 Feb 26, 2021
@chapulina chapulina deleted the scene_broadcaster_paused branch February 26, 2021 01:59
@chapulina chapulina mentioned this pull request Mar 9, 2021
7 tasks
@jennuine jennuine mentioned this pull request Jul 30, 2021
7 tasks
@chapulina chapulina mentioned this pull request Dec 3, 2021
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏰 citadel Ignition Citadel performance Runtime performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants