Step 2 – Creating the RViz plugin header file

Let's create a new header inside the src folder called teleop_pad.h. You will get this source code from the existing package. This header file consists of the class and methods declaration for the plugin.

The following is the explanation of this header file:

#include <ros/ros.h> 
#include <ros/console.h> 
#include <rviz/panel.h> 

The preceding code is the header file required to build this plugin; we need ROS headers for publishing the teleop topic and <rviz/panel.h> for getting the base class of the RViz panel for creating a new panel:

class TeleopPanel: public rviz::Panel 
{ 

This is a plugin class and it is inherited from the rviz::Panel base class:

Q_OBJECT 
public: 

This class is using the Qt ...

Get Mastering ROS for Robotics Programming - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.