Gazebo | Ignition | Community
Ask Your Question

c++ file in a gazebo model plugin?

asked 2017-05-06 20:44:19 -0500

Axxeel gravatar image

Hey all!

I'm a new ros-gazebo user, I've read some tutos and I have a question.

Is it possible to use a cpp file in a gazebo plugin model? For example, can I put the cpp file somewhere in this template explained in the tuto ? Because I have a cpp file with a main function (and some more functions) , and I have a gazebo model (an iRobot create). Is it possible for the model to follow the code (passing by the plugin, or directly, or another method)?

I guess the last solution is to convert all the cpp code in a plugin langage but is there an easier way?

Thanks in advance and have a great day.


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-05-08 10:07:02 -0500

sloretz gravatar image

All gazebo plugins are in C++; there is no plugin language. Any file can be included as long as you make sure the file is in your include path. In your CMakeLists.txt this is done using include_directories. In the case of source files you'll have to make sure all are listed in the call to add_library.

You won't be able to call or run your main function. main as a symbol is already defined by the gazebo executable. You should treat the Load() method on the plugin as the entry point.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-05-06 20:44:19 -0500

Seen: 845 times

Last updated: May 08 '17