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

Refactor architecture to be more threadsafe #7

Merged
merged 12 commits into from
Feb 24, 2022
Merged

Conversation

koonpeng
Copy link
Collaborator

🎉 New feature

Summary

General outline of the refactor

  • A ThreadSafe class to protect access of an object behind a mutex.
    • Consumers must call Lock() to get a reference to the object, the reference does locking with RAII, they are also non copyable and non movable to prevent the reference from "escaping" the lock.
  • Mutations happen directly on the usd session layer as updates comes in, all updates are done on the subscription threads. Previously updates are done in a mix of the subscription threads and the main thread.
  • No longer uses polling to update the scene, a service request to <world>/scene/info is done at the start to populate the stage, then a subscription to <world>/scene/info and <world>/scene/deletion to update the scene as models are added and removed.
    • As a result, there is no longer a need to resolve the scene changes between each poll request.
  • At each tick on the main render thread, the mutations on the session layer is committed to omniverse.

TODO: Test meshes support

Test it

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • 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.

Teo Koon Peng added 9 commits February 14, 2022 15:48
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
Teo Koon Peng and others added 3 commits February 17, 2022 11:59
Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
* Some fixed to thread safe arch

Signed-off-by: ahcorde <ahcorde@gmail.com>

* Include PIMPL and model name should not constain spaces

Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Co-authored-by: Teo Koon Peng <koonpeng@openrobotics.org>
try
{
const auto &prim = this->entities.at(id);
this->stage->Lock()->RemovePrim(prim.GetPath());
Copy link
Contributor

Choose a reason for hiding this comment

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

should we remove from the entities map the id ?

@ahcorde ahcorde merged commit b560db0 into main Feb 24, 2022
@ahcorde ahcorde deleted the threadsafe-arch branch February 24, 2022 20:56
@ahcorde ahcorde mentioned this pull request Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants