O'Reilly logo

Robot Operating System Cookbook by Kumar Bipin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Plugins registration

In the preceding subsection, we created standard C++ classes. Now, we will discuss pluginlib-specific work as a declaration of the Triangle and Square classes as plugins. Let's look at the source code in the src/polygon_plugins.cpp file:

#include <pluginlib/class_list_macros.h> 
#include <pluginlib_tutorials_/polygon_base.h> 
#include <pluginlib_tutorials_/polygon_plugins.h> 
 
PLUGINLIB_EXPORT_CLASS(polygon_plugins::Triangle, polygon_base::RegularPolygon) 
PLUGINLIB_EXPORT_CLASS(polygon_plugins::Square, polygon_base::RegularPolygon) 

Here, we have registered the Triangle and Square classes as plugins using the PLUGINLIB_EXPORT_CLASS macro.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required