Skip to Content
Robot Operating System Cookbook
book

Robot Operating System Cookbook

by Kumar Bipin
June 2018
Intermediate to advanced
484 pages
11h 36m
English
Packt Publishing
Content preview from Robot Operating System Cookbook

Creating plugins

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_ ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mobile Intelligent Autonomous Systems

Mobile Intelligent Autonomous Systems

Jitendra R. Raol, Ajith K. Gopal
Wheeled Mobile Robotics

Wheeled Mobile Robotics

Gregor Klancar, Andrej Zdesar, Saso Blazic, Igor Skrjanc

Publisher Resources

ISBN: 9781783987443Supplemental Content