Skip to content

Conversation

@nkoenig
Copy link
Contributor

@nkoenig nkoenig commented Jul 23, 2025

Fixes: #1260

🎉 New feature

Summary

This will download simulation assets in background threads by default. You can force simulation to wait for assets using the --wait-for-assets CLI option. I'm defaulting to async download because:

  1. It's a better user experience to have some instant GUI feedback.
  2. If you're using only the simulation server (no GUI), then you're in the experienced user category and can choose whether to wait for assets or not.

Test it

  1. Clear(or stash) your ~/.gz/fuel directory, and load a world with many assets asynchronously:
gz sim -v4 tunnel.sdf
  1. Try the same thing, but with blocking asset download:
gz sim -v4 --wait-for-assets tunnel.sdf
  1. Try the same thing, but specify a certain number of iterations:
gz sim -v4 --iterations 10 tunnel.sdf

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
  • Was GenAI used to generate this PR? If so, make sure to add "Generated-by" to your commits. (See this policy for more info.)

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by and Generated-by messages.

@nkoenig nkoenig marked this pull request as ready for review July 24, 2025 12:49
@nkoenig nkoenig requested a review from mjcarroll as a code owner July 24, 2025 12:49
@nkoenig nkoenig changed the title [WIP] Parallel asset download for Jetty Parallel asset download Jul 24, 2025
@azeey azeey added this to the Jetty Release milestone Jul 28, 2025
Copy link
Contributor

@arjo129 arjo129 left a comment

Choose a reason for hiding this comment

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

Thank you for this! This is such an amazing (and much needed) improvement in User Experience! I only have a handful of minor code-related knits.

It'd also be great if we could follow this up with some form of signalling, so that the GUI client can at least be aware of the state of the download.

// so we need to keep this object around.
// However, everything seems to work fine without storing this.
// \todo(nkoenig): Look into removing the sdfRoot member variable.
this->dataPtr->sdfRoot = sdfRoot;
Copy link
Contributor

Choose a reason for hiding this comment

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

Knit: I think its perfectly safe to remove this. It seems we no longer use this inside ServerPrivate and this is the only mention in Server.cc. While the copy constructor for SdfRoot has been optimized recently, this is still an unessecary operation.

Copy link
Contributor

Choose a reason for hiding this comment

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

We mainly want to keep the sdf::Element shared pointers valid since they will be used by systems to configure themselves. Some of these plugins might traverse to their parent elements via a weak pointer. If the sdf::Root object is destroyed, it could cause these shared pointers to become invalid.

I do think we should use a pointer here to avoid the extra copy, but that could be a followup PR.

/// at the appropriate time.
private: std::unique_ptr<msgs::WorldControlState> newWorldControlState;


Copy link
Contributor

Choose a reason for hiding this comment

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

Knit: Remove space

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed in 17834d5

@github-project-automation github-project-automation bot moved this from Inbox to In review in Core development Aug 21, 2025
@azeey
Copy link
Contributor

azeey commented Aug 26, 2025

I think the homebrew test failures are due to a type mismatch on component IDs between gz-sim and gz-msg. See gazebosim/gz-msgs#529

Copy link
Contributor

@azeey azeey left a comment

Choose a reason for hiding this comment

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

Haven't done a full review, but can confirm it works as described.

@azeey azeey merged commit c495292 into main Aug 26, 2025
12 of 13 checks passed
@azeey azeey deleted the feature/parallel-download-jetty branch August 26, 2025 01:50
@github-project-automation github-project-automation bot moved this from In review to Done in Core development Aug 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🪵 jetty Gazebo Jetty

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants