Skip to content

fix: Add PushRosNamespace action to navigation launch file and update… #5300

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

OmarRebai
Copy link

Pull Request: Fix Namespacing in navigation_launch.py

Basic Info

Info Value
Ticket(s) this addresses N/A
Primary OS tested on Ubuntu 22.04
Robotic platform tested on Custom differential drive robot (real hardware)
Does this PR contain AI generated software? No

Description of contribution in a few bullet points

  • Added PushRosNamespace action to navigation_launch.py to ensure proper namespacing behavior.
  • Updated inline comments for clarity on how parameter namespacing works in ROS 2 launch files.
  • Enables cleaner support for multi-robot setups and better alignment with ROS 2 launch best practices.

Description of documentation updates required from your changes

  • No new parameters introduced.
  • No updates required to configuration or documentation pages.

Description of how this change was tested

  • Deployed the modified launch file on a real differential drive robot.
  • Verified that all nodes and parameters were correctly scoped under the specified namespace.
  • Confirmed functional navigation behavior with namespaced configuration.

Future work that may be required in bullet points

  • Extend similar namespacing improvements to other launch files in the nav2_bringup package.
  • Evaluate behavior on multi-robot simulation platforms to ensure broader compatibility.

For Maintainers:

  • Check that any new parameters added are updated in docs.nav2.org
  • Check that any significant change is added to the migration guide
  • Check that any new features OR changes to existing behaviors are reflected in the tuning guide
  • Check that any new functions have Doxygen added
  • Check that any new features have test coverage
  • Check that any new plugins is added to the plugins page
  • If BT Node, Additionally: add to BT's XML index of nodes for groot, BT package's readme table, and BT library lists
  • Should this be backported to current distributions? If so, tag with backport-*.

@OmarRebai OmarRebai force-pushed the main branch 2 times, most recently from 498d14d to ee67675 Compare June 24, 2025 10:46
Copy link

codecov bot commented Jun 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

see 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@SteveMacenski SteveMacenski left a comment

Choose a reason for hiding this comment

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

Isn't this already applied from

PushROSNamespace(namespace),
? This seems to be working with our unique and cloned multirobot launch files that we have today.

Please clarify what is not currently working using bringup_launch.py

@OmarRebai
Copy link
Author

OmarRebai commented Jun 25, 2025

Thank you @SteveMacenski for the clarification and for pointing that out!

You're absolutely right PushROSNamespace(namespace) is already present in bringup_launch.py. However, in my use case, I’m not using bringup_launch.py directly. Instead, I’m including navigation_launch.py as a standalone module within a larger system.

From a modularity and reusability perspective, I believe that each launch file, especially core ones like navigation_launch.py, should be self-contained and namespace-aware without relying on external context or wrapper files like bringup_launch.py. This would allow developers to reuse specific components of Nav2 independently, which is especially useful in complex or custom launch architectures.

For example, using navigation_launch.py directly without the namespace push results in errors such as:

"Couldn't load critics! Caught exception: No critics defined for FollowPath"

These kinds of issues can be ambiguous and hard to trace, especially for users who aren’t aware that PushROSNamespace is only applied in the higher-level launch file.

Additionally, having the YAML namespace configuration inside navigation_launch.py, while the actual namespace scoping is handled in bringup_launch.py, creates a split responsibility that may reduce clarity. Centralizing both the parameter setup and namespacing logic in one place helps avoid confusion and supports better modular ROS 2 development.

I hope this explains the motivation behind the proposed change. Let me know what you think, I’m happy to adjust the approach if needed.

@SteveMacenski
Copy link
Member

Ah, you should then push the namespace in the launch file that is launching navigation_bringup.launch.py. We have bringup_launch.py specifically so we can push namespaces in one place and impact more than just navigation, but also localization, map task servers, etc. Most users leverage bringup_launch.py as their entry point - as all of the other features within it can be selected off with a launch argument (localization, keep out, speed zones, etc).

We want that namespace push there so it applies to all of the launch files of a Nav2 bringup, not just navigation. Moving that to navigation would mean also moving that into the localization, keepout, and speed zone files, creating alot of redundancy. I don't understand what you mean by 'namespace aware' all of these launch files are aware of the namespaces and have them as launch arguments for remapping yaml files.

Overall, I think this is not something we would merge. But if we did, you'd have to update all the other launch files since your current PR breaks everyone else by applying double namespacing in navigation 😉

@OmarRebai
Copy link
Author

OmarRebai commented Jun 30, 2025

Thank you @SteveMacenski for the detailed clarification!

To clarify what I meant by “namespace aware”: while it's true that the current launch files accept a namespace argument for remapping YAML files, the actual namespace is only pushed at the top level in bringup_launch.py. This works well when launching everything from that entry point, but creates a limitation when trying to launch individual components like navigation_launch.py or localization_launch.py independently.

For example, during debugging, we sometimes need to launch each launch file in a separate terminal window to easily isolate and read debug messages or errors.

In these cases, passing the namespace argument alone isn’t enough, as the namespace isn’t actually pushed, which can lead to confusing behavior and missing parameters (e.g., critic configuration errors when launching navigation in isolation).

That’s the motivation behind updating all relevant launch files to explicitly push the namespace, not to break the central approach of bringup_launch.py, but to make each component more self-contained and usable independently.

Of course, I fully understand the concern about redundancy. The updated version of the PR takes that into account by consistently applying PushRosNamespace in all launch files where the namespace is accepted, avoiding double namespace pushes or breaking other components.

Let me know your thoughts, I’m happy to align further with the project's direction if needed!

@@ -89,6 +89,7 @@ def generate_launch_description() -> LaunchDescription:
# Nodes launching commands
start_map_server = GroupAction(
actions=[
PushRosNamespace(namespace),
Copy link
Member

Choose a reason for hiding this comment

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

Missing start_slam_toolbox_cmd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants