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

Loading parameters for multiple ign_ros2_control plugins #145

Open
roni-kreinin opened this issue Jun 5, 2023 · 5 comments
Open

Loading parameters for multiple ign_ros2_control plugins #145

roni-kreinin opened this issue Jun 5, 2023 · 5 comments

Comments

@roni-kreinin
Copy link
Contributor

roni-kreinin commented Jun 5, 2023

I'm trying to run two different robots simultaneously in Fortress (ROS2 Humble) using ign_ros2_control. Each robot is namespaced and launches its own instance of the ign_ros2_control plugin, and both a Diff Drive controller and Joint State Broadcaster. Each robot has its own namespaced parameter file for the controllers. The nodes and topics are all being namespaced correctly, but the issue I am seeing is that when I spawn the second robot, the controller manager seems to be loading the parameter file of the first robot.

Each robot defines the plugin like so:

<gazebo>
  <plugin filename="libign_ros2_control-system.so" name="ign_ros2_control::IgnitionROS2ControlPlugin">
    <parameters>/path/to/robot/param.yaml</parameters>
    <ros>
            <remapping>~/odom:=platform/odom</remapping>
            <remapping>~/cmd_vel_unstamped:=platform/cmd_vel_unstamped</remapping>
            <remapping>/tf:=tf</remapping>
            <remapping>/tf_static:=tf_static</remapping>
            <remapping>/diagnostics:=diagnostics</remapping>
            <remapping>joint_states:=platform/joint_states</remapping>
            <namespace>robot_namespace</namespace>
    </ros>
  </plugin>
</gazebo>

The parameter file path and namespace is unique to each robot.

If I add the parameters of both robots to the parameter file of the first, then everything loads and runs well. Similarly, if I use the /** wildcard for the namespace in the parameter file, then both robots will load the first robots parameters.

Is there a workaround to this issue?

@lklimkiewicz7
Copy link

This is exactly what I have noticed. Same ROS and gazebo version. Please fix it.

@lklimkiewicz7
Copy link

Have you found a workaround @roni-kreinin ?

@roni-kreinin
Copy link
Contributor Author

@lklimkiewicz7 Either have all parameters in the file passed to the first robot, or us a wildcard if all robots use the same parameters.

@annaborn
Copy link

annaborn commented Nov 30, 2023

I have the same issue. Launch the script with gazebo sim and spawn two different robots. Each of the robot has its own controller manager with the corresponding namespace. I can see both controller managers get started. However, the second controller managers does not get its configurations from the file.

After the investigation of the code, I assume the problem is here

rclcpp::init(static_cast<int>(argv.size()), argv.data());

Since one single gz plugin manages all controller manager, the rcl Context will be initialized once and with the arguments, that contain the parameter file from the first controller manager. Therefore, the solution would be to reinitialize Context or to update the parameter before the controller manager could be created.

Could it be fixed, since the workaround does not scale-up?

@Mechaick
Copy link

I'm still facing this issue as mentionned by @roni-kreinin . Is there any progress on this ?

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

4 participants