Skip to content

Conversation

@YaraShahin
Copy link

🦟 Bug fix

Fixes #3116

Summary

What is the issue

PosePublisher generates inconsistent topic names between initial load and world reset:

  • Initial load: /model/vehicle/pose
  • After reset: /world/demo/model/vehicle/pose

Why it happens

The topicFromScopedName function recurses over all parents to constitute the topic name. At initial configure, the world parent entity wasn't available yet. After reset, the full entity hierarchy exists, producing a different topic name.

Solution

  • Defer publisher creation to PostUpdate() when the world entity component is guaranteed to exist. This follows the same pattern used in JointStatePublisher.
  • Set the _excludeWorld parameter to true in topicFromScopedName: to consistently exclude the world name from topics, matching the expected topic name and existing behavior.

How to reproduce

  1. Launch a world with PosePublisher: ros2 launch ros_gz_sim_demos sdf_parser.launch.py
  2. Observe topic: gz topic -l shows /model/vehicle/pose
  3. Reset world
  4. Observe topic changes to /world/demo/model/vehicle/pose

After this fix, the topic remains /model/vehicle/pose in both cases.

Notes

  • Could not reproduce this issue on gz-sim10, so this fix targets gz-sim8.

Checklist

  • Signed all commits for DCO
  • Added tests (existing PosePublisher tests validate functionality)
  • Updated documentation (no API changes required)
  • Updated migration guide (not needed - internal implementation detail)
  • Consider updating Python bindings (not applicable)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage) (1 pre-existing failure in INTEGRATION_examples_build unrelated to this change)
  • 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.

@YaraShahin YaraShahin requested a review from arjo129 as a code owner December 14, 2025 20:56
@github-actions github-actions bot added the 🎵 harmonic Gazebo Harmonic label Dec 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🎵 harmonic Gazebo Harmonic

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

1 participant