Ask Your Question
0

custom gazebo plugin

asked 2020-03-20 12:03:27 -0500

me_saw gravatar image

updated 2020-03-20 12:56:33 -0500

gvdhoorn gravatar image

I've created custom modelplugin for my model in cpp how do i add it correctly in my urdf?

i added it but gazebo is not recognizing it and when i add <gazebo> to my plugin its giving me an error so i removed it i started it with <plugin> with this its not giving me an error but not gazebo is recognizing this plugin

i added this in my pavkage.xml file

  <export>
    <gazebo_ros gazebo_model_path="${prefix}/models"/>
    <gazebo_ros plugin_path="${prefix}/lib" gazebo_media_path="${prefix}" />
  </export>
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2020-03-24 14:52:08 -0500

Weasfas gravatar image

updated 2020-03-24 14:53:47 -0500

Hi @me_saw,

A Gazebo plugin is added with this lines in the URDF:

  <plugin filename="plugin_name.so" name="some_name" >
    plugin args...
  </plugin>

However you will need to export the plugins path to advertise Gazebo where to find custom plugins. Take a look at this tutorial, you whould be able to follow it until the end, where you will find how to export and launch the plugin.

edit flag offensive delete link more

Comments

Hello,

I used the exact format as you have shown but still the gazebo is not loading the plugin and i followed that tutorial I gave the path but still no use gazebo is loading my model without any errors and without plugin

me_saw gravatar image me_saw  ( 2020-03-27 10:31:19 -0500 )edit

Mmm, Ok. I followed the tutorial exactly as it is in case there was any mistake in the explanation but I managed to generate the pugin and see the box moving on Gazebo. At his point I would recommend you to use the --verbose flag with Gazebo in order to see its log E.g.: Gazebo --verbose my_world.world and ensure you wrote the proper plugin name in the world file (libmodel_push.so), and the plugin has executable permissions (E.g.: sudo chmod +x libmodel_push.so).

Weasfas gravatar image Weasfas  ( 2020-03-28 06:50:16 -0500 )edit

I did the tutorial and the plugins that were shown there worked perfectly fine, the box was moving as it has to.The problem arises when i create my own plugin with the exact same method that was shown there but i attached wheels to my robot, it isn't working and I also tried loading the launch file using --verbose but it was clean it's not even showing the plugin part

me_saw gravatar image me_saw  ( 2020-03-28 13:02:08 -0500 )edit

Aa, ok. But that is different. In that case the URDF has a set of links and joints. For that to work you need to use the joints not the link. For instance, imagine you have a basic robot with a base_link and two wheel_links the descriptino will be somewhat to: base_link --> wheel_left_link (joined by left_wheel_joint: continuous) base_link --> right_wheel_link (joined by right_wheel_joint: continuous) Then you need to load a plugin that uses that joints setting the velocity to move the model. Take a look at the diff_drive_plugin source code, in line 280 and 281 is doing exactly that to assign wheel velocities.

Weasfas gravatar image Weasfas  ( 2020-03-29 04:43:14 -0500 )edit

I used this plugin it's working fine with the sdf but when I try to load it in urdf it isn't showing any plugin loaded I even applied it to joints I am using this plugin formy urdf model

me_saw gravatar image me_saw  ( 2020-03-29 06:30:37 -0500 )edit

Ok. I just cloned your repo into my computer and launched Gazebo. When I publish on the two wheel topic 1.00 I can see how the model moves. Maybe a trifle but you are launching Gazebo on pause state: <arg name="paused" value="true" /> Did you remember to click the play button in the bottom right corner of the GUI?

Weasfas gravatar image Weasfas  ( 2020-03-29 07:35:11 -0500 )edit

well that is not my repo got that from a tutorial. That model is working fine and it uses sdf model . I want to use that plugin for my own urdf

me_saw gravatar image me_saw  ( 2020-03-29 07:44:23 -0500 )edit

Well, if you cannot post the description we will not be able to help you further than this, because if it is not something related to the spurce code of the plugin or your PC/Gazebo environment, It must be something wrong in the robot description.

Weasfas gravatar image Weasfas  ( 2020-03-29 07:47:18 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-03-20 12:03:27 -0500

Seen: 28 times

Last updated: Mar 24