Creating plugins for the calculator application using pluginlib

Creating a calculator application using plugins is a slightly tedious task compared to writing a single code for The aim of this example is to show how to add new features to calculator without modifying main application code.

In this example, we will see a calculator application that loads plugins to perform each operation. Here, we only implement the main operations such as addition, subtraction, multiplication, and division. We can expand to any level by writing individual plugins for each operation.

Before going on to create the plugin definition, we can access the calculator code from the chapter_5_codes/pluginlib_calculator folder for reference.

We are going to create a ROS package called pluginlib_calculator to build these plugins and the main calculator application.

The following diagram shows how the calculator plugins and application are organized inside the pluginlib_calculator ROS package:

Figure 1: Organization of plugins in the calculator application

We can see the list of plugins of the calculator and a plugin base class called calc_functions. The plugin base class implements the common functionalities that are required by all of these plugins.

Here is how we can create the ROS package and start developing plugins for the main calculator application.

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

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