Skip to content
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

VisualPlugins on ros2 branch that are loaded in both gzserver and gzclient have non-unique ROS node names #15

Closed
scpeters opened this issue Jun 15, 2023 · 1 comment

Comments

@scpeters
Copy link

Gazebo VisualPlugins can be loaded in both gzserver's camera sensor rendering thread and gzclient's user camera rendering thread. Some of the VisualPlugins in irg_gazebo_plugins on the ros2 branch use gazebo_ros::Node::Get(_sdf) to initialize a ROS 2 node for the plugin (such as LinkTracksPlugin and GlobalShaderParamPlugin). As called, this helper function sets the ROS node name from the plugins XML name attribute and will give the same name to ROS nodes associated with both gzserver and gzclient.

Currently many ROS 2 features and design assumptions depend on unique node names (ros2/design#187), so it would be beneficial to follow that pattern. There is an overload of gazebo_ros::Node::Get that accepts a std::string as a second parameter to use for the ROS node name, so it is straightforward to set this name programmatically.

Some approaches to name uniqueness include adding a random suffix (based on PID or time) to the node name or a suffix based on whether the plugin is loaded by gzserver or gzclient. One approach to determining whether a VisualPlugin is loaded by gzserver or gzclient is by checking the RMT_PORT environment variable (used for visualizing profiler data), which is set to 1500 in gzserver's server_main.cc and 1501 in gzclient's main.cc. This is not elegant, but would be straightforward to implement.

@mogumbo
Copy link
Contributor

mogumbo commented Oct 5, 2023

Resolved by merging a solution to the problem from a fork:

@mogumbo mogumbo closed this as completed Oct 5, 2023
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

No branches or pull requests

2 participants