Skip to Content
ROS Programming: Building Powerful Robots
book

ROS Programming: Building Powerful Robots

by Anil Mahtani, Luis Sanchez, Enrique Fernandez, Aaron Martinez, Lentin Joseph
March 2018
Intermediate to advanced content levelIntermediate to advanced
1396 pages
42h 14m
English
Packt Publishing
Content preview from ROS Programming: Building Powerful Robots

Step 3 - Exporting plugins using calculator_plugins.cpp

In order to load the class of plugins dynamically, we have to export each class using a special macro called PLUGINLIB_EXPORT_CLASS. This macro has to put in any CPP file that consists of plugin classes. We have already defined the plugin class, and in this file we are going to define the macro statement only.

Locate the calculator_plugins.cpp file from the chapter_5_codes/pluginlib_calculator/src folder, and here is how we export each plugin:

#include <pluginlib/class_list_macros.h> 
#include <pluginlib_calculator/calculator_base.h> 
#include <pluginlib_calculator/calculator_plugins.h> 
 
PLUGINLIB_EXPORT_CLASS(calculator_plugins::Add, calculator_base::calc_functions); 

Inside ...

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

Programming Robots with ROS

Programming Robots with ROS

Morgan Quigley, Brian Gerkey, William D. Smart
Machine Learning Design Patterns

Machine Learning Design Patterns

Valliappa Lakshmanan, Sara Robinson, Michael Munn

Publisher Resources

ISBN: 9781788627436Supplemental Content