Rosanswers logo

I have created some sensors and i want to make plugins of these sensor like the one defined in gazebo_plugins page

Are there any guidelines or tutorials for creating Gazbeo plugins?

Originally posted by SAK on ROS Answers with karma: 94 on 2011-08-19

Post score: 5

Original comments

Comment by hsu on 2011-08-24:
We have not been advertising much about plugin creation due to the fact that we are re-working a lot of the internal structures in gazebo on kforge. What do you need the plugin to do?

Comment by SAK on 2011-08-20:
I need to create the plugins from the files i have made. I didn't found any tutorials about making plugins for ros

Comment by PrasadNR on 2016-12-18:
@hsu I have a question here: http://answers.ros.org/question/250181/simulation-and-actuation-of-custom-model-in-ros-gazebo/ and I need custom plugin to actuate joints. I have seen some; But, I am having a hard time understanding function calls. Thanks for time and consideration.


1 Answer 1


Rosanswers logo

For now, the best thing to do is to follow the template provided in gazebo_plugins or mimic any of the examples in gazebo_plugins. Also take a look at gazebo configuration page to see how to setup plugin paths in your own packages.

Please keep in mind, plugin API's will change soon in F-Turtle, and will require some significant migratory changes/rewrites.

Proceeding on with the current setup, if you take a look at the template presented, there are 4 relevant member functions,

  • constructor - this is called once when the plugin is instantiated in Model::Load(...)
  • InitChild() - this is called once during Model::Init()
  • UpdateChild() - this is called once per Model::Update() call
  • FiniChild() - this is called once when a Model / Body is deleted, or simulator is shutting down, before destruction happens
  • destructor

The new plugin API for gazebo 1.0.0 RC to be released with Fuerte is described on the new gazebo wiki. Conversion from old plugin to the new format requires rewrite work described here.

Originally posted by hsu with karma: 5780 on 2011-08-24

This answer was ACCEPTED on the original site

Post score: 12

Original comments

Comment by hmmm on 2012-01-08:
@sak hello sak,i would be interested in your sonarsensor plugin,Did you have success? how can i use your sonar plugin in gazebo? greets

Comment by SAK on 2011-08-25:
Now i want to place all these in a package, so if someone wants , he/she can use it.

Comment by SAK on 2011-08-25:
i have created IR and sonar sensors, using the above functions (following the GazeboRosLaser). now i want to release that files in the form of plugins ( there are a large number of files like sonar.gazebo.xacro, sonar.urdf.xacro, sonarsensor, changes done to gz.h and MultiRayShape.cc)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.