Robotics StackExchange | Archived questions

How to convert gazebo plugin for SDF model into plugin for URDF?

Hi! I have made a custom Gazebo plugin for an SDF model. I would now like to use this same plugin with a URDF file, along with the ability to specify parameters for plugin inside the URDF file. How do I do this? Thanks.

Asked by raghavthakar on 2020-04-24 02:32:11 UTC

Comments

Answers

Hi! This seems to work for me:

<gazebo>
    <plugin name="apply_input_force" filename="libapply_input_force_plugin.so">
        <link>base_footprint</link>
    </plugin>
</gazebo>

the 'link' element here is a custom parameter you are passing to the plugin. These can be used in the plugin using this code:

_sdf->GetElement("link")->Get<std::string>();

Don't forget to pass 'sdf::ElementPtr _sdf' to your function!

Asked by Vianne on 2020-04-30 09:30:51 UTC

Comments

This was very helpful! I shall try this and revert ASAP!

Asked by raghavthakar on 2020-05-01 08:13:44 UTC