Skip to content

Allow passing existing node to IntrospectionServer to avoid duplicate node name#130

Open
miguelprada wants to merge 2 commits intoros:ros2from
miguelprada:introspection-reuse-node
Open

Allow passing existing node to IntrospectionServer to avoid duplicate node name#130
miguelprada wants to merge 2 commits intoros:ros2from
miguelprada:introspection-reuse-node

Conversation

@miguelprada
Copy link

IntrospectionServer inheriting from Node is problematic when instancing it in a Python executable containing another node instance, which is likely the most common use case. In particular, the problem commonly arises when starting such executable from a launch file. In that case, the CLI arguments used by the launch system to set the node name will end up affecting both the nodes, resulting in duplicate nodes with the same name.

This MR proposes a possible fix by allowing to optionally pass an existing node instance to the IntrospectionServer class constructor.

Now server_name and the optional node in the constructor are somewhat redundant. I would've rather removed server_name altogether but it would break backward compatibility. Assuming the current situation quite broken as it is you may consider it fine to do so and I'll be happy to change it if you want.

@miguelprada
Copy link
Author

Upon closer inspection of our own use-case, decided to restore some of the original behavior of using the server_name string to define the base name of the topics created by IntrospectionServer. This allows having more than one instance of the class in a single executable if more than one state machine needs to be run.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant