ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

How to use gazebo plugins found in gazebo_ros [ROS2 Foxy gazebo11]

asked 2020-07-11 19:55:44 -0500

Dawson gravatar image

I am trying to use the gazebo_ros_state plugin found inside the gazebo_ros folder in gazebo_ros_pkgs.

I have included this inside my world file similar to the demo also found in gazebo_ros folder...

  <plugin name="gazebo_ros_state" filename="libgazebo_ros_state.so">
      <ros>
        <namespace>/demo</namespace>
        <argument>model_states:=model_states_demo</argument>
      </ros>
      <update_rate>1.0</update_rate>
  </plugin>

I also tried to see if the migration guide found here (https://github.com/ros-simulation/gaz... and https://github.com/ros-simulation/gaz...) gave any info on it however nothing there seemed to offer any help.

This is the error I am getting when I try and start my world...

[Err] [Model.cc:1097] Model[cartpole] is attempting to load a plugin, but detected an incorrect plugin type. Plugin filename[libgazebo_ros_state.so] name[gazebo_ros_state]

libgazebo_ros_state.so is found inside my lib folder just like my other plugins

One more thing to note is that I have other plugins found in the gazebo_plugin folder that work and do not give an error like this...

edit retag flag offensive close merge delete

Comments

I am having the same problem. Any updates here?

BorgesJVT gravatar image BorgesJVT  ( 2020-09-15 19:55:06 -0500 )edit

I took the gazebo_ros_state_demo.world straight from the repo. Strangely, I get the same error but regardless it seems to work and I get the two service endpoints /demo/get_entity_state and /demo/set_entity_state and they do correctly return model data.

guru_florida gravatar image guru_florida  ( 2020-09-27 00:39:26 -0500 )edit

I have one observation. The gazebo_ros_state plugin is registered as a WORLD_PLUGIN type here. The error in the OP is coming from model.cc which is looking for MODEL_PLUGIN type here.

So, it seems the problem here is, the addition of the plugin in the sdf file is not having the desired effect of specifying a WORLD_PLUGIN. I wonder if the <plugin> tag added in the OP is under the <model> or under <world>. Not sure if that's a fix to the problem. But sharing a thought as I am trying to fix the same too.

sherlockshome221 gravatar image sherlockshome221  ( 2021-06-24 03:18:03 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-06-24 04:22:18 -0500

sherlockshome221 gravatar image

updated 2021-06-24 04:44:37 -0500

Following up on my comment above: The gazebo_ros_state plugin is registered as a WORLD_PLUGIN type here. The error in the OP is coming from model.cc which is looking for MODEL_PLUGIN type here.

So, the problem here is, the addition of the plugin in the sdf file is not having the desired effect of specifying a WORLD_PLUGIN. Adding the <plugin> under the <world> tag directly like below works without issues:

<world name="default">
        <plugin name="gazebo_ros_state" filename="libgazebo_ros_state.so">
          <ros>
            <namespace>/demo</namespace>
            <argument>model_states:=model_states_demo</argument>
          </ros>
          <update_rate>1.0</update_rate>
        </plugin>
</world>

Starting this world with gazebo my_world_file.world --verbose and then doing a ros2 service list | grep entity gives:

/demo/get_entity_state
/demo/set_entity_state
edit flag offensive delete link more

Comments

Related answer here

sherlockshome221 gravatar image sherlockshome221  ( 2021-06-24 05:50:15 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-07-11 19:55:44 -0500

Seen: 2,891 times

Last updated: Jun 24 '21