rqt_bag integration in my Gui

asked 2020-02-23 23:55:09 -0500

roman_v gravatar image

Hi, I try to integrate the rqt_bag into my custom Gui and can't find example how to do it. Find example to rqt_bag plugin, but it not possible to integrate in custom GUI without rqt_gui. I am looking for some example similar to Rviz integration:
import os from PyQt5 import QtWidgets import sys import rviz

class RvizViewer(QtWidgets.QWidget):

def __init__(self):
    super(RvizViewer, self).__init__()

    # > rviz.VisualizationFrame is the main container widget of the
    # > regular RViz application, with menus, a toolbar, a status
    # > bar, and many docked subpanels.  In this example, we
    # > disable everything so that the only thing visible is the 3D
    # > render window.
    self.frame = rviz.VisualizationFrame()

    # > The "splash path" is the full path of an image file which
    # > gets shown during loading.  Setting it to the empty string
    # > suppresses that behavior.
    self.frame.setSplashPath(os.path.join(os.getcwd(), 'radar-icon.png'))

    # > VisualizationFrame.initialize() must be called before
    # > VisualizationFrame.load().  In fact it must be called
    # > before most interactions with RViz classes because it
    # > instantiates and initializes the VisualizationManager,
    # > which is the central class of RViz.
    self.frame.initialize()

    # TODO: Fix loading config file
    # > The reader reads config file data into the config object.
    # > VisualizationFrame reads its data from the config object.
    # reader = rviz.YamlConfigReader()
    # config = rviz.Config()
    # reader.readFile(config, "config.rviz")
    # # reader.readFile( config, "my_config.rviz" )
    # self.frame.load(config)

    # > You can also store any other application data you like in
    # > the config object.  Here we read the window title from the
    # > map key called "Title", which has been added by hand to the
    # > config file.
    # self.setWindowTitle( config.mapGetChild( "Title" ).getValue() )
    self.setWindowTitle('RViz Python')

    # > Here we disable the menu bar (from the top), status bar
    # > (from the bottom), and the "hide-docks" buttons, which are
    # > the tall skinny buttons on the left and right sides of the
    # > main render window.

    # self.frame.setMenuBar( None )
    # self.frame.setStatusBar( None )
    self.frame.setHideButtonVisibility(False)

    # > frame.getManager() returns the VisualizationManager
    # > instance, which is a very central class.  It has pointers
    # > to other manager objects and is generally required to make
    # > any changes in an rviz instance.
    self.manager = self.frame.getManager()

    # > Since the config file is part of the source code for this
    # > example, we know that the first display in the list is the
    # > grid we want to control.  Here we just save a reference to
    # > it for later.
    # self.grid_display = self.manager.getRootDisplayGroup().getDisplayAt(0)

    self.main_layout = QtWidgets.QHBoxLayout(self)
    self.main_layout.addWidget(self.frame)

def reset_view(self):
    self.frame.reset()
edit retag flag offensive close merge delete