How to add multiple HWSim instances in gazebo?

asked 2023-07-29 03:56:55 -0500

I am simulating a franka panda arm mounted with shadowhand in Gazebo.

However, exsiting controllers of panda and shadowhand require different groups of hardware interfaces (or HWSim in Gazebo language). Currently I try to add the FrankaHWSim in franka_gazebo package and the SrGazeboHWSim in sr_gazebo_sim package at the same time. My approach is through adding two <plugin> labels as follows:

<gazebo>
    <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
        <robotParam>/mountedhand_only_description</robotParam>
        <robotSimType>sr_gazebo_sim/SrGazeboHWSim</robotSimType>
    </plugin>
    <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
        <controlPeriod>0.001</controlPeriod>
        <robotParam>/panda_only_description</robotParam>
        <robotSimType>franka_gazebo/FrankaHWSim</robotSimType>
    </plugin>
</gazebo>

As above, libgazebo_ros_control.so is loaded twice with different robot_description from the parameter server. However, the custom hardware interfaces in franka_gazebo/FrankaHWSim is never loaded. I find that the order of plugins matters. That is to say, the hardware interfaces in the first <plugin> tag could always be loaded successfully.

What's wrong with my implementation? Should I integrate the source codes of sr_gazebo_sim/SrGazeboHWSim and franka_gazebo/FrankaHWSim together to get a combined HWSim.

Thanks very much!

edit retag flag offensive close merge delete