gz-sim icon indicating copy to clipboard operation
gz-sim copied to clipboard

Prototype: specify order of execution for System::Update callbacks

Open scpeters opened this issue 2 months ago • 5 comments

🎉 New feature

Part of #2268

Summary

This is a prototype for specifying an integer priority value for a System using a <gz:system_priority/> tag in its XML content. The SystemManager parses this tag and stores vectors of system callbacks in a std::map indexed by this priority value. The prototype only implements controllable execution order for the System::Update callbacks, but should be extended to support PreUpdate and PostUpdate as well (I'm not sure it's relevant for other callbacks like Configure, ConfigureParameters, or Reset but it could be implemented for those as well).

TODO:

  • [ ] Move definition of priority type, default priority, and priority element name to public System.hh header
  • [ ] Apply changes to PreUpdate as well
  • [ ] Retarget to Ionic and test with sensor systems
  • [ ] Profile performance of sensors using PostUpdate / Update / PreUpdate

Test it

Follow the instructions for the priority_printer example to run an example world with a plugin that illustrates this feature.

Checklist

  • [ ] Signed all commits for DCO
  • [ ] Added tests
  • [ ] Added example and/or tutorial
  • [ ] Updated documentation (as needed)
  • [ ] Updated migration guide (as needed)
  • [ ] Consider updating Python bindings (if the library has them)
  • [ ] 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 and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

scpeters avatar May 02 '24 18:05 scpeters