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

Same namespace for multiple plugins #1398

Open
tonynajjar opened this issue May 24, 2022 · 3 comments
Open

Same namespace for multiple plugins #1398

tonynajjar opened this issue May 24, 2022 · 3 comments

Comments

@tonynajjar
Copy link

tonynajjar commented May 24, 2022

When spawning multiple instances, the same namespace is used for all plugins, although a different namespace is passed each time

I pass a namespace into the xacro as such:

      <plugin name="backward_lidar_plugin" filename="libgazebo_ros_ray_sensor.so">
        <ros>
          <namespace>/$(arg namespace)</namespace>
          <argument>~/out:=backward_lidar</argument>
        </ros>
        <output_type>sensor_msgs/Range</output_type>
        <radiation_type>infrared</radiation_type>
        <frame_name>backward_lidar</frame_name>
      </plugin>

and for gazebo_ros2_control:

  <gazebo>
    <plugin name="gazebo_ros2_control_plugin" filename="libgazebo_ros2_control.so">
      <ros>
        <namespace>/$(arg namespace)</namespace>
        <remapping>~/cmd_vel:=cmd_vel_smoothed</remapping>
        <remapping>~/odom:=odom</remapping>
      </ros>
      <robot_param_node>robot_state_publisher</robot_param_node>
      <robot_param>robot_description</robot_param>
      <parameters>$(find amr_bringup)/config/control/$(arg namespace)_simulation_tricycle_controller.yaml</parameters>
    </plugin>
  </gazebo>

When running one instance, I get the correct namespace, but when running two instances, the plugins get the same namespace:

$ ros2 node list
/amr2/backward_lidar_plugin
/amr2/backward_lidar_plugin
/amr2/gazebo_ros2_control_plugin
/amr2/gazebo_ros2_control_plugin

I did some debugging and I could narrow down the issue to this line: The namespace passed to std::make_shared() is different than the resulting namespace of the created node (node->get_namespace()). In fact it uses the namespace of the previously created node.

It is probably related to #1392. Would really appreciate some help here. Thanks

@muttistefano
Copy link

i think https://github.com/beta-robots has forked some repos such as ros2_control and ros2_controllers and partially fixed this part.
I found a comment in an issue that I'm not able to retrieve now , with a list of the important commits.
I am still experiencing some problems but at least I'm able to load gazebo plugins in different namespaces.
I don't know if this fix is included in the rolling release.

@tonynajjar
Copy link
Author

tonynajjar commented May 24, 2022

I don't think the issue is in ros2_control though. It also happens with other plugins as showed above

@bobbleballs
Copy link

Hi I've looked into this at ros-controls/gazebo_ros2_control/issues/127
Hopefully this fixes things for you also @tonynajjar

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

3 participants