Home | Tutorials | Wiki | Issues
Ask Your Question

Difference in plugin tutorials: no header file vs yes header file

asked 2016-01-13 19:15:02 -0500

raequin gravatar image

Noob here! I've read through the plugin tutorials, for example


and also the sensors tutorials, and noticed an apparent difference between how plugins are handled. In the model plugin tutorial above there's no mention of a header file for the plugin but in the contact sensor tutorial


there is a plugin shown and it includes a header file. Can you tell me the reason for the difference?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-01-15 01:14:32 -0500

If you're familiar with C++, you'll understand that in some cases header files aren't necessary. When you're writing single-file programs, like most gazebo plugins are, then you'll rarely need a header file. Header files just help organize and share code, but they aren't always required.

This is a simple example of "well we could write a header file, or we could be lazy and just not". You certainly don't need one for the sensor tutorial, but we thought it wasn't too much extra work. Plus, it's always good practice to write header files, in case your project grows and you want more code. Then it will be helpful, or even required, to have a header file.

edit flag offensive delete link more


Oh, yeah. I remember that! I don't do much programming. Thanks.

raequin gravatar imageraequin ( 2016-01-15 11:33:05 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-01-13 18:55:03 -0500

Seen: 230 times

Last updated: Jan 15 '16