Global __node argument causes node name collisions
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 805
- Forks
- 564
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 27
Description
When spawning a process that has multiple internal nodes, the __node:=some_node_name argument applies to all nodes in that process. Take, for instance, the TransformListener, which spawns a node to hold its subscription. If multiple TransformListeners are used, those nodes might have different names by default, but passing the command line __node option causes these to get started with the same name.
This makes things like setting arguments, calling services, and sometimes just setting up publishers/subscribers fail in various ways and has been pervasive in the Navigation2 stack: https://github.com/ros-planning/navigation2/issues/842
A couple possible resolutions:
- Handle duplicate node names in the same process more gracefully.
- Only respect the global
__nodeoption for the first node created in a process. - Make
__nodeonly select the prefix to the node name. If multiple nodes are attempted to be created with the same name, append a (sequential?) suffix to uniquify them. - Add a parameter to the Node constructor to ignore the global node name override but respect the other global options. (this doesn't fully solve the problem of unique names, since the node is now responsible for making sure they're globally unique and any API that creates nodes must now enforce it).
- Deprecate the global
__nodeoption and respect the node name passed to the Node constructor (Thenlaunch_ros.actions.Nodewill have to use more targeted remapping to ensure that subnodes are
Discussion of a hacky workaround (pass __node argument to internal nodes to override the top-level __node argument) can be found here https://github.com/ros2/geometry2/pull/159
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review how the global __node argument is applied when multiple nodes are created in one process, using TransformListener as the concrete case described. Compare the four proposed resolutions and determine how duplicate names, remapping, and internal-node behavior should work; done requires an agreed solution that avoids collisions without breaking existing global options.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100