In this step, we will create the main C++ file that contains the definition of the plugin. The file is teleop_pad.cpp, and you will get it from the src package folder.
The main responsibilities of this file are as follows:
- It acts as a container for a Qt GUI element, such as QLineEdit, to accept text entries
- It publishes the command velocity using the ROS publisher
- It saves and restores the RViz config files
The following is the explanation for each section of the code:
TeleopPanel::TeleopPanel( QWidget* parent ) : rviz::Panel( parent ) , linear_velocity_( 0 ) , angular_velocity_( 0 ) {
This is the constructor and initialize rviz::Panel with QWidget, setting linear and angular velocity as