Skip to content

Add EntityFactoryWithNs#595

Draft
C88-YQ wants to merge 4 commits into
gazebosim:mainfrom
C88-YQ:ns_support
Draft

Add EntityFactoryWithNs#595
C88-YQ wants to merge 4 commits into
gazebosim:mainfrom
C88-YQ:ns_support

Conversation

@C88-YQ

@C88-YQ C88-YQ commented Jun 11, 2026

Copy link
Copy Markdown

🎉 New feature

Closes #

Summary

This PR adds two new message types for spawning entities with namespace support:

  • EntityFactoryWithNs: extends the existing entity factory pattern with an optional ns field using StringMsg, allowing callers to specify or override the namespace when creating an entity.
  • EntityFactoryWithNs_V: adds a repeated container message for sending multiple EntityFactoryWithNs requests together.

Backport Policy

  • This is safe to backport to the following versions:
    • Jetty
    • Ionic
    • Harmonic
    • Fortress
  • This should not be backported
  • I am not sure
  • Other (fill in yourself)

Checklist

  • Signed all commits for DCO
  • Added a screen capture or video to the PR description that demonstrates the feature
  • 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)
  • Updated Bazel files (if adding new files). Created an issue otherwise.
  • 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.)

C88-YQ added 2 commits June 9, 2026 22:51
Signed-off-by: C88-YQ <1409947012@qq.com>
Comment thread proto/gz/msgs/entity_factory_with_ns.proto Outdated
string name = 8;

/// \brief Optional new namespace for the entity, overrides the namespace on the SDF.
StringMsg ns = 9;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any reason for this to be StringMsg instead of string? Would setting it to an empty string not be sufficient? Or are you thinking of a usecase where the namespace in the model is replaced with "" (empty namespace)?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, the main reason is to distinguish between not set and set to an empty string.

If the user does not provide a namespace, I want to keep the existing namespace and avoid applying any override. But if the user explicitly sets it to "", that should be treated as an override that clears the namespace. A plain string would not let us distinguish those two cases, since its default value is also "".

Comment thread proto/gz/msgs/entity_factory_with_ns.proto Outdated
@github-project-automation github-project-automation Bot moved this from Inbox to In review in Core development Jun 11, 2026
Comment thread proto/gz/msgs/entity_factory_with_ns.proto Outdated
Signed-off-by: C88-YQ <1409947012@qq.com>
Signed-off-by: C88-YQ <1409947012@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants