Creating a basic world plugin

We will look at a basic Gazebo world plugin and try to build and load it in Gazebo.

Create a folder called gazebo_basic_world_plugin in the user home folder and create a CPP file called hello_world.cc:

    $ mkdir ~/gazebo_basic_world_plugin
    $ cd ~/gazebo_basic_world_plugin
    $ nano hello_world.cc

The definition of hello_world.cc is as follows:

//Gazebo header for getting core gazebo functions #include <gazebo/gazebo.hh> //All gazebo plugins should have gazebo namespace namespace gazebo { //The custom WorldpluginTutorials is inheriting from standard worldPlugin. Each world plugin has to inheriting from standard plugin type. class WorldPluginTutorial : public WorldPlugin { public: WorldPluginTutorial() : WorldPlugin() ...

Get ROS Programming: Building Powerful Robots now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.