June 2018
Intermediate to advanced
484 pages
11h 36m
English
We will create a base class called RegularPolygon from which all of our plugins, including Triangle and Square, would inherit.
The source code of packages can be downloaded from GitHub (https://github.com/kbipin/Robot-Operating-System-Cookbook):
#ifndef PLUGINLIB_TUTORIALS__POLYGON_BASE_H_
#define PLUGINLIB_TUTORIALS__POLYGON_BASE_H_
namespace polygon_base
{
class RegularPolygon
{
public:
virtual void initialize(double side_length) = 0;
virtual double area() = 0;
virtual ~RegularPolygon(){}
protected:
RegularPolygon(){}
};
};
#endif
We will create two RegularPolygon plugins; the first will be Triangle and the second will be Square: pluginlib_tutorials/include/pluginlib_tutorials/polygon_plugins.h.
#ifndef PLUGINLIB_TUTORIALS__POLYGON_PLUGINS_H_ ...