Skip to content

Architecture

Sarathkrishnan Ramesh edited this page Sep 1, 2020 · 3 revisions

Architecture

Ignition RViz is divided into three packages as seen in the figure.

ign_rviz_common: Common tools

Contains all the tools that are common to ign_rviz_plugins and ign_rviz.

FrameManager: Subscribes to TF data stores information about all the available frames. This class is used to get the pose (position and orientation) of a frame in 3D space. It also provides an API to set a fixed frame, frame with respect to which poses of all other frames are calculated.

RVizEvents: User defined Qt events used in ign-rviz to notify plugins the change in the fixed frame or list of available frames.

ign_rviz_plugins: Visualization plugins

This package contains all the default visualization plugins. A templated MessageDisplay class acts as a base class for all the display plugins. The template parameter is the ROS message type. This class provides the API to subscribe, unsubscribe, reset, update and change QoS settings. MessageDisplayBase class inherits from ignition::gui::Plugin to harness the power of ign-gui plugins. This also acts as an auxillary base class as templated classes cannot be declared as Q_OBJECT.

class MessageDisplayBase : public ignition::gui::Plugin
{
    Q_OBJECT
    // Base plugin API
};

template< MessageType >
class MessageDisplay: public MessageDisplayBase
{
    // Plugin API
};

// Example Plugin
class PoseDisplay : public MessageDisplay<geometry_msg::msg::PoseStamped>
{
    Q_OBJECT
    // Display plugin implementation
};

The rendering and ROS callback happens on different threads. Render event is generated by ign-gui Scene3D plugin after every render callback. When a ROS callback is received, the message data is cached locally in each plugin which is then used in the update method to render the latest data. The update method is called on receiving a render event and synchronization between the two was achieved by using locks.

ign_rviz: The main application

This package encompasses the main application. Ign-rviz follows a one-application one-node architecture. The main application is responsible for initializing the GUI, ROS node, FrameManager, and load the visualization plugins. A multithreaded executor is spawned to receive ROS callbacks on a different thread than the application thread. The visualization plugins can be loaded by Display Type and By Topic. On a successful plugin load, the reference to the ROS node and FrameManager is passed.