-
Notifications
You must be signed in to change notification settings - Fork 269
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
Specify System::PreUpdate, Update execution order #2487
Conversation
Specifying an integer value in a <gz:system_priority> tag for a system will control the order in which System PreUpdate and Update callbacks are executed, with lower values executing first. The PriorityPrinter example plugin is added to illustrate the feature. Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
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.
tested running example world and works as intended. Just a few minor comments.
[Msg] Update: Iteration 5, system priority 10, system label second | ||
[Msg] Update: Iteration 5, system priority 100, system label first | ||
[Msg] Update: Iteration 5, system priority 100, system label seventh | ||
``` |
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.
describe how priority numbers work, i.e. the lower the number the higher the priority? and also unset
means default priority of 0?
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.
ok, I'll add this
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 improved the description in d4b161b
Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
Specifying an integer value in a <gz:system_priority> tag for a system will control the order in which System PreUpdate and Update callbacks are executed, with lower values executing first. The PriorityPrinter example plugin is added to illustrate the feature. Signed-off-by: Steve Peters <[email protected]>
Specifying an integer value in a <gz:system_priority> tag for a system will control the order in which System PreUpdate and Update callbacks are executed, with lower values executing first. The PriorityPrinter example plugin is added to illustrate the feature. Signed-off-by: Steve Peters <[email protected]>
Specifying an integer value in a <gz:system_priority> tag for a system will control the order in which System PreUpdate and Update callbacks are executed, with lower values executing first. The PriorityPrinter example plugin is added to illustrate the feature. Signed-off-by: Steve Peters <[email protected]>
🎉 New feature
Part of #2268 and #2391, second attempt at #2394
Summary
While the
PreUpdate
,Update
, andPostUpdate
phases of gz-sim systems allow some control over the order in which code is executed, there are cases in which more control is desired. For example, as noted in #2268 and #2391, sensor systems currently update their data duringPostUpdate
(after theUpdate
step of the physics system) but can't write their data to the ECM sincePostUpdate
has read-only access to the ECM. Moving sensor updates toUpdate
would allow writing to the ECM, but would require ensuring that the sensor systems execute theirUpdate
step after the physicsUpdate
. Alternatively, if one wanted to implement a hierarchical cascade of systems acting on data sequentially, rather than addingPrePreUpdate
andPrePrePreUpdate
phases, one could specify the system priority duringPreUpdate
for the relevant systems instead.This feature is used by specifying an integer value in a
<gz:system_priority>
tag for a system that will control the order in which SystemPreUpdate
andUpdate
callbacks are executed, with smaller priority values executing first.Test it
Follow the README instructions to build and run the
PriorityPrinter
example plugin to illustrate the feature.Checklist
codecheck
passed (See contributing)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.