-
Notifications
You must be signed in to change notification settings - Fork 276
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
Publish all periodic change components in Scene Broadcaster #544
Conversation
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Codecov Report
@@ Coverage Diff @@
## ign-gazebo3 #544 +/- ##
===============================================
+ Coverage 77.70% 77.72% +0.01%
===============================================
Files 208 208
Lines 11574 11580 +6
===============================================
+ Hits 8994 9000 +6
Misses 2580 2580
Continue to review full report at Codecov.
|
Something went wrong with the [ RUN ] EntityComponentManagerPerfrormance.Each
/github/workspace/test/performance/each.cc:128: Failure
Expected: (cacheEntityAvg) < (cachelessEntityAvg), actual: 6346.98 vs 4991.98
Matching Entity Count = 1
Nonmatching Entity Count = 1
Each Iterations = 100
Cache total = 634698 ns
Cache avg per iter = 6346.9799999999996 ns
Cache avg per iter*entity = 6346.9799999999996 ns
Cacheless total = 499198 ns
Cacheless avg per iter= 4991.9799999999996 ns
Cacheless avg per iter*entity= 4991.9799999999996 ns
[ FAILED ] EntityComponentManagerPerfrormance.Each (41120 ms) |
hmm I've seen that test fail before but I don't know if it's due to the same issue. We can try rerunning to see if it's a flaky test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea looks good to me, I think it's always good to make the logic not specific to some component type.
My only concern is the granularity. If just one component of a given type was periodically changed, all other components of that type will also be sent. I can't think of a situation like that right now, so I think this can be addressed if / when the need arises.
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Done!
I agree with the granularity concern. From what I understand the
From what I can see the Anyway all of this would be work for a performance improvement followup PR. I'll try to benchmark the possible performance gain before looking too much into it. My last question for this PR is whether you think I should add an integration test in scene_broadcaster for this feature, something like "create a system that flags a component as periodic change, wait for the publishing, make sure the component is there". It might need a bit of work to implement but it sounds like it might be good to have as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should add an integration test
That would be great, but I wouldn't block on it if it turns out to be too convoluted.
I'd ask however that we at least add some unit tests for ComponentTypesWithPeriodicChanges
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Added the unit tests 931d58a. I just added them to the SetChanged unit test since it had the setup logic I needed for component creation / deletion. |
Just want to check my understanding of the current behavior. If 2 entities (e.g. e1, and e2) both have a Update ok I just verified that it's indeed the current behavior by expanding the
|
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
True, there is a check to skip publishing the component if another entity flagged it, I got confused with the behavior of OneTimeChange that forces serialization of the whole state. |
As reported in #529, the only way users have to have components published regularly is to specify them as
OneTimeChanged
, but this incurs in the large overhead of re-serializing and publishing the whole simulation state.When looking at the code I noticed that a component being marked as
PeriodicChange
didn't seem to have any effect on the SceneBroadcaster since it only publishedPose
components at regular intervals.Also, I ran a quick
grep
in the code:I noticed that the vast majority of PeriodicChange components are indeed
Pose
components in Physics (unless users create Linear / Angular Velocity / Acceleration components), with a few exceptions in MulticopterVelocityControl (Actuator component) and WheelSlip (SlipComplianceCmd component).With this in mind, I decided to just change the periodic publishing of SceneBroadcaster from only
Pose
components to all the components that have been marked as PeriodicChange.From a performance point of view, this should have no impact in a default simulation, since entities by default only have a
Pose
component. The overhead will appear when the user marks any component asPeriodicChange
, loads aMulticopterVelocityControl
orWheelSlip
system or creates aLinearVelocity
,AngularVelocity
,LinearAcceleration
,AngularAcceleration
or theirWorld
variant components, since any of those will also be added at the 60Hz SceneBroadcaster publisher.