Beispiel #1
0
    def __init__(self, filename="", status_bar=False):
        QWidget.__init__(self)

        self.filename = filename

        reader = rviz.YamlConfigReader()
        config = rviz.Config()
        reader.readFile(config, self.filename)

        self.frame = rviz.VisualizationFrame()
        # self.frame.setSplashPaths( "" )
        self.frame.initialize()
        self.frame.setMenuBar(None)
        if not status_bar:
            self.frame.setStatusBar(None)
        self.frame.setHideButtonVisibility(False)
        self.frame.load(config)

        self.manager = self.frame.getManager()
        self.grid_display = self.manager.getRootDisplayGroup().getDisplayAt(0)

        layout = QVBoxLayout()
        layout.addWidget(self.frame)
        self.setLayout(layout)
        self.frame.show()
Beispiel #2
0
    def __init__(self):
        QtWidgets.QWidget.__init__(self)
        self.frame = rviz.VisualizationFrame()
        self.frame.setSplashPath("")
        self.frame.initialize()
        reader = rviz.YamlConfigReader()
        config = rviz.Config()

        #you will need a rviz config file. This config file basically has the information about what all from the rviz you want to display on your custom UI.

        reader.readFile(
            config,
            "/home/rajendra/rqtGUI_ws/src/rviz_qt_embedder/rviz/navigation.rviz"
        )  #my_rviz_file.rviz
        self.frame.load(config)

        #some settings for how you want your rviz screen to look like.
        self.setWindowTitle(config.mapGetChild("Title").getValue())
        self.frame.setMenuBar(None)
        self.frame.setStatusBar(None)
        self.frame.setHideButtonVisibility(False)
        self.manager = self.frame.getManager()
        self.grid_display = self.manager.getRootDisplayGroup().getDisplayAt(0)
        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(self.frame)
        self.setLayout(layout)
Beispiel #3
0
    def __init__(self, app):
        QWidget.__init__(self)

        # self.showMaximized()
        self.setFixedSize(app.primaryScreen().size())
        # self.setFixedSize(1920, 1080)

        self.mapFrame = rviz.VisualizationFrame()
        self.mapFrame.setSplashPath("")
        self.mapFrame.initialize()
        reader = rviz.YamlConfigReader()
        config = rviz.Config()
        reader.readFile(config, SCRIPT_PATH + "/teleop.rviz")
        self.mapFrame.load(config)

        self.setWindowTitle("AlpaKa Teleoperator")

        self.mapFrame.setMenuBar(None)
        self.mapFrame.setStatusBar(None)
        self.mapFrame.setHideButtonVisibility(False)

        layout = QHBoxLayout()
        layout.addWidget(self.mapFrame)

        self.setLayout(layout)
Beispiel #4
0
    def __init__(self):
        QWidget.__init__(self)
        self.top = 590
        self.left = 0
        self.width = 500
        self.height = 500
        self.setGeometry(self.left, self.top, self.width, self.height)
        self.frame = rviz.VisualizationFrame()
        self.frame.setSplashPath("")
        self.frame.initialize()
        reader = rviz.YamlConfigReader()
        config = rviz.Config()
        reader.readFile(config, "behind.rviz")
        self.frame.load(config)
        self.setWindowTitle(config.mapGetChild("Title").getValue())
        self.frame.setMenuBar(None)
        self.frame.setStatusBar(None)
        self.frame.setHideButtonVisibility(False)
        self.manager = self.frame.getManager()
        self.grid_display = self.manager.getRootDisplayGroup().getDisplayAt(0)

        ## Here we create the layout and other widgets in the usual Qt way.
        layout = QVBoxLayout()
        layout.addWidget(self.frame)
        self.setLayout(layout)
Beispiel #5
0
    def initialize_all(self):
        #self.publish_nodes() #publish send NAV GOAL message from rviz
        #setting rviz visulizer
        self.rviz_frame = rviz.VisualizationFrame()
        self.rviz_frame.setSplashPath("")
        self.rviz_frame.initialize()
        #setting rviz frame reader
        reader = rviz.YamlConfigReader()
        config = rviz.Config()
        reader.readFile(
            config,
            "./default.rviz")  #this is saved rviz frame for d2v project
        #setting rviz tools
        self.rviz_frame.load(config)
        self.rviz_frame.setMenuBar(None)
        self.rviz_frame.setStatusBar(None)
        #setting rviz manager
        self.manager = self.rviz_frame.getManager()
        self.grid_display = self.manager.getRootDisplayGroup().getDisplayAt(0)
        self.rviz_layout.addWidget(self.rviz_frame)

        mbox = QMessageBox()
        mbox.setStyleSheet(
            "background-color: rgb(40, 42, 54);\ncolor:rgb(248,248,242);")
        mbox.setWindowTitle("Ready State")
        mbox.setText("All Process were Initialized     ")
        mbox.exec_()
Beispiel #6
0
    def __init__(self):

    #The twist commands
        self.pub = rospy.Publisher('mobile_base/commands/velocity', Twist) 
        self.zero_cmd_sent = False

    #The visualizer
        QWidget.__init__(self)

        self.frame = rviz.VisualizationFrame()
        self.frame.setSplashPath( "" )
        self.frame.initialize()

        ## 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, "imageOnly.rviz" )
        self.frame.load( config )

        self.setWindowTitle( config.mapGetChild( "Title" ).getValue() )

#Disable unneeded views
        self.frame.setMenuBar( None )
        self.frame.setStatusBar( None )
        self.frame.setHideButtonVisibility( False )

        self.manager = self.frame.getManager()

        self.grid_display = self.manager.getRootDisplayGroup().getDisplayAt( 0 )
        
        ## Here we create the layout and other widgets in the usual Qt way.
        layout = QVBoxLayout()
        layout.addWidget( self.frame )
        
       # speed_slider = QSlider( Qt.Horizontal )
        #speed_slider.setTracking( True )
       # speed_slider.setMinimum( 0.0 )
       # speed_slider.setMaximum( 1.0)
        #speed_slider.valueChanged.connect( self.onSpeedSliderChanged )
        #layout.addWidget( speed_slider )
        
        h_layout = QHBoxLayout()
        
        stop_button = QPushButton( "STOP" )
        stop_button.clicked.connect( self.onStopButtonClick )
        h_layout.addWidget( stop_button )
        
        fwd_button = QPushButton( "Move Forward" )
        fwd_button.clicked.connect( self.onFwdButtonClick )
        h_layout.addWidget( fwd_button )

        turn_button = QPushButton( "Turn Around" )
        turn_button.clicked.connect( self.onTurnButtonClick )
        h_layout.addWidget( turn_button )
        
        layout.addLayout( h_layout )
        
        self.setLayout( layout )
Beispiel #7
0
    def __init__(self, config_file, parent=None):
        super(GridAndConfig, self).__init__(parent)
        self.frame = rviz.VisualizationFrame()
        self.frame.setSplashPath( "" )
        self.frame.initialize()

        reader = rviz.YamlConfigReader()
        config = rviz.Config()
        reader.readFile( config, config_file )
        self.frame.load( config )
    def create_rviz_frame(self):
        frame = rviz.VisualizationFrame()
        frame.initialize()
        reader = rviz.YamlConfigReader()
        config = rviz.Config()
        reader.readFile(config,
                        os.path.join(rospkg.RosPack().get_path('march_rqt_gait_generator'), 'resource', 'cfg.rviz'))
        frame.load(config)

        # Hide irrelevant Rviz details
        frame.setMenuBar(None)
        frame.setStatusBar(None)
        frame.setHideButtonVisibility(False)
        return frame
Beispiel #9
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

        ## rviz.VisualizationFrame is the main container widget of the
        ## regular RViz application. In this example, we disable everything
        ## so that the only thing visible is the 3D render window.
        self.frame = rviz.VisualizationFrame()
        self.frame.setSplashPath("")
        self.frame.initialize()

        # Read the configuration from the config file for visualization.
        reader = rviz.YamlConfigReader()
        config = rviz.Config()

        reader.readFile(config, os.path.join(path, 'config', 'workcell.rviz'))
        self.frame.load(config)

        self.setWindowTitle(config.mapGetChild("Title").getValue())

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

        self.manager = self.frame.getManager()
        self.grid_display = self.manager.getRootDisplayGroup().getDisplayAt(0)

        layout = QtGui.QVBoxLayout()
        layout.setContentsMargins(9, 0, 9, 0)
        self.setLayout(layout)

        h_layout = QtGui.QHBoxLayout()
        layout.addLayout(h_layout)

        orbit_button = QtGui.QPushButton("Orbit View")
        orbit_button.clicked.connect(self.onOrbitButtonClick)
        h_layout.addWidget(orbit_button)

        front_button = QtGui.QPushButton("Front View")
        front_button.clicked.connect(self.onFrontButtonClick)
        h_layout.addWidget(front_button)

        right_button = QtGui.QPushButton("Rigth View")
        right_button.clicked.connect(self.onRightButtonClick)
        h_layout.addWidget(right_button)

        top_button = QtGui.QPushButton("Top View")
        top_button.clicked.connect(self.onTopButtonClick)
        h_layout.addWidget(top_button)

        layout.addWidget(self.frame)
    def __init__(self, main):
        super(QWidget, self).__init__()
        self.main = main
        self.setFixedHeight(350)

        self.using_urdf = False

        rviz_config_path = str(os.path.dirname(sys.path[0]) + "/config/setup_assistant.rviz")
        description_launch_path = str(os.path.dirname(sys.path[0]) + "/launch/description.launch")

        self.main.file_browser.new_urdf.connect(self.on_urdf_path_load)

        self.column = QHBoxLayout()
        self.row = QVBoxLayout()

        self.frame = rviz.VisualizationFrame()
        self.frame.setSplashPath("")
        self.frame.initialize()

        reader = rviz.YamlConfigReader()
        config = rviz.Config()
        reader.readFile(config, rviz_config_path)

        self.frame.load(config)
        self.frame.setMenuBar(None)
        self.frame.setStatusBar(None)
        self.frame.setHideButtonVisibility(False)

        self.manager = self.frame.getManager()

        self.robot_model_display = self.manager.getRootDisplayGroup().getDisplayAt(2) 
        self.robot_model_display.setBool(False)

        self.link_highlighter = self.robot_model_display.subProp("Highlight Link")
        self.link_unhighlighter = self.robot_model_display.subProp("Unhighlight Link")

        self.column.addWidget(self.frame)

        self.row.addLayout(self.column)
        self.setLayout(self.row)

        self.highlighted_link = None

        self.description_launch_args = [description_launch_path, "description_file:foo"]
        
        description_loader_uuid = roslaunch.rlutil.get_or_generate_uuid(None, False)
        roslaunch.configure_logging(description_loader_uuid)
        self.description_launcher = roslaunch.parent.ROSLaunchParent(description_loader_uuid, [self.description_launch_args[0]])
Beispiel #11
0
    def __init__(self):
        QWidget.__init__(self)

        ## render window.
        self.frame = rviz.VisualizationFrame()

        self.frame.setSplashPath("")

        self.frame.initialize()

        reader = rviz.YamlConfigReader()
        config = rviz.Config()
        reader.readFile(config, "config.myviz")
        self.frame.load(config)

        self.setWindowTitle(config.mapGetChild("Title").getValue())

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

        self.manager = self.frame.getManager()

        self.grid_display = self.manager.getRootDisplayGroup().getDisplayAt(0)

        layout = QVBoxLayout()
        layout.addWidget(self.frame)

        thickness_slider = QSlider(Qt.Horizontal)
        thickness_slider.setTracking(True)
        thickness_slider.setMinimum(1)
        thickness_slider.setMaximum(1000)
        thickness_slider.valueChanged.connect(self.onThicknessSliderChanged)
        layout.addWidget(thickness_slider)

        h_layout = QHBoxLayout()

        top_button = QPushButton("Top View")
        top_button.clicked.connect(self.onTopButtonClick)
        h_layout.addWidget(top_button)

        side_button = QPushButton("Side View")
        side_button.clicked.connect(self.onSideButtonClick)
        h_layout.addWidget(side_button)

        layout.addLayout(h_layout)

        self.setLayout(layout)
Beispiel #12
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.frame = rviz.VisualizationFrame()
        self.frame.setSplashPath("")
        self.frame.initialize()

        reader = rviz.YamlConfigReader()
        config = rviz.Config()

        reader.readFile(config, os.path.join(path, 'config', 'workcell.rviz'))
        self.frame.load(config)

        self.setWindowTitle(config.mapGetChild("Title").getValue())

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

        self.manager = self.frame.getManager()
        self.grid_display = self.manager.getRootDisplayGroup().getDisplayAt(0)

        layout = QtGui.QVBoxLayout()
        layout.setContentsMargins(9, 0, 9, 0)
        self.setLayout(layout)

        h_layout = QtGui.QHBoxLayout()
        layout.addLayout(h_layout)

        orbit_button = QtGui.QPushButton("Orbit View")
        orbit_button.clicked.connect(self.onOrbitButtonClick)
        h_layout.addWidget(orbit_button)

        front_button = QtGui.QPushButton("Front View")
        front_button.clicked.connect(self.onFrontButtonClick)
        h_layout.addWidget(front_button)

        right_button = QtGui.QPushButton("Rigth View")
        right_button.clicked.connect(self.onRightButtonClick)
        h_layout.addWidget(right_button)

        top_button = QtGui.QPushButton("Top View")
        top_button.clicked.connect(self.onTopButtonClick)
        h_layout.addWidget(top_button)

        layout.addWidget(self.frame)
Beispiel #13
0
 def __init__(self):
     QWidget.__init__(self)
     self.frame = rviz.VisualizationFrame()
     self.frame.setSplashPath("")
     self.frame.initialize()
     reader = rviz.YamlConfigReader()
     config = rviz.Config()
     reader.readFile(config, "trust_new.rviz")
     self.frame.load(config)
     self.setWindowTitle(config.mapGetChild("Title").getValue())
     self.frame.setMenuBar(None)
     self.frame.setStatusBar(None)
     self.frame.setHideButtonVisibility(False)
     self.manager = self.frame.getManager()
     self.grid_display = self.manager.getRootDisplayGroup().getDisplayAt(0)
     layout = QVBoxLayout()
     layout.addWidget(self.frame)
     self.setLayout(layout)
    def create_scene_plugin(self):
        package_path = rospkg.RosPack().get_path('sr_moveit_planner_benchmarking')
        rviz_config_approach = package_path + "/uis/scene.rviz"

        reader = rviz.YamlConfigReader()

        # Configuring approach window
        config_approach = rviz.Config()
        reader.readFile(config_approach, rviz_config_approach)
        self.frame_scene = rviz.VisualizationFrame()
        self.frame_scene.setSplashPath("")
        self.frame_scene.initialize()
        self.frame_scene.setMenuBar(None)
        self.frame_scene.setStatusBar(None)
        self.frame_scene.setHideButtonVisibility(False)
        self.frame_scene.load(config_approach)

        scene_layout = self._widget.findChild(QVBoxLayout, "scene_layout")
        scene_layout.addWidget(self.frame_scene)
        self.load_scene_file("empty")
Beispiel #15
0
    def __init__(self):
        QWidget.__init__(self)
        self.frame = rviz.VisualizationFrame()
        self.frame.setSplashPath(logoLocation)
        self.frame.initialize()

        reader = rviz.YamlConfigReader()
        config = rviz.Config()
        configPath = "~/FinderV3/catkin_ws/src/simulation/finder_fake/rviz/finder_fake.rviz"
        reader.readFile(config, configPath)
        self.frame.load(config)
        #self.setWindowTitle( config.mapGetChild( "Title" ).getValue() )
        #self.frame.setMenuBar( None )

        self.frame.setStatusBar(None)
        self.frame.setHideButtonVisibility(False)
        self.manager = self.frame.getManager()
        self.grid_display = self.manager.getRootDisplayGroup().getDisplayAt(0)
        layout = QVBoxLayout()
        layout.addWidget(self.frame)
        self.setLayout(layout)
Beispiel #16
0
def get_rviz(config_name, hide_menu=True, hide_status=True, splash=""):
    # 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.
    rviz_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.
    rviz_frame.setSplashPath(splash)
    # 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.
    rviz_frame.initialize()
    # 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_name)
    rospy.loginfo("Loading rviz config: {}".format(config_name))
    rviz_frame.load(config)
    rospy.loginfo("rviz config loaded")
    # 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.
    if hide_menu:
        rviz_frame.setMenuBar(None)
    if hide_status:
        rviz_frame.setStatusBar(None)
    # rviz_frame.setHideButtonVisibility( True )#Not even sure what this is
    # 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.
    rviz_manager = rviz_frame.getManager()
    return rviz_frame, rviz_manager
Beispiel #17
0
def fun():
    # rviz.OgreLogging.noLog() # (no log is the default)
    # rviz.OgreLogging.useStandardOut()
    # rviz.OgreLogging.useLogFile( "frame_test.ogre-log" )

    app = QApplication( sys.argv )

    frame = rviz.VisualizationFrame()
    frame.initialize()
    frame.show()

    sw = SampleWidget()
    sw.setFrame( frame )
    sw.show()
    frame.addPane( "Button", sw )

    app.exec_()

    # Without this destruct() call, this program crashes just after
    # the "after exec_()" printout, when "sw" goes out of scope and is
    # destroyed.
    sw.destruct()

    print "after exec_()"
Beispiel #18
0
    def __init__(self):

        QWidget.__init__(self)
        self.is_pr2 = rospy.get_param("remote_nav/is_pr2", False)
        self.init_ros_variables()

        #The visualizer
        self.frame = rviz.VisualizationFrame()
        self.frame.setSplashPath("")
        self.frame.initialize()

        ## The reader reads config file data into the config object.
        ## VisualizationFrame reads its data from the config object.
        reader = rviz.YamlConfigReader()
        config = rviz.Config()

        # We use rospack to find the filepath for remote_nav.
        rospack = rospkg.RosPack()
        package_path = rospack.get_path('remote_nav')

        #Now you can grab this filepath from either roslaunch remote_nav myviz and using the launch file or just rosrun.
        config_file = rospy.get_param(
            'remote_nav/rviz_config',
            package_path + "/rviz/turtle_map_img.rviz")
        reader.readFile(config, config_file)
        self.frame.load(config)

        self.setWindowTitle(config.mapGetChild("Title").getValue())
        self.setWindowIcon(QIcon(package_path + '/images/icon.png'))

        #Disable unneeded views and more visualization setup
        self.frame.setMenuBar(None)
        self.frame.setStatusBar(None)
        self.frame.setHideButtonVisibility(False)
        self.manager = self.frame.getManager()
        self.grid_display = self.manager.getRootDisplayGroup().getDisplayAt(0)

        ##LAYOUT
        ##^^^^^^
        layout = QGridLayout()
        layout.setSpacing(10)

        layout.addWidget(self.frame, 1, 0, 4, 3)

        h_layout = QHBoxLayout()

        #Buttons and attached commands
        # 1. Create Button
        # 2. Connect Signal to Slot
        # 3. Add to layout

        self.look_fwd_button = QPushButton("Look Forward")
        self.look_fwd_button.clicked.connect(self.onLookFwdButtonClick)
        self.look_fwd_button.setToolTip('Press this to look forward.')
        self.look_fwd_button.setStyleSheet(
            "background-color: #700000 ; font-weight: bold; color: white")
        layout.addWidget(self.look_fwd_button, 8, 1)

        self.fwd_button = PicButton(QPixmap(package_path + "/images/up.png"))
        self.fwd_button.setClickPix(
            QPixmap(package_path + "/images/upDark.png"))
        # self.fwd_button = QPushButton("Move Forward")
        self.fwd_button.pressed.connect(self.onFwdPress)
        self.fwd_button.setToolTip('While held, the robot will move forward')
        layout.addWidget(self.fwd_button, 5, 1)
        layout.setAlignment(self.fwd_button, Qt.AlignHCenter)

        turn_button = PicButton(QPixmap(package_path + "/images/rotate.png"))
        turn_button.setClickPix(
            QPixmap(package_path + "/images/rotateDark.png"))
        turn_button.clicked.connect(self.onTurnButtonClick)
        turn_button.setToolTip('The robot will turn around 180 degrees')

        self.look_left_btn = PicButton(
            QPixmap(package_path + "/images/left.png"))
        self.look_left_btn.setClickPix(
            QPixmap(package_path + "/images/leftDark.png"))

        self.look_right_btn = PicButton(
            QPixmap(package_path + "/images/right.png"))
        self.look_right_btn.setClickPix(
            QPixmap(package_path + "/images/rightDark.png"))

        # Only actually connect these to the moving of the head if there is in fact a head.
        if (self.is_pr2):
            self.look_left_btn.pressed.connect(self.onLeftButtonClick)
            self.look_right_btn.pressed.connect(self.onRightButtonClick)

        #Finalizing layout and placing components
        h_layout.addWidget(self.look_left_btn)
        h_layout.setAlignment(self.look_left_btn, Qt.AlignRight)
        h_layout.addWidget(turn_button)
        h_layout.setAlignment(turn_button, Qt.AlignHCenter)
        h_layout.addWidget(self.look_right_btn)
        h_layout.setAlignment(self.look_right_btn, Qt.AlignLeft)

        layout.addLayout(h_layout, 7, 1)
        self.setLayout(layout)
Beispiel #19
0
    def __init__(self):
        QWidget.__init__(self)

        try:
            self.rvizcommand = rospy.ServiceProxy('rvizcommand', Rvizcommand)
            self.rvizcommand(a="delete_all")
        except rospy.ServiceException as e:
            print("Service call failed: %s" % e)

        rospack = rospkg.RosPack()

        ## 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("")

        ## 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()

        ## 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,
            os.path.join(rospack.get_path('social_segway_gui'), "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())

        ## 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)

        ## Here we create the layout and other widgets in the usual Qt way.
        layout = QVBoxLayout()

        self.statusLabel = QLabel()
        self.statusLabel.setText(
            "Input name, click current room name, add two points for a room, click save to save the current room, once all the rooms are in click save to xml."
        )
        layout.addWidget(self.statusLabel)

        layout.addWidget(self.frame)

        self.textBox = QLineEdit("Room Name here")
        layout.addWidget(self.textBox)

        h_layout = QHBoxLayout()

        top_button = QPushButton("Set room name")
        top_button.clicked.connect(self.onTopButtonClick)
        h_layout.addWidget(top_button)

        side_button = QPushButton("Save current room")
        side_button.clicked.connect(self.onSideButtonClick)
        h_layout.addWidget(side_button)

        publish_button = QPushButton("Save rooms xml")
        publish_button.clicked.connect(self.publishButtonClick)
        h_layout.addWidget(publish_button)

        layout.addLayout(h_layout)

        self.setLayout(layout)
Beispiel #20
0
    def InitRviz(self, rvizPath):
        self.l3 = QLabel('Angular Speed')
        self.l3.setAlignment(Qt.AlignCenter)
        self.l4 = QLabel('Linear Speed')
        self.l4.setAlignment(Qt.AlignCenter)
        self.frame = rviz.VisualizationFrame()
        self.frame.setSplashPath("")
        self.frame.initialize()

        reader = rviz.YamlConfigReader()
        config = rviz.Config()
        reader.readFile(config, rvizPath)

        self.frame.load(config)

        self.setWindowTitle(config.mapGetChild("Title").getValue())

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

        self.manager = self.frame.getManager()

        self.grid_display = self.manager.getRootDisplayGroup().getDisplayAt(0)

        rvizLayout = QVBoxLayout()
        rvizLayout.addWidget(self.frame)

        self.angularDial = QDial(self)
        self.angularDial.setGeometry(QRect(10, 20, 311, 351))
        self.angularDial.setMinimum(-10)
        self.angularDial.setMaximum(10)
        self.angularDial.setTracking(True)

        # initial dial pointer position
        dial_pos = 50
        self.angularDial.setSliderPosition(dial_pos)
        self.angularDial.setWrapping(False)
        self.angularDial.setNotchTarget(0.1)
        self.angularDial.setNotchesVisible(True)
        self.angularDial.setValue(0)
        self.angularDial.valueChanged.connect(self.changeLabel_1_Value)

        self.linearSpeedDial = QDial(self)
        self.linearSpeedDial.setGeometry(QRect(10, 20, 30, 30))
        self.linearSpeedDial.setMinimum(-10)
        self.linearSpeedDial.setMaximum(10)
        self.linearSpeedDial.setTracking(True)

        # initial dial pointer position
        self.linearSpeedDial.setSliderPosition(dial_pos)
        self.linearSpeedDial.setWrapping(False)
        self.linearSpeedDial.setNotchTarget(0.1)
        self.linearSpeedDial.setNotchesVisible(True)
        self.linearSpeedDial.setValue(0)
        self.linearSpeedDial.valueChanged.connect(self.changeLabel_2_Value)

        controlPanelLayout = QGridLayout()
        controlPanelLayout.setSpacing(6)
        controlPanelLayout.addWidget(self.l3, 0, 6, 1, 3)
        controlPanelLayout.addWidget(self.l4, 0, 9, 1, 3)
        controlPanelLayout.addWidget(self.btn1, 0, 1, 1, 1)
        controlPanelLayout.addWidget(self.btn2, 1, 3, 1, 1)
        controlPanelLayout.addWidget(self.btn3, 2, 5, 1, 1)
        self.parent.statusBar().addPermanentWidget(self.parent.l1)
        self.parent.statusBar().addPermanentWidget(self.parent.l2)

        controlPanelLayout.addWidget(self.angularDial, 1, 6, 3, 3)
        controlPanelLayout.addWidget(self.linearSpeedDial, 1, 9, 3, 3)

        mainLayout = QVBoxLayout()
        mainLayout.addLayout(rvizLayout)
        mainLayout.addLayout(controlPanelLayout)

        self.setLayout(mainLayout)
Beispiel #21
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1200, 1000)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget)
        self.verticalLayoutWidget.setGeometry(QtCore.QRect(50, 20, 1110, 950))
        self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
        self.verticalLayout.setSizeConstraint(
            QtWidgets.QLayout.SetDefaultConstraint)
        self.verticalLayout.setContentsMargins(5, 5, 5, 5)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setContentsMargins(5, 5, 5, 5)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.StartButton = QtWidgets.QPushButton(self.verticalLayoutWidget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum,
                                           QtWidgets.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.StartButton.sizePolicy().hasHeightForWidth())
        self.StartButton.setSizePolicy(sizePolicy)
        self.StartButton.setObjectName("StartButton")
        self.horizontalLayout.addWidget(self.StartButton)
        self.StopButton = QtWidgets.QPushButton(self.verticalLayoutWidget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum,
                                           QtWidgets.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.StopButton.sizePolicy().hasHeightForWidth())
        self.StopButton.setSizePolicy(sizePolicy)
        self.StopButton.setObjectName("StopButton")
        self.horizontalLayout.addWidget(self.StopButton)
        self.LaunchButton = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.LaunchButton.setObjectName("LaunchButton")
        self.label = QtWidgets.QLabel(self.verticalLayoutWidget)
        self.verticalLayout.addWidget(self.label)
        font = QtGui.QFont()
        font.setFamily("Ubuntu Mono")
        font.setPointSize(25)
        font.setBold(True)
        font.setWeight(75)
        self.label.setFont(font)
        self.label.setText("Time")
        self.label.setObjectName("label")
        ####################################################################################################
        self.frame = rviz.VisualizationFrame()
        self.frame.setSplashPath("")
        self.frame.initialize()
        reader = rviz.YamlConfigReader()
        config = rviz.Config()
        reader.readFile(config, "navigation.rviz")
        self.frame.load(config)
        self.frame.setMenuBar(None)
        self.frame.setStatusBar(None)
        self.frame.setHideButtonVisibility(False)
        self.frame.setFullScreen(True)

        ## 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()
        self.verticalLayout.addWidget(self.frame)
        self.verticalLayout.addWidget(self.LaunchButton)
        self.verticalLayout.addLayout(self.horizontalLayout)
        ####################################################################################################
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

        #Calling appropriate function based on the button clicked
        self.LaunchButton.clicked.connect(self.launched)
        self.StartButton.clicked.connect(self.started)
        self.StopButton.clicked.connect(self.stopped)

        #Timer stuff
        self.timer = QtCore.QTimer
Beispiel #22
0
    def __init__(self):
        super(InspectionWindow, self).__init__()
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.ui = '../forms/manual.ui'
        self.mission_dir = '../instance/missions'
        loadUi(self.ui, self)
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)

        self.layout = self.findChild(QtWidgets.QGridLayout, 'layout')

        self.table_row_tracker = 2
        self.num_goal_reached = 0

        # Image frames
        self.videoframe = self.findChild(QtWidgets.QLabel, 'videoFrame')
        self.topImageLabel = self.findChild(QtWidgets.QLabel, 'topImageLabel')
        self.middelImageLabel = self.findChild(QtWidgets.QLabel, 'middelImageLabel')
        self.bottomImageLabel = self.findChild(QtWidgets.QLabel, 'bottomImageLabel')

        # Buttons
        self.startVideoStreamBtn = self.findChild(QtWidgets.QPushButton, 'startVideoStreamBtn')
        self.stopVideoStreamBtn = self.findChild(QtWidgets.QPushButton, 'stopVideoStreamBtn')
        self.abortMissionBtn = self.findChild(QtWidgets.QToolButton, 'abortMissionBtn')
        self.inspectStatusBtn = self.findChild(QtWidgets.QPushButton, 'inspectStatusBtn')
        self.pauseMissionBtn = self.findChild(QtWidgets.QToolButton, 'pauseMissionBtn')
        self.stopMissionBtn = self.findChild(QtWidgets.QToolButton, 'stopMissionBtn')
        self.startMissionBtn = self.findChild(QtWidgets.QToolButton, 'startMissionBtn')
        self.refreshSelectMissionAreaBtn = self.findChild(QtWidgets.QToolButton, 'refreshSelectMissionAreaBtn')
        self.refreshSelectMissionBtn = self.findChild(QtWidgets.QToolButton, 'refreshSelectMissionBtn')
        self.inspectStatusBtn.hide()

        # Button connections
        self.startMissionBtn.clicked.connect(self.start_mission)
        self.pauseMissionBtn.clicked.connect(self.pause_mission)

        # Labels
        self.runninMissionLabel = self.findChild(QtWidgets.QLabel, 'runninMissionLabel')
        self.runningTaskLabel = self.findChild(QtWidgets.QLabel, 'runningTaskLabel')
        self.currentRunningMissionLabel = self.findChild(QtWidgets.QLabel, 'currentRunningMissionLabel')

        # Progressbars
        self.runningTaskProgressBar = self.findChild(QtWidgets.QProgressBar, 'runningTaskProgressBar')

        # Comboboxes
        self.videoSourceComboBox = self.findChild(QtWidgets.QComboBox, 'videoSourceComboBox')
        self.selectMissionAreaComboBox = self.findChild(QtWidgets.QComboBox, 'selectMissionAreaComboBox')
        self.selectMissionComboBox = self.findChild(QtWidgets.QComboBox, 'selectMissionComboBox')

        self.videoSourceComboBox.addItems(["Color", "Fisheye 1", "Fisheye 2","Infared 1", "Infared 2", ])
        self.selectMissionAreaComboBox.addItems(['', "Workshop", "University", "Demo 1","Demo 2", "Demo 3"])
        self.find_missions()

        # RVIZ
        self.visual_frame = rviz.VisualizationFrame()
        self.visual_frame.setSplashPath("")
        self.visual_frame.initialize()
        self.add_rviz_config()

        self.visual_frame.setMenuBar(None)
        self.visual_frame.setStatusBar(None)
        self.visual_frame.setHideButtonVisibility(True)

        self.layout.addWidget(self.visual_frame)

        self.manager = self.visual_frame.getManager()
        self.grid_display = self.manager.getRootDisplayGroup().getDisplayAt(0)

        self.plan = None
        self.missions = []
        self.column_images = [self.topImageLabel, self.middelImageLabel, self.bottomImageLabel]
        self.column_image_counter = 0

        # Tables
        self.tableWidget = self.findChild(QtWidgets.QTableWidget, 'tableWidget')
        self.tableWidget.setHorizontalHeaderLabels(['Time', 'Tag', 'Operation','Status', 'Value', 'Warning', 'Error'])
        header = self.tableWidget.horizontalHeader()
        header.setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)
        header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch)
        header.setSectionResizeMode(2, QtWidgets.QHeaderView.Stretch)
        header.setSectionResizeMode(3, QtWidgets.QHeaderView.Stretch)
        header.setSectionResizeMode(4, QtWidgets.QHeaderView.Stretch)
        header.setSectionResizeMode(5, QtWidgets.QHeaderView.Stretch)
        header.setSectionResizeMode(6, QtWidgets.QHeaderView.Stretch)
    
        # Top Buttons
        self.change_mode_btn = self.findChild(
            QtWidgets.QPushButton, 'changeModeBtn')
        self.exit_btn = self.findChild(QtWidgets.QPushButton, 'exitBtn')
        self.powerBtn = self.findChild(QtWidgets.QPushButton, 'powerBtn')
        self.emergency_btn = self.findChild(
            QtWidgets.QPushButton, 'emergencyBtn')

        # Status indicators
        self.signal_btn = self.findChild(QtWidgets.QPushButton, 'signalBtn')
        self.controller_battery_btn = self.findChild(
            QtWidgets.QPushButton, 'controllerBatteryBtn')
        self.battery_btn = self.findChild(QtWidgets.QPushButton, 'batteryBtn')
        self.health_btn = self.findChild(QtWidgets.QPushButton, 'healthBtn')

        # Button connections

        # Button shortcuts
        self.exit_btn.setShortcut("Ctrl+Q")

        # Stylesheets
        self.powerBtn.setStyleSheet(
            "QPushButton#powerBtn:checked {color:black; background-color: red;}")
        self.signal_btn.setStyleSheet(
            "QPushButton#signalBtn:checked {color:black; background-color: green;}")
        
        # ROS SUBSCRIBERS
        rospy.init_node('listener', anonymous=True)
        rospy.Subscriber('/d435/infra1/image_rect_raw', Image, self.image_callback)
        rospy.Subscriber('goal_reached', UInt8, self.result_callback)
        rospy.Subscriber('in_position', String, self.api_callback)

        self.show()
Beispiel #23
0
    def __init__(self):
        QWidget.__init__(self)
        #intial linear and angular speed
        self.lin = 1
        self.ang = 1
        self.x = 0
        self.y = 0
        self.roll = 0
        self.pitch = 0
        self.yaw = 0
        #ROS subscriber
        rospy.Subscriber("/odometry/filtered", Odometry, self.findLoc)
        #main RViz window
        self.frame = rviz.VisualizationFrame()
        #remove loading splash
        self.frame.setSplashPath("")
        #initialize manager
        self.frame.initialize()
        #read/run config
        reader = rviz.YamlConfigReader()
        config = rviz.Config()
        reader.readFile(config, "jackal_config_reduced.rviz")
        self.frame.load(config)
        self.setWindowTitle(config.mapGetChild("Title").getValue())
        #diable menus
        self.frame.setMenuBar(None)
        self.frame.setStatusBar(None)
        self.frame.setHideButtonVisibility(False)
        #set up manager for RViz
        self.manager = self.frame.getManager()
        #reference to display
        self.grid_display = self.manager.getRootDisplayGroup().getDisplayAt(0)
        #layout for RViz
        rviz_layout = QVBoxLayout()
        rviz_layout.addWidget(self.frame)
        view_layout = QHBoxLayout()
        #view buttons
        toppushButton = QtWidgets.QPushButton("Top View")
        toppushButton.clicked.connect(self.onTopButtonClick)
        view_layout.addWidget(toppushButton)
        sidepushButton = QtWidgets.QPushButton("Side View")
        sidepushButton.clicked.connect(self.onSideButtonClick)
        view_layout.addWidget(sidepushButton)
        rviz_layout.addLayout(view_layout)

        #creating turning controls
        control_box = QGridLayout()
        #control_box.setColumnStretch(1, 4)
        #control_box.setColumnStretch(2, 4)
        #forwards
        pushButtonForwards = QtWidgets.QPushButton(self)
        pushButtonForwards.setObjectName("pushButtonForwards")
        pushButtonForwards.setText("Forwards")
        pushButtonForwards.setAutoRepeat(True)
        #backwards
        pushButtonBackwards = QtWidgets.QPushButton(self)
        pushButtonBackwards.setObjectName("pushButtonBackwards")
        pushButtonBackwards.setText("Backwards")
        pushButtonBackwards.setAutoRepeat(True)
        #turn left
        pushButtonLeft = QtWidgets.QPushButton(self)
        pushButtonLeft.setObjectName("pushButtonLeft")
        pushButtonLeft.setText("Left")
        pushButtonLeft.setAutoRepeat(True)
        #turn right
        pushButtonRight = QtWidgets.QPushButton(self)
        pushButtonRight.setObjectName("pushButtonRight")
        pushButtonRight.setText("Right")
        pushButtonRight.setAutoRepeat(True)
        #add buttons to layout
        control_box.addWidget(pushButtonForwards, 0, 1)
        control_box.addWidget(pushButtonLeft, 1, 0)
        control_box.addWidget(pushButtonRight, 1, 2)
        control_box.addWidget(pushButtonBackwards, 2, 1)

        #creating speed controls
        speed_box = QGridLayout()
        #linear speed dial
        self.qdialspeed = QtWidgets.QDial(self)
        self.qdialspeed.setObjectName("QDialSpeed")
        self.qdialspeed.setMinimum(1)
        self.qdialspeed.setMaximum(10)
        self.qdialspeed.setValue(1)
        self.qdialspeed.setNotchesVisible(True)
        speed_box.addWidget(self.qdialspeed, 1, 0)
        #angular speed dial
        self.qdialAngspeed = QtWidgets.QDial(self)
        self.qdialAngspeed.setObjectName("QDialAngSpeed")
        self.qdialAngspeed.setMinimum(1)
        self.qdialAngspeed.setMaximum(10)
        self.qdialAngspeed.setValue(1)
        self.qdialAngspeed.setNotchesVisible(True)
        speed_box.addWidget(self.qdialAngspeed, 1, 1)
        #label for linear
        self.labelVel = QtWidgets.QLabel(self)
        self.labelVel.setObjectName("labelVel")
        self.labelVel.setText("Linear Speed : 1")
        self.labelVel.adjustSize()
        speed_box.addWidget(self.labelVel, 0, 0)
        #label for angular
        self.labelAngVel = QtWidgets.QLabel(self)
        self.labelAngVel.setObjectName("labelAngVel")
        self.labelAngVel.setText("Angular Speed : 1")
        self.labelAngVel.adjustSize()
        speed_box.addWidget(self.labelAngVel, 0, 1)

        #creating odom labels
        postion_layout = QVBoxLayout()
        #postion label
        self.labelPositon = QtWidgets.QLabel(self)
        self.labelPositon.setObjectName('labelPositon')
        #angle label
        self.labelAngle = QtWidgets.QLabel(self)
        self.labelAngle.setObjectName('labelAngle')
        self.labelPositon.setText("Postion: (" + str(round(self.x, 3)) + ", " +
                                  str(round(self.y, 3)) + ")")
        self.labelAngle.setText("Angle: (" + str(round(self.roll)) + ", " +
                                str(round(self.pitch)) + ", " +
                                str(round(self.yaw)) + ")")
        self.labelPositon.adjustSize()
        self.labelAngle.adjustSize()
        #timer for odom update
        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.updateLabelOdom)
        self.timer.start(1000)  #repeat every 1 sec
        postion_layout.addWidget(self.labelPositon)
        postion_layout.addWidget(self.labelAngle)

        #main window layout
        main_layout = QGridLayout()
        main_layout.addLayout(rviz_layout, 0, 0, 0, 1)
        main_layout.addLayout(control_box, 0, 1)
        main_layout.addLayout(speed_box, 1, 1)
        main_layout.addLayout(postion_layout, 2, 1)
        self.setLayout(main_layout)

        #behavior
        pushButtonForwards.pressed.connect(self.moveForward)
        pushButtonBackwards.pressed.connect(self.moveBackwards)
        pushButtonLeft.pressed.connect(self.moveLeft)
        pushButtonRight.pressed.connect(self.moveRight)
        self.qdialspeed.sliderReleased.connect(self.updateLin)
        self.qdialspeed.sliderReleased.connect(self.updateLabel)
        self.qdialAngspeed.sliderReleased.connect(self.updateAng)
        self.qdialAngspeed.sliderReleased.connect(self.updateLabelAng)
Beispiel #24
0
    def __init__(self):
        QWidget.__init__(self)

        self.frame = rviz.VisualizationFrame()

        self.frame.setSplashPath("")

        self.frame.initialize()

        reader = rviz.YamlConfigReader()
        config = rviz.Config()
        reader.readFile(config, "config.rviz")
        self.frame.load(config)

        self.setWindowTitle(config.mapGetChild("Title").getValue())

        ## not working because of a bug in rviz (segmentation fault)
        # self.frame.setMenuBar( None )
        # self.frame.setStatusBar( None )
        # self.frame.setHideButtonVisibility( False )

        self.manager = self.frame.getManager()

        self.grid_display = self.manager.getRootDisplayGroup().getDisplayAt(0)

        layout = QVBoxLayout()
        layout.addWidget(self.frame)

        label = QLabel("Status")
        self.status = label
        layout.addWidget(label)

        activity_label = QLabel("")
        font = QFont()
        font.setPointSize(26)
        font.setBold(True)
        font.setWeight(50)
        activity_label.setFont(font)
        activity_label.setVisible(False)
        self.activity_label = activity_label
        layout.addWidget(activity_label)

        h_layout = QHBoxLayout()

        save_model_button = QPushButton("Save Model")
        save_model_button.clicked.connect(self.onSaveModelClick)
        h_layout.addWidget(save_model_button)

        load_model_button = QPushButton("Load Model")
        load_model_button.clicked.connect(self.onLoadModelClick)
        h_layout.addWidget(load_model_button)

        layout.addLayout(h_layout)

        h2_layout = QHBoxLayout()

        save_samples_button = QPushButton("Save Samples")
        save_samples_button.clicked.connect(self.onSaveSamplesClick)
        h2_layout.addWidget(save_samples_button)

        load_samples_button = QPushButton("Load Samples")
        load_samples_button.clicked.connect(self.onLoadSamplesClick)
        h2_layout.addWidget(load_samples_button)

        layout.addLayout(h2_layout)

        command_layout = QHBoxLayout()

        recognition_button = QPushButton("Start Recognition")
        recognition_button.clicked.connect(self.onRecognitionClick)
        self.recognition_button = recognition_button
        command_layout.addWidget(recognition_button)

        recording_button = QPushButton("Start Recording")
        recording_button.clicked.connect(self.onRecordingClick)
        self.recording_button = recording_button
        command_layout.addWidget(recording_button)

        layout.addLayout(command_layout)

        learn_model_button = QPushButton("Learn Model from samples")
        learn_model_button.clicked.connect(self.onLearnModelClick)
        layout.addWidget(learn_model_button)

        self.setLayout(layout)
Beispiel #25
0
    def __init__(self):
        super(ManualWindow, self).__init__()
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.ui = '../forms/manual.ui'
        loadUi(self.ui, self)
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)

        self.layout = self.findChild(QtWidgets.QGridLayout, 'layout')

        self.mode = JOYSTICK_ONLY_MODE

        self.visual_frame = rviz.VisualizationFrame()
        self.visual_frame.setSplashPath("")
        self.visual_frame.initialize()
        self.add_rviz_config()

        self.visual_frame.setMenuBar(None)
        self.visual_frame.setStatusBar(None)
        self.visual_frame.setHideButtonVisibility(False)

        self.layout.addWidget(self.visual_frame)
        self.visual_frame.hide()

        self.manager = self.visual_frame.getManager()
        self.grid_display = self.manager.getRootDisplayGroup().getDisplayAt(0)

        self.video_frame = QtWidgets.QLabel()
        video_frame_font = QtGui.QFont("Verdana", 62, QtGui.QFont.Bold)
        self.video_frame.setFont(video_frame_font)
        self.video_frame.setText("No video frame")
        self.video_frame.setAlignment(QtCore.Qt.AlignCenter)
        self.video_frame.hide()
        self.layout.addWidget(self.video_frame)

        self.joystick_frame = QtWidgets.QLabel()
        pixmap = QtGui.QPixmap('../static/img/xbox_controller_grey.png')
        pixmap = pixmap.scaledToWidth(800)
        self.joystick_frame.setPixmap(pixmap)
        self.joystick_frame.setAlignment(QtCore.Qt.AlignCenter)
        self.layout.addWidget(self.joystick_frame)

        # Buttons
        self.change_mode_btn = self.findChild(QtWidgets.QPushButton,
                                              'changeModeBtn')
        self.turn_left = self.findChild(QtWidgets.QToolButton, 'turnRobotLeft')
        self.turn_right = self.findChild(QtWidgets.QToolButton,
                                         'turnRobotRight')
        self.stand_btn = self.findChild(QtWidgets.QPushButton, 'standBtn')
        self.walk_btn = self.findChild(QtWidgets.QPushButton, 'walkBtn')
        self.stairs_btn = self.findChild(QtWidgets.QPushButton, 'stairsBtn')
        self.exit_btn = self.findChild(QtWidgets.QPushButton, 'exitBtn')
        self.powerBtn = self.findChild(QtWidgets.QPushButton, 'powerBtn')
        self.emergency_btn = self.findChild(QtWidgets.QPushButton,
                                            'emergencyBtn')

        # Status indicators
        self.signal_btn = self.findChild(QtWidgets.QPushButton, 'signalBtn')
        self.controller_battery_btn = self.findChild(QtWidgets.QPushButton,
                                                     'controllerBatteryBtn')
        self.battery_btn = self.findChild(QtWidgets.QPushButton, 'batteryBtn')
        self.health_btn = self.findChild(QtWidgets.QPushButton, 'healthBtn')

        # Button connections
        self.emergency_btn.clicked.connect(self.turn_robot_off)
        self.powerBtn.clicked.connect(self.power_on)
        self.exit_btn.clicked.connect(self.close_window)
        self.change_mode_btn.clicked.connect(self.change_mode)

        # Button shortcuts
        self.exit_btn.setShortcut("Ctrl+Q")

        # Mode Layouts
        #self.video_frame = self.findChild(QtWidgets.QLabel, 'videoFrame')
        # self.xbox_controller_frame = self.findChild(
        #    QtWidgets.QLabel, 'xboxcontrollerFrame')
        # self.video_frame.hide()

        # Stylesheets
        self.powerBtn.setStyleSheet(
            "QPushButton#powerBtn:checked {color:black; background-color: red;}"
        )
        self.signal_btn.setStyleSheet(
            "QPushButton#signalBtn:checked {color:black; background-color: green;}"
        )

        self.video_stream_subscriber = VideoStreamSubscriber(
            'camera/image_raw', Image)

        self.show()
Beispiel #26
0
    def __init__(self):
        QWidget.__init__(self)
        #intial linear and angular speed
        self.lin = 1
        self.ang = 1
        #ROS publisher
        #main RViz window
        self.frame = rviz.VisualizationFrame()
        #remove loading splash
        self.frame.setSplashPath("")
        #initialize manager
        self.frame.initialize()
        #read/run config
        reader = rviz.YamlConfigReader()
        config = rviz.Config()
        reader.readFile(config, "config.myviz")
        self.frame.load(config)
        self.setWindowTitle(config.mapGetChild("Title").getValue())
        #diable menus
        self.frame.setMenuBar(None)
        self.frame.setStatusBar(None)
        self.frame.setHideButtonVisibility(False)
        #set up manager for RViz
        self.manager = self.frame.getManager()
        #reference to display
        self.grid_display = self.manager.getRootDisplayGroup().getDisplayAt(0)

        #layout
        rviz_layout = QVBoxLayout()
        rviz_layout.addWidget(self.frame)

        view_layout = QHBoxLayout()

        toppushButton = QtWidgets.QPushButton("Top View")
        toppushButton.clicked.connect(self.onTopButtonClick)
        view_layout.addWidget(toppushButton)

        sidepushButton = QtWidgets.QPushButton("Side View")
        sidepushButton.clicked.connect(self.onSideButtonClick)
        view_layout.addWidget(sidepushButton)

        rviz_layout.addLayout(view_layout)

        control_box = QGridLayout()
        control_box.setColumnStretch(1, 4)
        control_box.setColumnStretch(2, 4)

        pushButtonForwards = QtWidgets.QPushButton(self)
        pushButtonForwards.setObjectName("pushButtonForwards")
        pushButtonForwards.setText("Forwards")
        pushButtonForwards.setAutoRepeat(True)

        pushButtonBackwards = QtWidgets.QPushButton(self)
        pushButtonBackwards.setObjectName("pushButtonBackwards")
        pushButtonBackwards.setText("Backwards")
        pushButtonBackwards.setAutoRepeat(True)

        pushButtonLeft = QtWidgets.QPushButton(self)
        pushButtonLeft.setObjectName("pushButtonLeft")
        pushButtonLeft.setText("Left")
        pushButtonLeft.setAutoRepeat(True)

        pushButtonRight = QtWidgets.QPushButton(self)
        pushButtonRight.setObjectName("pushButtonRight")
        pushButtonRight.setText("Right")
        pushButtonRight.setAutoRepeat(True)

        #control_box.addWidget(QtWidgets.QPushButton('1'),0,0)
        control_box.addWidget(pushButtonForwards, 0, 1)
        #control_box.addWidget(QtWidgets.QPushButton('3'),0,2)
        control_box.addWidget(pushButtonLeft, 1, 0)
        #control_box.addWidget(QtWidgets.QPushButton('5'),1,1)
        control_box.addWidget(pushButtonRight, 1, 2)
        #control_box.addWidget(QtWidgets.QPushButton('7'),2,0)
        control_box.addWidget(pushButtonBackwards, 2, 1)
        #control_box.addWidget(QtWidgets.QPushButton('9'),2,2)

        speed_box = QGridLayout()

        self.qdialspeed = QtWidgets.QDial(self)
        self.qdialspeed.setObjectName("QDialSpeed")
        self.qdialspeed.setMinimum(1)
        self.qdialspeed.setMaximum(10)
        self.qdialspeed.setValue(1)
        self.qdialspeed.setNotchesVisible(True)
        speed_box.addWidget(self.qdialspeed, 0, 0)

        self.qdialAngspeed = QtWidgets.QDial(self)
        self.qdialAngspeed.setObjectName("QDialAngSpeed")
        self.qdialAngspeed.setMinimum(1)
        self.qdialAngspeed.setMaximum(10)
        self.qdialAngspeed.setValue(1)
        self.qdialAngspeed.setNotchesVisible(True)
        speed_box.addWidget(self.qdialAngspeed, 0, 1)

        self.labelVel = QtWidgets.QLabel(self)
        self.labelVel.setObjectName("labelVel")
        self.labelVel.setText("Linear Speed : 1")
        self.labelVel.adjustSize()
        speed_box.addWidget(self.labelVel, 1, 0)

        self.labelAngVel = QtWidgets.QLabel(self)
        self.labelAngVel.setObjectName("labelAngVel")
        self.labelAngVel.setText("Angular Speed : 1")
        self.labelAngVel.adjustSize()
        speed_box.addWidget(self.labelAngVel, 1, 1)

        main_layout = QGridLayout()
        main_layout.addLayout(rviz_layout, 0, 0, 0, 1)
        main_layout.addLayout(control_box, 0, 1)
        main_layout.addLayout(speed_box, 1, 1)

        self.setLayout(main_layout)

        #behavior
        pushButtonForwards.pressed.connect(self.moveForward)
        pushButtonBackwards.pressed.connect(self.moveBackwards)
        pushButtonLeft.pressed.connect(self.moveLeft)
        pushButtonRight.pressed.connect(self.moveRight)
        self.qdialspeed.sliderReleased.connect(self.updateLin)
        self.qdialAngspeed.sliderReleased.connect(self.updateAng)
Beispiel #27
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        path = rospkg.RosPack().get_path('etna_planning')

        ## rviz.VisualizationFrame is the main container widget of the
        ## regular RViz application. In this example, we disable everything
        ## so that the only thing visible is the 3D render window.
        self.frame = rviz.VisualizationFrame()
        self.frame.setSplashPath("")
        self.frame.initialize()

        ## The reader reads config file data into the config object.
        ## VisualizationFrame reads its data from the config object.
        reader = rviz.YamlConfigReader()
        config = rviz.Config()

        #        rospack = rospkg.RosPack()
        #        package_path = rospack.get_path('rviz_python_tutorial')
        #        reader.readFile( config, package_path + "config.myviz" )
        reader.readFile(config, os.path.join(path, 'config', 'workcell.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.frame.setMenuBar(None)
        self.frame.setHideButtonVisibility(False)

        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)

        layout = QtGui.QVBoxLayout()
        layout.setContentsMargins(9, 0, 9, 0)
        self.setLayout(layout)

        h_layout = QtGui.QHBoxLayout()
        layout.addLayout(h_layout)

        orbit_button = QtGui.QPushButton("Orbit View")
        orbit_button.clicked.connect(self.onOrbitButtonClick)
        h_layout.addWidget(orbit_button)

        front_button = QtGui.QPushButton("Front View")
        front_button.clicked.connect(self.onFrontButtonClick)
        h_layout.addWidget(front_button)

        right_button = QtGui.QPushButton("Rigth View")
        right_button.clicked.connect(self.onRightButtonClick)
        h_layout.addWidget(right_button)

        top_button = QtGui.QPushButton("Top View")
        top_button.clicked.connect(self.onTopButtonClick)
        h_layout.addWidget(top_button)

        layout.addWidget(self.frame)
 def OnInit(self):
     ogre_tools.initializeOgre()
     frame = rviz.VisualizationFrame(None)
     frame.initialize()
     frame.Show(True)
     return True
Beispiel #29
0
    def __init__(self):
        QWidget.__init__(self)

        ## 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("")

        ## 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()

        ## 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.myviz")
        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())

        ## 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)

        ## Here we create the layout and other widgets in the usual Qt way.
        layout = QVBoxLayout()
        layout.addWidget(self.frame)

        thickness_slider = QSlider(Qt.Horizontal)
        thickness_slider.setTracking(True)
        thickness_slider.setMinimum(1)
        thickness_slider.setMaximum(1000)
        thickness_slider.valueChanged.connect(self.onThicknessSliderChanged)
        layout.addWidget(thickness_slider)

        h_layout = QHBoxLayout()

        top_button = QPushButton("Top View")
        top_button.clicked.connect(self.onTopButtonClick)
        h_layout.addWidget(top_button)

        side_button = QPushButton("Side View")
        side_button.clicked.connect(self.onSideButtonClick)
        h_layout.addWidget(side_button)

        layout.addLayout(h_layout)

        self.setLayout(layout)
    def __init__(self):
        QWidget.__init__(self)
        rospy.init_node("Vis")
        self.pub = rospy.Publisher("/Output",
                                   String,
                                   latch=False,
                                   queue_size=1)
        self.pos_sub = rospy.Subscriber("/posible_pose",
                                        Marker,
                                        self.callback,
                                        queue_size=1)
        ## 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("")

        ## 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()

        ## 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, Rviz_File)
        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())

        ## 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.text = QLabel("Movement: ")
        ## Here we create the layout and other widgets in the usual Qt way.
        layout = QVBoxLayout()
        layout.addWidget(self.frame)
        h_layout = QHBoxLayout()
        top_button = QPushButton("Acept Movement? (Green Arrow)")
        top_button.clicked.connect(self.onTopButtonClick)
        h_layout.addWidget(top_button)
        layout.addWidget(self.text)
        No_button = QPushButton("Reject Movement?")
        No_button.clicked.connect(self.NoButtonClick)
        h_layout.addWidget(No_button)
        layout.addLayout(h_layout)
        self.setLayout(layout)