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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.13.113