def __init__(self, mcptam_namespace='mcptam'):
   
   # Init QWidget
   super(SysmonWidget, self).__init__()
   self.setObjectName('SysmonWidget')
   
   # load UI
   ui_file = os.path.join(rospkg.RosPack().get_path('artemis_sysmon'), 'resource', 'widget.ui')
   loadUi(ui_file, self)
           
   # Subscribe to ROS topics and register callbacks
   self._slam_info_sub = rospy.Subscriber(mcptam_namespace+'/system_info', SystemInfo, self.slam_info_cb)
   self._slam_tracker_sub = rospy.Subscriber(mcptam_namespace+'/tracker_state', TrackerState, self.slam_tracker_cb)
   
   # Initialize service call
   print('Waiting for MAV services')
   rospy.wait_for_service(mcptam_namespace+'/init')
   rospy.wait_for_service(mcptam_namespace+'/reset')
   print('Connected to SLAM system')
   self._slam_init_srv = rospy.ServiceProxy(mcptam_namespace+'/init', Empty)
   self._slam_reset_srv = rospy.ServiceProxy(mcptam_namespace+'/reset', Reset)
  
   # init and start update timer for data, the timer calls the function update_info all 40ms    
   self._update_info_timer = QTimer(self)
   self._update_info_timer.timeout.connect(self.update_info)
   self._update_info_timer.start(40)
   
   # set the functions that are called when a button is pressed
   self.button_start.pressed.connect(self.on_start_button_pressed)
   self.button_reset.pressed.connect(self.on_reset_button_pressed)
   self.button_quit.pressed.connect(self.on_quit_button_pressed)
    def __init__(self, url=None):
        """
        Class to load a webpage in a widget.

        :param url: If url is empty then a navigation bar is shown otherwise the url is loaded and the navigation bar is hidden, ''str''
        """
        super(WebWidget, self).__init__()
        rp = rospkg.RosPack()
        ui_file = os.path.join(rp.get_path('rqt_web'), 'resource', 'web_widget.ui')
        loadUi(ui_file, self)
        self.setObjectName('WebWidget')

        self._loading = False
        self._stop_icon = QIcon.fromTheme('process-stop')
        self._reload_icon = QIcon.fromTheme('view-refresh')
        self._working_icon = QIcon.fromTheme('process-working')

        self._completer_word_list = ['']
        self._view = QWebView()
        self.verticalLayout.addWidget(self._view)
        if url is None:
            self.set_url("http://ros.org", True)
        else:
            self.set_url(url, False)

        self.url_lineedit.returnPressed.connect(self._handle_url_change)
        self._view.loadFinished[bool].connect(self._handle_load_finished)
        self.reload_button.clicked.connect(self._handle_reload_clicked)
        self._view.linkClicked.connect(self._handle_link_clicked)
        self._view.urlChanged[QUrl].connect(self._handle_url_changed)
Example #3
0
    def __init__(self, context):
        super(MyPlugin, self).__init__(context)
        # Give QObjects reasonable names
        self.setObjectName('MyPlugin')

        # Process standalone plugin command-line arguments
        from argparse import ArgumentParser
        parser = ArgumentParser()
        # Add argument(s) to the parser
        parser.add_argument("-q", "--quiet", action="store_true",
                            dest="quiet",
                            help="Put plugin in silent mode")
        args, unknowns = parser.parse_known_args(context.argv())
        if not args.quiet:
            print 'arguments: ', args
            print 'unknowns: ', unknowns

        # Create QWidget
        self._widget = QWidget()
        # Get path to UI file which should be in the "resource" folder of this package
        ui_file = os.path.join(rospkg.RosPack().get_path('rqt_mypkg'), 'resource', 'MyPlugin.ui')
        # Extend the widget with all atrributes and children from UI File
        loadUi(ui_file, self._widget)
        # Give QObjects reasonable names
        self._widget.setObjectName('MyPluginUi')
        # Show _widget.windowTitle on left-top of each plugin(when it's set in _widget).
        # This is useful when you open multiple plugins aat once. Also if you open multiple
        # instances of your plugin at once, these lines add number to make it easy to
        # tell from pane to pane.
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' %d' % context.serial_number()))
        # Add widget to the user interface
        context.add_widget(self._widget)
        self._widget.cancelButton.clicked[bool].connect(self._handle_cancel_clicked)
        self._widget.okButton.clicked[bool].connect(self._handle_ok_clicked)
    def __init__(self):
        super(WaypointWidget, self).__init__()
        # Give QObjects reasonable names
        try:
            rospy.wait_for_service('/proc_control/set_global_target', timeout=2)
            rospy.wait_for_service('/proc_navigation/set_depth_offset',timeout=2)
            rospy.wait_for_service('/proc_navigation/set_world_x_y_offset', timeout=2)
        except rospy.ROSException:
            False

        self.setObjectName('WaypointWidget')

        ui_file = os.path.join(rospkg.RosPack().get_path('rqt_waypoint'), 'resource', 'Mainwindow.ui')
        loadUi(ui_file, self)

        self.setObjectName('MyWaypointWidget')

        self._odom_subscriber = rospy.Subscriber('/proc_navigation/odom', Odometry, self._odom_callback)
        self.position_target_subscriber = rospy.Subscriber('/proc_control/current_target', PositionTarget,
                                                           self._position_target_callback)

        self.set_global_target = rospy.ServiceProxy('/proc_control/set_global_target', SetPositionTarget)
        self.set_initial_depth = rospy.ServiceProxy('/proc_navigation/set_depth_offset', SetDepthOffset)
        self.set_initial_position = rospy.ServiceProxy('/proc_navigation/set_world_x_y_offset', SetWorldXYOffset)

        self.xPositionTarget.returnPressed.connect(self.send_position)
        self.yPositionTarget.returnPressed.connect(self.send_position)
        self.zPositionTarget.returnPressed.connect(self.send_position)
        self.rollPositionTarget.returnPressed.connect(self.send_position)
        self.pitchPositionTarget.returnPressed.connect(self.send_position)
        self.yawPositionTarget.returnPressed.connect(self.send_position)

        self.actionReset_Depth.triggered.connect(self._reset_depth)
        self.actionReset_Position.triggered.connect(self._reset_position)
    def __init__(self, context=None):
        super(ExampleBtnGUI, self).__init__(context) # Initializes child and base 
        # Give QObjects reasonable names
        self.setObjectName('ExampleBtnGUI')
  
        # Create QWidget
        self._widget = QWidget()

        # Get path to UI file which is a sibling of this file        
        pkg_dir = roslib.packages.get_pkg_dir('example_button_gui')
        ui_file_path = os.path.join(pkg_dir, 'ui/example_button_gui.ui')


        # Extend the widget with all attributes and children from UI file
        loadUi(ui_file_path, self._widget)

        # Give QObjects reasonable names
        self._widget.setObjectName('ExampleBtnGUIUi')

        # Show _widget.windowTitle on left-top of each plugin (when 
     	# it's set in _widget). This is useful when you open multiple
	# plugins at once. Also if you open multiple instances of your 
	# plugin at once, these lines add number to make it easy to
	# tell from pane to pane.        
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))

        # Add widget to the user interface
        context.add_widget(self._widget)
    	
        # Now Set up our own interface:
        # ==> Connect the buttons to the functions. simpleBtnDemo is defined in ui/example_button_gui.ui
        self._widget.simpleBtnDemo.clicked.connect(self.btn_clicked_CB)
    def __init__(self, context,namespace = None):

        # it is either "" or the input given at creation of plugin
        self.namespace = self._parse_args(context.argv())


        super(saverPlugin, self).__init__(context)
        # Give QObjects reasonable names
        self.setObjectName('saverPlugin')

        # Process standalone plugin command-line arguments
        from argparse import ArgumentParser
        parser = ArgumentParser()
        # Add argument(s) to the parser.
        parser.add_argument("-q", "--quiet", action="store_true",
                      dest="quiet",
                      help="Put plugin in silent mode")
        args, unknowns = parser.parse_known_args(context.argv())
        if not args.quiet:
            print 'arguments: ', args
            print 'unknowns: ', unknowns
        
        
        
        # Create QWidget
        self._widget = QWidget()
        # Get path to UI file which is a sibling of this file
        # in this example the .ui and .py file are in the same folder
        ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'saver.ui')
        # Extend the widget with all attributes and children from UI file
        loadUi(ui_file, self._widget)
        # Give QObjects reasonable names
        self._widget.setObjectName('saverUi')
        # Show _widget.windowTitle on left-top of each plugin (when 
        # it's set in _widget). This is useful when you open multiple 
        # plugins at once. Also if you open multiple instances of your 
        # plugin at once, these lines add number to make it easy to 
        # tell from pane to pane.
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
        # Add widget to the user interface
        context.add_widget(self._widget)

        # ---------------------------------------------- #
        # ---------------------------------------------- #

        # BUTTON TO START EXPERIMENT
        self._widget.ButtonSTART_SIM.stateChanged.connect(self.StartSimulatorService)

        # Button to Reset Simulator
        self._widget.ResetSimulator.clicked.connect(self.ResetSimulator)

        # BUTTON TO CONNECT TO QUALISYS
        self._widget.Qualisys.stateChanged.connect(self.QualisysConnect)

        # BUTTON TO CHANGE ID
        self._widget.changeID.clicked.connect(self.changeID)

        # Default Value for Id of Quad (as in QUALISYS computer)
        self._widget.ID.setValue(13)
    def __init__(self, mode=rosmsg.MODE_MSG,
                 pkg_name='rqt_msg',
                 ui_filename='messages.ui'):
        """
        :param ui_filename: This Qt-based .ui file must have elements that are
                            referred from this class. Otherwise unexpected
                            errors are likely to happen. Best way to avoid that
                            situation when you want to give your own .ui file
                            is to implement all Qt components in
                            rqt_msg/resource/message.ui file.
        """

        super(MessagesWidget, self).__init__()
        self._rospack = rospkg.RosPack()
        ui_file = os.path.join(self._rospack.get_path(pkg_name), 'resource', ui_filename)
        loadUi(ui_file, self, {'MessagesTreeView': MessagesTreeView})
        self.setObjectName(ui_filename)
        self._mode = mode

        self._add_button.setIcon(QIcon.fromTheme('list-add'))
        self._add_button.clicked.connect(self._add_message)
        self._refresh_packages(mode)
        self._refresh_msgs(self._package_combo.itemText(0))
        self._package_combo.currentIndexChanged[str].connect(self._refresh_msgs)
        self._messages_tree.mousePressEvent = self._handle_mouse_press

        self._browsers = []
	def __init__(self):
		QWidget.__init__(self)
		rp = rospkg.RosPack()
		ui_file = os.path.join(rp.get_path('rqt_bag_annotation'), 'resource', 'export_widget.ui')
		loadUi(ui_file, self)

		self.add_topic_button.setIcon(QIcon.fromTheme('list-add'))
		self.remove_topic_button.setIcon(QIcon.fromTheme('list-remove'))
		self.refresh_button.setIcon(QIcon.fromTheme('view-refresh'))

		self.add_topic_button.clicked[bool].connect(self._handle_add_topic_clicked)
		self.remove_topic_button.clicked[bool].connect(self._handle_remove_topic_clicked)
		self.refresh_button.clicked[bool].connect(self._handle_refresh_clicked)
		self.export_button.clicked[bool].connect(self._handle_export_clicked)

		self.export_location_edit.setPlainText("./export_file.txt")
		self.rospack = rospkg.RosPack()

		self._exported_topics = list()
		self._exported_publisher_info = list()
		self._annotations = list()
		self._active_topics = list()
		self._dt = 0.1

		self._current_topic_paths = dict()
		self._current_msg_paths = dict()
		self._id_counter = 0
		self.current_output = ""
Example #9
0
    def __init__(self, context):
        super(Shooter, self).__init__(context)

        # Create the widget and name it
        self._widget = QtGui.QWidget()
        self._widget.setObjectName("Shooter")
        self.setObjectName("Shooter")

        # Extend the widget with all attributes and children in the UI file
        ui_file = os.path.join(rospkg.RosPack().get_path("navigator_gui"), "resource", "shooter.ui")
        loadUi(ui_file, self._widget)

        self.remote = RemoteControl("shooter gui")
        self.remote.is_timed_out = True

        self.shooter_status = {
            "received": "Unknown",
            "stamp": rospy.Time.now(),
            "cached": "Unknown"
        }

        self.disc_speed_setting = 0

        self.connect_ui()

        rospy.Subscriber("/shooter/status", String, self.cache_shooter_status)

        # Show _widget.windowTitle on left-top of each plugin (when it's set in _widget). This is useful when you open multiple
        # plugins at once. Also if you open multiple instances of your plugin at once, these lines add number to make it easy to
        # tell from pane to pane.
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (" (%d)" % context.serial_number()))

        # Add widget to the user interface
        context.add_widget(self._widget)
Example #10
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        loadUi(os.path.join(path, 'resources', 'part.ui'), self)

        self.pub_marker_array = rospy.Publisher(
            'visualization_marker_array', MarkerArray, queue_size=10)

        self.btnLoad.clicked.connect(self.btnLoadClicked)
        self.btnProcessMesh.clicked.connect(self.btnProcessMeshClicked)
        self.btnLayers.clicked.connect(self.btnLayersClicked)
        self.btnAcceptPath.clicked.connect(self.btnAcceptPathClicked)

        self.sbStart.valueChanged.connect(self.changeLayers)
        self.sbStop.valueChanged.connect(self.changeLayers)

        self.sbPositionX.valueChanged.connect(self.changePosition)
        self.sbPositionY.valueChanged.connect(self.changePosition)
        self.sbPositionZ.valueChanged.connect(self.changePosition)

        self.sbSizeX.valueChanged.connect(self.changeSize)
        self.sbSizeY.valueChanged.connect(self.changeSize)
        self.sbSizeZ.valueChanged.connect(self.changeSize)

        self.processing = False
        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.updateProcess)

        self.robpath = RobPath()
 def __init__(self, parent = None):
     super(SegmentationParameterDialog, self).__init__(parent)
     self.setObjectName('Segmentation Parameter')
     # Get path to UI file which should be in the "resource" folder of this package
     ui_file = os.path.join(rospkg.RosPack().get_path('ni_vision_gui'), 'resource', 'SegmentationParameterDialog.ui')
     # Extend the widget with all attributes and children from UI file
     loadUi(ui_file, self)
  def __init__(self, pr2_interface):

    super(ConnectionWindowManager, self).__init__(pr2_interface)

    # Get path to UI file which should be in the "resource" folder of this package
    ui_file = os.path.join(
        rospkg.RosPack().get_path(
            'rqt_pr2_hand_syntouch_sensor_interface'), 'resource', 'connectioninfo.ui')

    # Extend the widget with all attributes and children from UI file
    loadUi(ui_file, self._widget)

    # Give QObjects reasonable names
    self._widget.setObjectName('ConnectionInfoWindow')

    self._widget.setWindowTitle(
        'Connection Info')

    # Add widget to the user interface
    user_interface = pr2_interface.get_user_interface()
    user_interface.add_widget(self._widget)

    # Since this window has text that needs to be updated in real time
    # A thread will need to be created that will handle updating the 
    # labels.
    self._worker = threading.Thread(target=self.update_labels)
    self._worker.start()
Example #13
0
  def __init__(self):
    print('constructor')
    # Init QWidget
    super(CalibWidget, self).__init__()
    self.setObjectName('CalibWidget')

    # load UI
    ui_file = os.path.join(rospkg.RosPack().get_path('dvs_calibration_gui'), 'resource', 'widget.ui')
    loadUi(ui_file, self)

    # init and start update timer for data, the timer calls the function update_info all 40ms    
    self._update_info_timer = QTimer(self)
    self._update_info_timer.timeout.connect(self.update_info)
    self._update_info_timer.start(40)

    self.button_reset.pressed.connect(self.on_button_reset_pressed)
    self.button_start.pressed.connect(self.on_button_start_calibration_pressed)
    self.button_save.pressed.connect(self.on_button_save_calibration_pressed)
    
    self._sub_pattern_detections = rospy.Subscriber('dvs_calibration/pattern_detections', Int32, self.pattern_detections_cb)    
    self._sub_calibration_output = rospy.Subscriber('dvs_calibration/output', String, self.calibration_output_cb)

    print('reset')

    self.on_button_reset_pressed()
    
    print('reset done')
  def __init__(self, pr2_interface):

    super(ObjectHandoffWindowManager, self).__init__(pr2_interface)

    # Get path to UI file which should be in the "resource" folder of this package
    ui_file = os.path.join(
        rospkg.RosPack().get_path(
            'rqt_pr2_hand_syntouch_sensor_interface'), 'resource',
            'objecthandoff.ui')

    # Extend the widget with all attributes and children from UI file
    loadUi(ui_file, self._widget)

    # Give QObjects reasonable names
    self._widget.setObjectName('ObjectHandoff')

    self._widget.setWindowTitle('Object Handoff Using PR2 Arm')

    # Add widget to the user interface
    user_interface = pr2_interface.get_user_interface()
    user_interface.add_widget(self._widget)

    self._widget.OutputTextBox.document().setPlainText(
        'Object should already be in the PR2 gripper\'s fingers. Press the \
         button to begin waiting for socially acceptable hand off.')

    # Register a listener for the Hand Off button.
    # TODO: Rename button from PlaceButton to HandOff button.
    self._widget.PlaceButton.clicked.connect(self._handle_hand_off_button_clicked)
    def __init__(self, plugin):
        super(Theta360ViewWidget, self).__init__()
        rp = rospkg.RosPack()
        ui_file = os.path.join(rp.get_path('theta_viewer'), 'resource', 'Theta360ViewWidget.ui')
        loadUi(ui_file, self)
        self.plugin = plugin

        self.position = (0.0, 0.0, 0.0)
        self.orientation = quaternion_about_axis(0.0, (1.0, 0.0, 0.0))
        self.topicName = None
        self.subscriber = None

        # create GL view
        self._glview = MyGLWidget()
        self._glview.setAcceptDrops(True)

        # backup and replace original paint method
        # self.glView.paintGL is callbacked from QGLWidget
        self._glview.paintGL_original = self._glview.paintGL
        self._glview.paintGL = self.glview_paintGL

        # backup and replace original mouse release method
        self._glview.mouseReleaseEvent_original = self._glview.mouseReleaseEvent
        self._glview.mouseReleaseEvent = self.glview_mouseReleaseEvent

        # add GL view to widget layout
        self.layout().addWidget(self._glview)

        # init and start update timer with 40ms (25fps)
        # updateTimeout is called with interval time
        self.update_timer = QTimer(self)
        self.update_timer.timeout.connect(self.update_timeout)
        self.update_timer.start(40)
        self.cnt = 0
Example #16
0
    def __init__(self, context):
        super(utilityPlugin, self).__init__(context)
        # Give QObjects reasonable names
        self.setObjectName("utilityPlugin")

        # Process standalone plugin command-line arguments
        from argparse import ArgumentParser

        parser = ArgumentParser()
        # Add argument(s) to the parser.
        parser.add_argument("-q", "--quiet", action="store_true", dest="quiet", help="Put plugin in silent mode")
        args, unknowns = parser.parse_known_args(context.argv())
        if not args.quiet:
            print "arguments: ", args
            print "unknowns: ", unknowns

        # Create QWidget
        self._widget = QWidget()
        # Get path to UI file which is a sibling of this file
        # in this example the .ui and .py file are in the same folder
        ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), "utility.ui")
        # Extend the widget with all attributes and children from UI file
        loadUi(ui_file, self._widget)
        # Give QObjects reasonable names
        self._widget.setObjectName("utilityUi")
        # Show _widget.windowTitle on left-top of each plugin (when
        # it's set in _widget). This is useful when you open multiple
        # plugins at once. Also if you open multiple instances of your
        # plugin at once, these lines add number to make it easy to
        # tell from pane to pane.
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (" (%d)" % context.serial_number()))
        # Add widget to the user interface
        context.add_widget(self._widget)

        self.ID = 0

        self.State = QuadPositionDerived()
        self.Target = QuadPositionDerived()
        self.sub = ""
        self.name = ""
        self.pwd = os.environ["PWD"]

        self._widget.IrisInputBox.insertItems(0, ["iris1", "iris2", "iris3", "iris4", "iris5"])
        self._widget.bStart.clicked.connect(self.Start)
        self._widget.GravityCancelButton.clicked.connect(self.adjust_gravity_cancel)

        self._widget.XBox.setMinimum(-10.0)
        self._widget.XBox.setMaximum(10.0)
        self._widget.XBox.setSingleStep(0.1)
        self._widget.YBox.setMinimum(-10.0)
        self._widget.YBox.setMaximum(10.0)
        self._widget.YBox.setSingleStep(0.1)
        self._widget.ZBox.setMinimum(-10.0)
        self._widget.ZBox.setMaximum(10.0)
        self._widget.ZBox.setSingleStep(0.1)
        self._widget.GravitySpinBox.setMaximum(1800)
        self._widget.GravitySpinBox.setMinimum(1200)
        self._widget.GravitySpinBox.setSingleStep(10)
        self._widget.GravitySpinBox.setValue(1500)
    def __init__(self):
        super(IdSelectorWidget, self).__init__()
        self.setObjectName('IdSelectorWidget')

        # Get path to UI file which should be in the "resource" folder of this package
        pkg_path = rospkg.RosPack().get_path('rqt_tracker_id_selector')
        ui_file = os.path.join(pkg_path, 'resource', 'IdSelector.ui')
        # Extend the widget with all attributes and children from UI file
        loadUi(ui_file, self)

        self.labels = ["ID","label"]
        self.id_table.setColumnCount(len(self.labels))
        self.id_table.setHorizontalHeaderLabels(self.labels)
        self.lineEdit.setText("~/labels.yaml")

        self.sub_traj = rospy.Subscriber("tracking/lk2d/points", Point2dArray,
                                         self.cb_points, queue_size=10)
        self.sub_traj = rospy.Subscriber("tracking/lk3d/points", Point3dArray,
                                         self.cb_points3d, queue_size=10)
        self.sub_img = rospy.Subscriber("/camera/rgb/image_color", Image,
                                        self.cb_img, queue_size=1)
        self.pub_img = rospy.Publisher("tracking/selected_tracks",Image,queue_size=1)
        self.pub_marker = rospy.Publisher("trajectory_marker",MarkerArray,queue_size=1)
        
        self.bridge = CvBridge()
        self.img = None
        
        self.ids = {}
        self.tracks = defaultdict(list)
        self.tracks3d = defaultdict(list)
        self.select = []
Example #18
0
    def __init__(self, plugin):
        super(PoseViewWidget, self).__init__()
        rp = rospkg.RosPack()
        ui_file = os.path.join(rp.get_path('rqt_pose_view'), 'resource', 'PoseViewWidget.ui')
        loadUi(ui_file, self)
        self._plugin = plugin

        self._position = (0.0, 0.0, 0.0)
        self._orientation = quaternion_about_axis(0.0, (1.0, 0.0, 0.0))
        self._topic_name = None
        self._subscriber = None

        # create GL view
        self._gl_view = GLWidget()
        self._gl_view.setAcceptDrops(True)

        # backup and replace original paint method
        self._gl_view.paintGL_original = self._gl_view.paintGL
        self._gl_view.paintGL = self._gl_view_paintGL

        # backup and replace original mouse release method
        self._gl_view.mouseReleaseEvent_original = self._gl_view.mouseReleaseEvent
        self._gl_view.mouseReleaseEvent = self._gl_view_mouseReleaseEvent

        # add GL view to widget layout
        self.layout().addWidget(self._gl_view)

        # init and start update timer with 40ms (25fps)
        self._update_timer = QTimer(self)
        self._update_timer.timeout.connect(self.update_timeout)
        self._update_timer.start(40)
    def __init__(self, parent, rospack, signal_msg=None):
        """
        @param signal_msg: Signal to carries a system msg that is shown on GUI.
        @type signal_msg: QtCore.Signal
        """
        super(NodeSelectorWidget, self).__init__()
        self._parent = parent
        self.stretch = None
        self._signal_msg = signal_msg

        ui_file = os.path.join(rospack.get_path('rqt_reconfigure'), 'resource',
                               'node_selector.ui')
        loadUi(ui_file, self)

        # List of the available nodes. Since the list should be updated over
        # time and we don't want to create node instance per every update
        # cycle, This list instance should better be capable of keeping track.
        self._nodeitems = OrderedDict()
        # Dictionary. 1st elem is node's GRN name,
        # 2nd is TreenodeQstdItem instance.
        # TODO: Needs updated when nodes list updated.

        #  Setup treeview and models
        self._item_model = TreenodeItemModel()
        self._rootitem = self._item_model.invisibleRootItem()  # QStandardItem

        self._nodes_previous = None

        # Calling this method updates the list of the node.
        # Initially done only once.
        self._update_nodetree_pernode()

        # TODO(Isaac): Needs auto-update function enabled, once another
        #             function that updates node tree with maintaining
        #             collapse/expansion  state. http://goo.gl/GuwYp can be a
        #             help.

        self._collapse_button.pressed.connect(
                                          self._node_selector_view.collapseAll)
        self._expand_button.pressed.connect(self._node_selector_view.expandAll)

        # Filtering preparation.
        self._proxy_model = FilterChildrenModel(self)
        self._proxy_model.setDynamicSortFilter(True)
        self._proxy_model.setSourceModel(self._item_model)
        self._node_selector_view.setModel(self._proxy_model)
        self._filterkey_prev = ''

        # This 1 line is needed to enable horizontal scrollbar. This setting
        # isn't available in .ui file.
        # Ref. http://stackoverflow.com/a/6648906/577001
        self._node_selector_view.header().setResizeMode(
                                              0, QHeaderView.ResizeToContents)

        # Setting slot for when user clicks on QTreeView.
        self.selectionModel = self._node_selector_view.selectionModel()
        # Note: self.selectionModel.currentChanged doesn't work to deselect
        # a treenode as expected. Need to use selectionChanged.
        self.selectionModel.selectionChanged.connect(
                                                  self._selection_changed_slot)
    def __init__(self, parentfilter, rospack, time_range_provider):
        """
        Widget for displaying interactive data related to time filtering.
        :param parentfilter: buddy filter were data is stored, ''TimeFilter''
        :param display_list_args: single element list containing one tuple with
        the min and max time to be displayed, ''list of tuple''
        """
        super(TimeFilterWidget, self).__init__()
        ui_file = os.path.join(rospack.get_path('rqt_console'), 'resource/filters', 'time_filter_widget.ui')
        loadUi(ui_file, self)
        self.setObjectName('TimeFilterWidget')
        self._parentfilter = parentfilter  # When data is changed it is stored in the parent filter

        self.start_datetime.dateTimeChanged[QDateTime].connect(self.handle_start_changed)
        self.stop_datetime.dateTimeChanged[QDateTime].connect(self.handle_stop_changed)
        self.stop_enabled_check_box.clicked[bool].connect(self.handle_stop_enabled_changed)

        # Times are passed in unixtimestamp '.' decimal fraction of a second
        mintime, maxtime = time_range_provider()
        if mintime != -1:
            mintime = str(mintime).split('.')
            maxtime = str(maxtime).split('.')

            time = QDateTime()
            time.setTime_t(int(mintime[0]))
            mintime = time.addMSecs(int(str(mintime[1]).zfill(9)[:3]))
            self.start_datetime.setDateTime(mintime)
            time.setTime_t(int(maxtime[0]))
            maxtime = time.addMSecs(int(str(maxtime[1]).zfill(9)[:3]))
            self.stop_datetime.setDateTime(maxtime)
        else:
            self.start_datetime.setDateTime(datetime.now())
            self.stop_datetime.setDateTime(datetime.now())
    def __init__(self, context):
        super(CalibrationControl, self).__init__(context)
        self.setObjectName('CalibrationControl')
        
        
        # Argument parsing
        from argparse import ArgumentParser
        parser = ArgumentParser()
        # Add argument(s) to the parser.
        parser.add_argument("-q", "--quiet", action="store_true",
                      dest="quiet",
                      help="Put plugin in silent mode")
        args, unknowns = parser.parse_known_args(context.argv())
        if not args.quiet:
            print 'arguments: ', args
            print 'unknowns: ', unknowns

        # Create QWidget
        self._widget = QWidget()
        # Get path to UI file which is a sibling of this file
        rp = rospkg.RosPack()
        ui_file = os.path.join(rp.get_path('industrial_calibration_gui'), 'resource', 'calibration_control.ui')
        loadUi(ui_file, self._widget)
        # Give QObjects reasonable names
        self._widget.setObjectName('calibration_control_Ui')
        
        # Custom code begins here
        self._widget.cal_button.clicked[bool].connect(self.__handle_cal_clicked)
        
        self.cal_service = rospy.ServiceProxy('calibration_service', Empty)
        
        # Add widget to the user interface
        context.add_widget(self._widget)
Example #22
0
    def __init__(self, min_val, max_val):
        super(DoubleEditor, self).__init__()

        # Preconditions
        assert min_val < max_val

        # Cache values
        self._min_val = min_val
        self._max_val = max_val

        # Load editor UI
        rp = rospkg.RosPack()
        ui_file = os.path.join(rp.get_path('rqt_joint_trajectory_controller'),
                               'resource', 'double_editor.ui')
        loadUi(ui_file, self)

        # Setup widget ranges and slider scale factor
        self.slider.setRange(0, 100)
        self.slider.setSingleStep(1)
        self._scale = (max_val - min_val) / \
                      (self.slider.maximum() - self.slider.minimum())
        self.spin_box.setRange(min_val, max_val)
        self.spin_box.setSingleStep(self._scale)

        # Couple slider and spin box together
        self.slider.valueChanged.connect(self._on_slider_changed)
        self.spin_box.valueChanged.connect(self._on_spinbox_changed)

        # Ensure initial sync of slider and spin box
        self._on_spinbox_changed()
    def __init__(self, parentfilter, rospack, item_providers):
        super(CustomFilterWidget, self).__init__()
        ui_file = os.path.join(rospack.get_path('rqt_console'), 'resource/filters', 'custom_filter_widget.ui')
        loadUi(ui_file, self)
        self.setObjectName('CustomFilterWidget')
        self._parentfilter = parentfilter  # When data is changed it is stored in the parent filter

        # keep color for highlighted items even when not active
        for list_widget in [self.severity_list, self.node_list, self.topic_list]:
            active_color = list_widget.palette().brush(QPalette.Active, QPalette.Highlight).color().name()
            list_widget.setStyleSheet('QListWidget:item:selected:!active { background: %s; }' % active_color)

        # Text Filter Initialization
        self.text_edit.textChanged.connect(self.handle_text_changed)
        self.regex_check_box.clicked[bool].connect(self.handle_regex_clicked)
        self.handle_text_changed()

        # Severity Filter Initialization
        self.severity_list.itemSelectionChanged.connect(self.handle_severity_item_changed)
        new_items = item_providers[0]()
        for key in sorted(new_items.keys()):
            item = new_items[key]
            self.severity_list.addItem(item)
            self.severity_list.item(self.severity_list.count() - 1).setData(Qt.UserRole, key)

        # Node Filter Initialization
        self._node_list_populate_function = item_providers[1]
        self.node_list.itemSelectionChanged.connect(self.handle_node_item_changed)

        # Topic Filter Initialization
        self._topic_list_populate_function = item_providers[2]
        self.topic_list.itemSelectionChanged.connect(self.handle_topic_item_changed)

        self.repopulate()
Example #24
0
    def __init__(self, context):
        super(MyPlugin, self).__init__(context)
        # Give QObjects reasonable names
        self.setObjectName('MyPlugin')

        # Process standalone plugin command-line arguments
        from argparse import ArgumentParser
        parser = ArgumentParser()
        # Add argument(s) to the parser.
        parser.add_argument("-q", "--quiet", action="store_true",
                      dest="quiet",
                      help="Put plugin in silent mode")
        args, unknowns = parser.parse_known_args(context.argv())
        if not args.quiet:
            print 'arguments: ', args
            print 'unknowns: ', unknowns

        # Create QWidget
        self._widget = QWidget()
        # Get path to UI file which is a sibling of this file
        # in this example the .ui and .py file are in the same folder
        ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'MyPlugin.ui')
        # Extend the widget with all attributes and children from UI file
        loadUi(ui_file, self._widget)
        # Give QObjects reasonable names
        self._widget.setObjectName('MyPluginUi')
        # Show _widget.windowTitle on left-top of each plugin (when 
        # it's set in _widget). This is useful when you open multiple 
        # plugins at once. Also if you open multiple instances of your 
        # plugin at once, these lines add number to make it easy to 
        # tell from pane to pane.
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
        # Add widget to the user interface
        context.add_widget(self._widget)
    def __init__(self, context):
        Plugin.__init__(self, context)
        self.setObjectName('RqtGraspViewer')

        self._widget = QWidget()

        ui_file = os.path.join(rospkg.RosPack().get_path('rqt_grasp_viewer'), 'ui', 'RqtGraspViewer.ui')
        loadUi(ui_file, self._widget)
        self._widget.setObjectName('RqtGraspViewerUi')
        context.add_widget(self._widget)

        main_layout = QHBoxLayout()
        self._default_labels = ["obj_id", "object", "grasp_id", "grasp", "quality"]
        self._filemodel = QStandardItemModel(0, 5)
        self._filemodel.setHorizontalHeaderLabels(self._default_labels)

        self._table_view = QTableView()
        self._table_view.setModel(self._filemodel)
        self._table_view.resizeColumnsToContents()

        main_layout.addWidget(self._table_view)
        self._widget.scrollarea.setLayout(main_layout)

        self.init_services()
        self.init_subscribers()

        # self._table_view.clicked.connect(self.on_table_view_clicked)
        self._table_view.selectionModel().selectionChanged.connect(self.on_table_view_select)
Example #26
0
    def __init__(self, context):
        name = "SimMan"
        resource = os.path.join(os.path.dirname(
                        os.path.realpath(__file__)), 
                        "resource/" + name + ".ui")
        GuiT = SimManGui
        RosT = SimManROS
        
        super(SimManRqt, self).__init__(context)
        self.setObjectName(name)

        from argparse import ArgumentParser
        parser = ArgumentParser()
        parser.add_argument("-q", "--quiet", action="store_true",
                      dest="quiet",
                      help="Put plugin in silent mode")
        args, unknowns = parser.parse_known_args(context.argv())
        if not args.quiet:
            print "arguments: ", args
            print "unknowns: ", unknowns

        # Create QWidget
        self._gui = GuiT()
        self._ros = RosT()

        loadUi(resource, self._gui)
        self._ros.setup(self._gui)
        self._gui.setup(name + "Rqt", self._ros)

        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + 
                                        (" (%d)" % context.serial_number()))
        context.add_widget(self._gui) 
  def __init__(self, pr2_interface):
    # Initialize the WindowManager base class. The WindowManager class
    # creates the _widget object that will be used by this window and
    # guarantees successful shutdown of rqt upon program termination.
    super(SensorWindowManager, self).__init__(pr2_interface)

    # Keep track of the lowest and highest value received so far to use for
    # graphing relative sensor intensity.
    self._low_data_values = {'force':None, 'fluid_pressure':None, 'microvibration':None,
                             'temperature':None, 'thermal_flux':None}
    self._high_data_values = {'force':None, 'fluid_pressure':None, 'microvibration':None,
                             'temperature':None, 'thermal_flux':None}

    # Get path to UI file which should be in the "resource" folder of this package
    ui_file = os.path.join(
        rospkg.RosPack().get_path(
            'rqt_pr2_hand_syntouch_sensor_interface'), 'resource', 'sensorvisualizer.ui')

    # Extend the widget with all attributes and children from UI file
    loadUi(ui_file, self._widget)

    # Give QObjects reasonable names
    self._widget.setObjectName('SensorVisualizerWindow')

    self._widget.setWindowTitle('Sensor Visualizer')

    # Add widget to the user interface
    user_interface = pr2_interface.get_user_interface()
    user_interface.add_widget(self._widget)

    # Create a thread that will update the sensor visualization bar graph.
    self._worker = threading.Thread(target=self.draw_bar_graphs)
    self._worker.start()
Example #28
0
 def __init__(self, topics):
     super(HistogramPlotWidget, self).__init__()
     self.setObjectName('HistogramPlotWidget')
     rp = rospkg.RosPack()
     ui_file = os.path.join(rp.get_path('jsk_rqt_plugins'), 
                            'resource', 'plot_histogram.ui')
     loadUi(ui_file, self)
     self.cv_bridge = CvBridge()
     self.subscribe_topic_button.setIcon(QIcon.fromTheme('add'))
     self.pause_button.setIcon(QIcon.fromTheme('media-playback-pause'))
     self.clear_button.setIcon(QIcon.fromTheme('edit-clear'))
     self.data_plot = MatHistogramPlot(self)
     self.data_plot_layout.addWidget(self.data_plot)
     self._topic_completer = TopicCompleter(self.topic_edit)
     self._topic_completer.update_topics()
     self.topic_edit.setCompleter(self._topic_completer)
     self.data_plot.dropEvent = self.dropEvent
     self.data_plot.dragEnterEvent = self.dragEnterEvent
     self._start_time = rospy.get_time()
     self._rosdata = None
     if len(topics) != 0:
         self.subscribe_topic(topics)
     self._update_plot_timer = QTimer(self)
     self._update_plot_timer.timeout.connect(self.update_plot)
     self._update_plot_timer.start(self._redraw_interval)
    def __init__(self, context):
        super(RQTNavigation, self).__init__(context)
        # Give QObjects reasonable names
        self.setObjectName('Navigation')

        # Create QWidget
        self._widget = QWidget()
        ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'rqt_navigation.ui')
        loadUi(ui_file, self._widget)
        self._widget.setObjectName('rqt_navigation')
        # Show _widget.windowTitle on left-top of each plugin (when 
        # it's set in _widget). This is useful when you open multiple 
        # plugins at once. Also if you open multiple instances of your 
        # plugin at once, these lines add number to make it easy to 
        # tell from pane to pane.
        
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
        # Add widget to the user interface
        context.add_widget(self._widget)
        self.loadComboBoxItems()

        # ROS stuff
        self.veh = rospy.get_param('/veh')
        self.topic_name = '/' + self.veh + '/actions_dispatcher_node/plan_request'
        self.pub = rospy.Publisher(self.topic_name,SourceTargetNodes, queue_size = 1, latch=True)
        self._widget.buttonFindPlan.clicked.connect(self.requestPlan)
    def __init__(self):
        super(MainWidget, self).__init__()
        self.setObjectName('MainWidget')

        rospack = rospkg.RosPack()
        ui_file = rospack.get_path('rqt_joint_trajectory_plot')+'/resource/JointTrajectoryPlot.ui'
        loadUi(ui_file, self)

        self.refresh_button.setIcon(QIcon.fromTheme('reload'))
        self.pause_button.setIcon(QIcon.fromTheme('media-playback-pause'))

        self.handler = None
        self.joint_names = []
        self.timer = QTimer(self)
        self.timer.timeout.connect(self.update)
        self.plot_widget = PlotWidget(self)
        self.plot_layout.addWidget(self.plot_widget)
        self.draw_curves.connect(self.plot_widget.draw_curves)

        self.time = None
        (self.dis, self.vel, self.acc, self.eff) = ({}, {}, {}, {})

        # refresh topics list in the combobox
        self.refresh_topics()
        self.change_topic()

        self.refresh_button.clicked.connect(self.refresh_topics)
        self.topic_combox.currentIndexChanged.connect(self.change_topic)
        self.select_tree.itemChanged.connect(self.update_checkbox)
Example #31
0
    def __init__(self, parent):
        '''
        @type parent: LaunchMain
        '''
        super(LaunchWidget, self).__init__()
        self._parent = parent

        self._config = None

        #TODO: should be configurable from gui
        self._port_roscore = 11311

        self._run_id = None

        self._rospack = rospkg.RosPack()
        ui_file = os.path.join(self._rospack.get_path('rqt_launch'),
                               'resource', 'launch_widget.ui')
        loadUi(ui_file, self)

        # row=0 allows any number of rows to be added.
        self._datamodel = QStandardItemModel(0, 1)

        master_uri = rosenv.get_master_uri()
        rospy.loginfo('LaunchWidget master_uri={}'.format(master_uri))
        self._delegate = NodeDelegate(master_uri, self._rospack)
        self._treeview.setModel(self._datamodel)
        self._treeview.setItemDelegate(self._delegate)

        # NodeController used in controller class for launch operation.
        self._node_controllers = []

        self._pushbutton_start_all.clicked.connect(self._parent.start_all)
        self._pushbutton_stop_all.clicked.connect(self._parent.stop_all)
        # Bind package selection with .launch file selection.
        self._combobox_pkg.currentIndexChanged[str].connect(
            self._refresh_launchfiles)
        # Bind a launch file selection with launch GUI generation.
        self._combobox_launchfile_name.currentIndexChanged[str].connect(
            self._load_launchfile_slot)
        self._update_pkgs_contain_launchfiles()

        # Used for removing previous nodes
        self._num_nodes_previous = 0
Example #32
0
 def __init__(self, parent=None):
     '''
     Creates the window, connects the signals and init the class.
     '''
     QDockWidget.__init__(self, parent)
     self._log_debug_count = 0
     self._log_info_count = 0
     self._log_warn_count = 0
     self._log_err_count = 0
     self._log_fatal_count = 0
     # load the UI file
     log_dock_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'LogDockWidget.ui')
     loadUi(log_dock_file, self)
     self.setObjectName("LogWidget")
     self.setFeatures(QDockWidget.DockWidgetFloatable | QDockWidget.DockWidgetMovable | QDockWidget.DockWidgetClosable)
     # connect to the button signals
     self.clearCloseButton.clicked.connect(self._on_log_clear_close_clicked)
     self.closeButton.clicked.connect(self.hide)
     # initialize the listener to the rosout topic
     self._rosout_listener = RosoutListener()
     self._rosout_listener.rosdebug_signal.connect(self._on_roslog_debug)
     self._rosout_listener.rosinfo_signal.connect(self._on_roslog_info)
     self._rosout_listener.roswarn_signal.connect(self._on_roslog_warn)
     self._rosout_listener.roserr_signal.connect(self._on_roslog_err)
     self._rosout_listener.rosfatal_signal.connect(self._on_roslog_fatal)
     self._rosout_listener.registerByROS()
     self._enable_info_on_start = False
     if self._enable_info_on_start:
         try:
             service_name = "%s/get_loggers" % rospy.get_name()
             log_level_srvs = rospy.ServiceProxy(service_name, GetLoggers)
             resp = log_level_srvs()
             for logger in resp.loggers:
                 if logger.name == 'rosout':
                     if logger.level == 'DEBUG':
                         self.checkBox_debug.setChecked(True)
                         self.checkBox_info.setChecked(True)
                     elif logger.level == 'INFO':
                         self.checkBox_info.setChecked(True)
                     break
         except rospy.ServiceException, e:
             err_msg = "Service call '%s' failed: %s" % (service_name, utf8(e))
             rospy.logwarn(err_msg)
Example #33
0
 def __init__(self, parent):
     """! The constructor."""
     
     QWidget.__init__(self)
     # Extend the widget with all attributes and children from UI file
     loadUi(R.layouts.remove_account_widget, self)
     
     self._context = parent.getContext()
     self._lng = self._context.getLanguage()
     
     self.user_list_label.setText(R.values.strings.user_list(self._lng))
     self.remove_button.setText(R.values.strings.ok(self._lng))
     
     self.connect(self.remove_button, SIGNAL("clicked()"),
                   self.remove_account)
      
     self._accounts = UserAccounts()
      
     self.users_list_combo.addItems(self._accounts.user_list())
    def __init__(self, timeline, parent, topic):
        super(AnnotatorPlugin, self).__init__(timeline, parent, topic)
        rp = rospkg.RosPack()
        self._timeline = timeline
        self._message_stamp = None
        self._bag = None
        self.msg = None
        self._topic = None
        self._annotator_widget = QWidget()
        self.instance = vlc.Instance()
        self.mediaplayer = self.instance.media_player_new()
        self.isPaused = False

        ui_file = os.path.join(rp.get_path('rqt_bag_meri_annotator'),
                               'resource', 'MeriPlugin.ui')
        loadUi(ui_file, self._annotator_widget)
        self._annotator_widget.setObjectName('MeriPluginUi')
        self._annotator_widget.BtnAnnotator1.clicked.connect(self.btnClicked)
        parent.layout().addWidget(self._annotator_widget)
Example #35
0
    def __init__(self):
        super(SkirosWidget, self).__init__()
        self.setObjectName('SkirosWidget')
        ui_file = os.path.join(rospkg.RosPack().get_path('skiros2_gui'), 'src/skiros2_gui/core', 'skiros_gui.ui')
        loadUi(ui_file, self)

        self.skill_tree_widget.currentItemChanged.connect(lambda: self.on_skill_tree_widget_item_selection_changed(self.skill_tree_widget.currentItem()))
        self.wm_tree_widget.itemSelectionChanged.connect(lambda: self.on_wm_tree_widget_item_selection_changed(self.wm_tree_widget.currentItem()))
        self.wm_properties_widget.itemChanged.connect(lambda p: self.on_properties_table_item_changed(self.wm_tree_widget.currentItem(), p.row()))
        self.wm_relations_widget.resizeEvent = self.on_wm_relations_widget_resized
        self.wm_update_signal.connect(lambda d: self.on_wm_update(d))
        self.task_progress_signal.connect(lambda d: self.on_progress_update(d))

        self.tableWidget_output.setColumnWidth(0, 60)
        self.tableWidget_output.setColumnWidth(1, 120)
        self.tableWidget_output.setColumnWidth(2, 120)
        self.tableWidget_output.setColumnWidth(3, 60)
        self.tableWidget_output.setColumnWidth(4, 40)
        self.reset()
Example #36
0
    def onCreate(self, param):
        """ Load and sets your GUI components and variables declaration.
        @param param: C{Parameters}
        
        onCreate set the parameters from the plugin_descriptor.xml (params element) from the airbus_cobot_gui config ($MY_COBOT_GUI.conf)
        
        Example:
        # Parameters provider
        my_param = param.getParam($MY_PARAM_NAME, $MY_DEFAULT_VALUE)
        
        # Ros topics declaration
        self._my_sub = None # Sets subcriber instance in onResume()
        self._my_pub = None # Sets publisher instance in onResume()
        """
        # Load ui file
        loadUi(R.layouts.mainwindow, self)

        # Set default style sheet
        self.title_label.setStyleSheet(R.values.styles.hello)
    def _init_plugin(self, context):
        self.setObjectName("DSD-Visualization")

        self._widget = QWidget()
        self._widget.setObjectName(self.objectName())

        # load qt ui definition from file
        ui_file = os.path.join(get_package_share_directory("dynamic_stack_decider_visualization"), "resource", "StackmachineViz.ui")
        loadUi(ui_file, self._widget, {"InteractiveGraphicsView": InteractiveGraphicsView})

        # initialize qt scene
        self._scene = QGraphicsScene()
        self._scene.setBackgroundBrush(Qt.white)
        self._widget.graphics_view.setScene(self._scene)

        # Bind fit-in-view button
        self._widget.fit_in_view_push_button.setIcon(QIcon.fromTheme('zoom-original'))
        self._widget.fit_in_view_push_button.pressed.connect(self.fit_in_view)

        # Fit-in-view on checkbox toggle
        self._widget.auto_fit_graph_check_box.toggled.connect(self.fit_in_view)

        # Freezing
        def toggle_freeze():
            self.freeze = not self.freeze
            self.refresh()

        self._widget.freeze_push_button.toggled.connect(toggle_freeze)

        # Exporting and importing
        self._widget.save_as_svg_push_button.pressed.connect(self.save_svg_to_file)

        # Fill choices for dsd_selector and bind on_select
        self._widget.dsd_selector_combo_box.addItem("Select DSD...")
        for choice in self.locations:
            self._widget.dsd_selector_combo_box.addItem(choice['display_name'])
        self._widget.dsd_selector_combo_box.currentTextChanged.connect(self.set_dsd)

        context.add_widget(self._widget)

        # Start a timer that calls back every 100 ms
        self._timer_id = self.startTimer(100)
Example #38
0
    def __init__(self, context):
        super(EMonitorRqt, self).__init__(context)
        # Give QObjects reasonable names
        self.setObjectName('EMonitorRqt')

        # Process standalone plugin command-line arguments
        from argparse import ArgumentParser
        parser = ArgumentParser()
        # Add argument(s) to the parser.
        parser.add_argument("-q",
                            "--quiet",
                            action="store_true",
                            dest="quiet",
                            help="Put plugin in silent mode")
        args, unknowns = parser.parse_known_args(context.argv())
        if not args.quiet:
            print 'arguments: ', args
            print 'unknowns: ', unknowns

        # Create QWidget
        self._gui = EMonitorGUI()
        self._ros = EMonitorROS()
        # Get path to UI file which is a sibling of this file
        # in this example the .ui and .py file are in the same folder
        ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                               'resource/EMonitor.ui')
        # Extend the widget with all attributes and children from UI file
        loadUi(ui_file, self._gui)
        # Give QObjects reasonable names
        self._ros.setup()
        self._gui.setup("EMonitorRqt", self._ros)

        # Show _widget.windowTitle on left-top of each plugin (when
        # it's set in _widget). This is useful when you open multiple
        # plugins at once. Also if you open multiple instances of your
        # plugin at once, these lines add number to make it easy to
        # tell from pane to pane.
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() +
                                        (' (%d)' % context.serial_number()))
        # Add widget to the user interface
        context.add_widget(self._gui._widget)
Example #39
0
    def __init__(self, updater, config):
        super(IntegerEditor, self).__init__(updater, config)
        loadUi(ui_int, self)

        # Set ranges
        self._min = int(config['min'])
        self._max = int(config['max'])
        self._min_val_label.setText(str(self._min))
        self._max_val_label.setText(str(self._max))
        self._slider_horizontal.setRange(self._min, self._max)

        # TODO: Fix that the naming of _paramval_lineEdit instance is not
        #       consistent among Editor's subclasses.
        self._paramval_lineEdit.setValidator(
            QIntValidator(self._min, self._max, self))

        # Initialize to default
        self._paramval_lineEdit.setText(str(config['default']))
        self._slider_horizontal.setValue(int(config['default']))

        # Make slider update text (locally)
        self._slider_horizontal.sliderMoved.connect(self._slider_moved)

        # Make keyboard input change slider position and update param server
        self._paramval_lineEdit.editingFinished.connect(self._text_changed)

        # Make slider update param server
        # Turning off tracking means this isn't called during a drag
        self._slider_horizontal.setTracking(False)
        self._slider_horizontal.valueChanged.connect(self._slider_changed)

        # Make the param server update selection
        self._update_signal.connect(self._update_gui)

        # Add special menu items
        self.cmenu.addAction(self.tr('Set to Maximum')).triggered.connect(
            self._set_to_max)
        self.cmenu.addAction(self.tr('Set to Minimum')).triggered.connect(
            self._set_to_min)

        # Don't process wheel events when not focused
        self._slider_horizontal.installEventFilter(self)
Example #40
0
    def __init__(self):
        super(PluginWidget, self).__init__()
        ui_file = os.path.join(rospkg.RosPack().get_path('rover_rqt_science'),
                               'resource', 'pano.ui')
        loadUi(ui_file, self)
        self.files = {}
        self.science_mark = -1
        self.pixmaps = {}
        self.sites = {}

        self.mark_pano = rospy.ServiceProxy("/science/sci/mark_panorama",
                                            rover_science.srv.MarkPano)
        self.panorama = actionlib.SimpleActionClient(
            "/science/panorama/stitch_panorama",
            rover_panorama.msg.PanoramaAction)
        self.take_pano_image = rospy.ServiceProxy(
            "/science/panorama/take_pano_image", std_srvs.srv.Empty)

        def state_sub(s):
            self.pstate_signal.emit(s)

        self._state_sub = rospy.Subscriber("/science/panorama/pano_state",
                                           rover_panorama.msg.PanoState,
                                           callback=state_sub)

        def science_sub(s):
            self.sstate_signal.emit(
                {x.site_name: j
                 for j, x in enumerate(s.sites)})

        self._sstate_sub = rospy.Subscriber("/science/sites",
                                            rover_science.msg.Sites,
                                            callback=science_sub)

        self.progreeeeeees.connect(self.new_feedback)
        self.finiiiiiished.connect(self.goaal)
        self.pstate_signal.connect(self.new_pano_state)
        self.sstate_signal.connect(self.new_state)

        self.pushButton.clicked.connect(self.push_button)
        self.stitchButton.clicked.connect(self.stitch)
        self.tableWidget.cellClicked.connect(self.new_selected)
    def __init__(self, context):
        super(GrudsbyGUI, self).__init__(context)
        self.setObjectName('GrudsbyGUI')

        self.message_pub = rospy.Publisher("cmd_vel", Twist, queue_size=1000)

        rospy.Subscriber("GPS_PUB_TOPIC", NavSatFix, self.gps_msg_callback)
        rospy.Subscriber("IMU_PUB_TOPIC", Imu, self.imu_msg_callback)
        rospy.Subscriber("ENCODER_PUB_TOPIC", Odometry, self.odom_msg_callback)

        #rospy.Subscriber("reply_msg", reply_msg, self.reply_msg_callback)
        # rospy.Subscriber("arithmetic_reply", arithmetic_reply, self.arithmetic_reply_msg_callback)

        self.msg_to_send = Twist()
        self.counter_req_id = -1

        self._widget = QWidget()
        rp = rospkg.RosPack()
        ui_file = os.path.join(rp.get_path('grudsby_gui'), 'resource',
                               'GrudsbyGUI.ui')
        loadUi(ui_file, self._widget)
        self._widget.setObjectName('GrudsbyGUIui')
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() +
                                        (' (%d)' % context.serial_number()))
        context.add_widget(self._widget)

        #self._widget.message_to_send.textChanged.connect(self._on_msg_to_send_changed)
        #self._widget.counter_val_to_get.textChanged.connect(self._on_counter_val_to_get_changed)
        #self._widget.counter_val_to_get.setInputMask('9')

        self._widget.forwardLeft.pressed.connect(self._on_left_button_pressed)
        self._widget.forwardLeft.released.connect(
            self._on_left_button_released)
        self._widget.forwardStraight.pressed.connect(
            self._on_forward_button_pressed)
        self._widget.forwardStraight.released.connect(
            self._on_forward_button_released)
        self._widget.forwardRight.pressed.connect(
            self._on_right_button_pressed)
        self._widget.forwardRight.released.connect(
            self._on_right_button_released)
    def __init__(self, plugin=None):
        """
        """
        super(SystemWidget, self).__init__()

        rp = rospkg.RosPack()
        ui_file = os.path.join(rp.get_path('rqt_agent'), 'resource',
                               'SystemWidget.ui')
        loadUi(ui_file, self)

        self._plugin = plugin

        self._subsystems = {}

        self.all_subsystems = {}
        self._widgets = {}
        self.prev_subsystems = []
        self.levels_layouts = []

        self.structure_root = None
        self.structure_graph = None

        self.structure_changed = False

        self.scrollArea = QScrollArea()
        self.scrollArea.setWidgetResizable(True)
        self.horizontalLayout.addWidget(self.scrollArea)
        self.mainWidget = QWidget()
        self.scrollArea.setWidget(self.mainWidget)
        self.verticalLayout = QVBoxLayout()
        self.mainWidget.setLayout(self.verticalLayout)

        #        self._tree_items = {}
        #        self._column_index = {}
        #        for column_name in self._column_names:
        #            self._column_index[column_name] = len(self._column_index)

        # self.refresh_topics()

        # init and start update timer
        self._timer_refresh_topics = QTimer(self)
        self._timer_refresh_topics.timeout.connect(self.refresh_topics)
    def __init__(self):
        super(DiagnosticToolWidget, self).__init__()
        ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                               'pr2_diagnostic_widget.ui')
        loadUi(ui_file, self)
        self.setObjectName('DiagnosticToolWidget')
        self.left_bool = False
        self.right_bool = False
        self.head_bool = False
        self.debug_info_bool = False
        self.bad_results_bool = False
        self.r_arm_actuators = [
            'r_wrist_r_motor', 'r_wrist_l_motor', 'r_forearm_roll_motor',
            'r_upper_arm_roll_motor', 'r_elbow_flex_motor',
            'r_shoulder_lift_motor', 'r_shoulder_pan_motor'
        ]
        self.l_arm_actuators = [
            'l_wrist_r_motor', 'l_wrist_l_motor', 'l_forearm_roll_motor',
            'l_upper_arm_roll_motor', 'l_elbow_flex_motor',
            'l_shoulder_lift_motor', 'l_shoulder_pan_motor'
        ]
        self.head_actuators = ['head_pan_motor', 'head_tilt_motor']
        self.joint_list = []
        self.filelist = []
        self.filenames = []
        self.jointnames = []
        self.plots = []

        #getDataBtn = QPushButton('Quit', self)
        self.leftArm.stateChanged.connect(self.left_arm_selected)
        self.rightArm.stateChanged.connect(self.right_arm_selected)
        self.head.stateChanged.connect(self.head_selected)
        self.debugInfo.stateChanged.connect(self.debug_info_selected)
        self.badResults.stateChanged.connect(self.bad_results_selected)
        self.getData.clicked[bool].connect(self.get_data_pressed)
        self.resetJointlist.clicked[bool].connect(self.reset_jointlist)
        self.analyzeData.clicked[bool].connect(self.analyze_data)
        self.loadFile.clicked[bool].connect(self.load_file)
        self.loadDirectory.clicked[bool].connect(self.load_directory)
        self.resetFilelist.clicked[bool].connect(self.reset_filelist)

        rospy.Subscriber("joy", Joy, callback)
Example #44
0
    def __init__(self, context):
        super(MyPlugin, self).__init__(context)
        # Give QObjects reasonable names
        self.setObjectName('MyPlugin')

        # Process standalone plugin command-line arguments
        from argparse import ArgumentParser
        parser = ArgumentParser()
        # Add argument(s) to the parser.
        parser.add_argument("-q",
                            "--quiet",
                            action="store_true",
                            dest="quiet",
                            help="Put plugin in silent mode")
        args, unknowns = parser.parse_known_args(context.argv())
        if not args.quiet:
            print 'arguments: ', args
            print 'unknowns: ', unknowns

        # Create QWidget
        self._widget = QWidget()
        # Get path to UI file which should be in the "resource" folder of this package
        ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                               'MyPlugin.ui')

        # Extend the widget with all attributes and children from UI file
        loadUi(ui_file, self._widget)
        # Give QObjects reasonable names
        self._widget.setObjectName('MyPluginUi')
        # Show _widget.windowTitle on left-top of each plugin (when
        # it's set in _widget). This is useful when you open multiple
        # plugins at once. Also if you open multiple instances of your
        # plugin at once, these lines add number to make it easy to
        # tell from pane to pane.

        self._widget.pushButton.clicked.connect(self.callbackFunction)

        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() +
                                        (' (%d)' % context.serial_number()))
        # Add widget to the user interface
        context.add_widget(self._widget)
Example #45
0
    def __init__(self, context):
        super(MyPlugin, self).__init__(context)
        # Give QObjects reasonable names
        self.setObjectName('MyPlugin')
        rp = rospkg.RosPack()

        # Process standalone plugin command-line arguments
        from argparse import ArgumentParser
        parser = ArgumentParser()
        # Add argument(s) to the parser.
        parser.add_argument("-q",
                            "--quiet",
                            action="store_true",
                            dest="quiet",
                            help="Put plugin in silent mode")
        args, unknowns = parser.parse_known_args(context.argv())
        if not args.quiet:
            print 'arguments: ', args
            print 'unknowns: ', unknowns

        # Create QWidget
        self._widget = QWidget()
        # Get path to UI file which is a sibling of this file
        # in this example the .ui and .py file are in the same folder
        ui_file = os.path.join(rp.get_path('rqt_mypkg'), 'resource',
                               'MyPlugin.ui')
        # Extend the widget with all attributes and children from UI file
        loadUi(ui_file, self._widget)
        # Give QObjects reasonable names
        self._widget.setObjectName('MyPluginUi')
        # Show _widget.windowTitle on left-top of each plugin (when
        # it's set in _widget). This is useful when you open multiple
        # plugins at once. Also if you open multiple instances of your
        # plugin at once, these lines add number to make it easy to
        # tell from pane to pane.
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() +
                                        (' (%d)' % context.serial_number()))
        # Add widget to the user interface
        context.add_widget(self._widget)

        self._widget.btnTest.clicked.connect(self.test_button_clicked)
Example #46
0
    def __init__(self):
        super(Robviz, self).__init__()
        loadUi(os.path.join(path, 'resources', 'robviz.ui'), self)

        self.boxPlot.addWidget(MyViz())

        self.qtParam = QtParam()
        self.qtControl = QtControl()

        self.tabWidget.addTab(self.qtParam, 'Parameters')
        self.tabWidget.addTab(self.qtControl, 'Control')

        self.tabWidget.setCurrentWidget(self.qtControl)

        #self.qtData.accepted.connect(self.qtPartAccepted)

        self.btnQuit.clicked.connect(self.btnQuitClicked)

        rospy.Subscriber('/velocity', MsgVelocity, self.cb_velocity, queue_size=1)
        rospy.Subscriber('/supervisor/status', MsgStatus, self.cb_status, queue_size=1)
 def __init__(self, parent=None):
     '''
     Creates the window, connects the signals and init the class.
     '''
     QDockWidget.__init__(self, parent)
     # load the UI file
     settings_dock_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'SettingsDockWidget.ui')
     loadUi(settings_dock_file, self)
     # initialize the settings view model
     self.settings_model = SettingsModel()
     self.settings_proxyModel = QSortFilterProxyModel(self)
     self.settings_proxyModel.setSourceModel(self.settings_model)
     self.settingsTreeView.setModel(self.settings_proxyModel)
     self.settingsTreeView.setAlternatingRowColors(True)
     for i, (_, width) in enumerate(SettingsModel.header):
         self.settingsTreeView.setColumnWidth(i, width)
     self.item_delegate = ItemDelegate()
     self.item_delegate.settings_path_changed_signal.connect(self.reload_settings)
     self.settingsTreeView.setItemDelegateForColumn(1, self.item_delegate)
     self.reload_settings()
Example #48
0
    def __init__(self, *args, **kwargs):
        """Implements a dialog to create a new object for the world model.

        Implementation of the modal dialog to select object types from the available ontology/world model.
        Allows filtering of the objects by (sub)type.
        The dialog saves the selection in the 'object' property.

        Args:
            *args: Description
            **kwargs: Description
        """
        super(SkirosAddObjectDialog, self).__init__(*args, **kwargs)
        self.setObjectName('SkirosAddObjectDialog')
        ui_file = os.path.join(rospkg.RosPack().get_path('skiros2_gui'), 'src/skiros2_gui/core', 'skiros_gui_add_object_dialog.ui')
        loadUi(ui_file, self)

        self._comboBoxes = []
        self.create_comboBox(label='Type')
        self.comboBox_individual.clear()
        [self.comboBox_individual.addItem(l, d) for l, d in self.get_individuals(self.default_type).iteritems()]
Example #49
0
    def __init__(self, parentfilter):
        """
        Widget for displaying interactive data related to text filtering.
        :param parentfilter: buddy filter were data is stored, ''TimeFilter''
        """
        super(TextFilterWidget, self).__init__()

        pkg_name = 'rqt_console'
        _, package_path = get_resource('packages', pkg_name)
        ui_file = os.path.join(
            package_path, 'share', pkg_name, 'resource', 'filters', 'text_filter_widget.ui')

        loadUi(ui_file, self)
        self.setObjectName('TextFilterWidget')
        self._parentfilter = parentfilter  # When data is changed it is stored in the parent filter

        self.text_edit.textChanged.connect(self.handle_text_changed)
        self.regex_check_box.clicked[bool].connect(self.handle_regex_clicked)

        self.handle_text_changed()
Example #50
0
    def __init__(self, parentfilter, rospack, item_provider):
        """
        :param parentfilter: The filter object, must implement set_list and
        contain _list ''QObject''
        :param item_provider: a function designed to provide a list or dict
        """
        super(ListFilterWidget, self).__init__()
        ui_file = os.path.join(rospack.get_path('rqt_console'), 'resource/filters', 'list_filter_widget.ui')
        loadUi(ui_file, self)
        self.setObjectName('ListFilterWidget')
        self._parentfilter = parentfilter  # When data is changed we need to store it in the parent filter

        # keep color for highlighted items even when not active
        active_color = self.palette().brush(QPalette.Active, QPalette.Highlight).color().name()
        self.setStyleSheet('QListWidget:item:selected:!active { background: %s; }' % active_color)

        self._list_populate_function = item_provider
        self.list_widget.itemSelectionChanged.connect(self.handle_item_changed)
        self._display_list = []
        self.repopulate()
Example #51
0
    def __init__(self, parent=None):
        super(PublisherWidget, self).__init__(parent)
        self._topic_dict = {}
        self._update_thread = WorkerThread(self._update_thread_run, self._update_finished)

        ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'Publisher.ui')
        loadUi(ui_file, self, {'ExtendedComboBox': ExtendedComboBox, 'PublisherTreeWidget': PublisherTreeWidget})
        self.refresh_button.setIcon(QIcon.fromTheme('view-refresh'))
        self.refresh_button.clicked.connect(self.refresh_combo_boxes)
        self.add_publisher_button.setIcon(QIcon.fromTheme('add'))
        self.remove_publisher_button.setIcon(QIcon.fromTheme('remove'))
        self.clear_button.setIcon(QIcon.fromTheme('edit-clear'))

        self.refresh_combo_boxes()

        self.publisher_tree_widget.model().item_value_changed.connect(self.change_publisher)
        self.publisher_tree_widget.remove_publisher.connect(self.remove_publisher)
        self.publisher_tree_widget.publish_once.connect(self.publish_once)
        self.remove_publisher_button.clicked.connect(self.publisher_tree_widget.remove_selected_publishers)
        self.clear_button.clicked.connect(self.clean_up_publishers)
def launch_standalone(name, GuiT, RosT, resource=""):
    import rospy, os, sys
    import python_qt_binding as pyqt
    from python_qt_binding import QtGui
    app = QtGui.QApplication(sys.argv)
    rospy.init_node(name, sys.argv)
    gui = GuiT()
    ros = RosT()

    if resource == "":
        resource = _resource(name)
    #Load the UI
    pyqt.loadUi(resource, gui)
    #Connect the user interface and ROS
    ros.setup(gui)
    gui.setup(name, ros)
    #Start GUI
    gui.show()

    sys.exit(app.exec_())
Example #53
0
    def __init__(self, caller):
        """
        :param caller: service caller instance for sending service calls, ''LoggerLevelServiceCaller''
        """
        super(LoggerLevelWidget, self).__init__()
        rp = rospkg.RosPack()
        ui_file = os.path.join(rp.get_path('rqt_logger_level'), 'resource',
                               'logger_level.ui')
        loadUi(ui_file, self)
        self.setObjectName('LoggerLevelWidget')
        self._caller = caller

        self.node_list.currentRowChanged[int].connect(self.node_changed)
        self.logger_list.currentRowChanged[int].connect(self.logger_changed)
        self.level_list.currentRowChanged[int].connect(self.level_changed)
        self.refresh_button.clicked[bool].connect(self.refresh_nodes)

        self.refresh_nodes()
        if self.node_list.count() > 0:
            self.node_list.setCurrentRow(0)
Example #54
0
    def __init__(self):
        super(My_App, self).__init__()
        loadUi("./SIFT_app.ui", self)

        self._cam_id = 0
        self._cam_fps = 2
        self._is_cam_enabled = False
        self._is_template_loaded = False

        self.browse_button.clicked.connect(self.SLOT_browse_button)
        self.toggle_cam_button.clicked.connect(self.SLOT_toggle_camera)

        self._camera_device = cv2.VideoCapture(self._cam_id)
        self._camera_device.set(3, 320)
        self._camera_device.set(4, 240)

        # Timer used to trigger the camera
        self._timer = QtCore.QTimer(self)
        self._timer.timeout.connect(self.SLOT_query_camera)
        self._timer.setInterval(1000 / self._cam_fps)
    def __init__(self):
        super(My_App, self).__init__()
        loadUi("./SIFT_app.ui", self)

        self._cam_id = 0
        self._cam_fps = 2
        self._is_cam_enabled = False
        self._is_template_loaded = False

        self.browse_button.clicked.connect(self.SLOT_browse_button)
        self.toggle_cam_button.clicked.connect(self.SLOT_toggle_camera)

        # Timer used to trigger the camera
        self._timer = QtCore.QTimer(self)
        self._timer.timeout.connect(self.SLOT_query_camera)

        self.vid = "/home/fizzer/SIFT_app/Robot Video.mp4"
        self.VidCap = cv2.VideoCapture(self.vid)

        self.ImgPath = "/home/fizzer/SIFT_app/000_image.jpg"
Example #56
0
    def __init__(self, context):
        super(Compass, self).__init__(context)
        self.setObjectName('Compass')
        self._publisher = None

        self._widget = QWidget()
        rp = rospkg.RosPack()
        ui_file = os.path.join(rospkg.RosPack().get_path('rqt_compass'), 'resource', 'compass.ui')
        loadUi(ui_file, self._widget)
        self._widget.setObjectName('Compass')
        if context.serial_number() > 1:
            self._widget.setWindowTitle(
            self._widget.windowTitle() + (' (%d)' % context.serial_number()))
        context.add_widget(self._widget)
        self.setup()
        self._widget.goButton.clicked.connect(self.go_button_click)
        self._widget.refresh = QtCore.QTimer()
        self._widget.refresh.timeout.connect(self.update_compass)
        self._widget.refresh.start(100)
        self.listen()
Example #57
0
    def __init__(self, initial_topics=None, start_paused=False, 
                 buffer_length=100, use_poly=True, no_legend=False):
        super(Plot3DWidget, self).__init__()
        self.setObjectName('Plot3DWidget')
        self._buffer_length = buffer_length
        self._initial_topics = initial_topics

        rp = rospkg.RosPack()
        ui_file = os.path.join(rp.get_path('jsk_rqt_plugins'), 
                               'resource', 'plot3d.ui')
        loadUi(ui_file, self)
        self.subscribe_topic_button.setIcon(QIcon.fromTheme('add'))
        self.remove_topic_button.setIcon(QIcon.fromTheme('remove'))
        self.pause_button.setIcon(QIcon.fromTheme('media-playback-pause'))
        self.clear_button.setIcon(QIcon.fromTheme('edit-clear'))
        self.data_plot = MatDataPlot3D(self, self._buffer_length, 
                                       use_poly, no_legend)
        self.data_plot_layout.addWidget(self.data_plot)
        self.data_plot.autoscroll(self.autoscroll_checkbox.isChecked())
        self.data_plot.dropEvent = self.dropEvent
        self.data_plot.dragEnterEvent = self.dragEnterEvent

        self.subscribe_topic_button.setEnabled(False)
        if start_paused:
            self.pause_button.setChecked(True)

        self._topic_completer = TopicCompleter(self.topic_edit)
        self._topic_completer.update_topics()
        self.topic_edit.setCompleter(self._topic_completer)

        self._start_time = rospy.get_time()
        self._rosdata = {}
        self._remove_topic_menu = QMenu()

        # init and start update timer for plot
        self._update_plot_timer = QTimer(self)
        self._update_plot_timer.timeout.connect(self.update_plot)
        if self._initial_topics:
            for topic_name in self._initial_topics:
                self.add_topic(topic_name)
            self._initial_topics = None
Example #58
0
    def __init__(self, context):
        super(MavManagerUi, self).__init__(context)
        self.setObjectName('MavManagerUi')

        self._publisher = None

        self.robot_name = 'quadrotor'
        self.mav_node_name = 'mav_services'

        self._widget = QWidget()
        rp = rospkg.RosPack()
        ui_file = os.path.join(rp.get_path('rqt_mav_manager'), 'resource',
                               'MavManager.ui')
        loadUi(ui_file, self._widget)
        self._widget.setObjectName('MavManagerWidget')
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() +
                                        (' (%d)' % context.serial_number()))
        context.add_widget(self._widget)

        self._widget.robot_name_line_edit.textChanged.connect(
            self._on_robot_name_changed)
        self._widget.node_name_line_edit.textChanged.connect(
            self._on_node_name_changed)

        self._widget.motors_on_push_button.pressed.connect(
            self._on_motors_on_pressed)
        self._widget.motors_off_push_button.pressed.connect(
            self._on_motors_off_pressed)
        self._widget.hover_push_button.pressed.connect(self._on_hover_pressed)
        self._widget.ehover_push_button.pressed.connect(
            self._on_ehover_pressed)
        self._widget.land_push_button.pressed.connect(self._on_land_pressed)
        self._widget.eland_push_button.pressed.connect(self._on_eland_pressed)
        self._widget.estop_push_button.pressed.connect(self._on_estop_pressed)
        self._widget.goto_push_button.pressed.connect(self._on_goto_pressed)

        self._widget.takeoff_push_button.pressed.connect(
            self._on_takeoff_pressed)
        self._widget.gohome_push_button.pressed.connect(
            self._on_gohome_pressed)
Example #59
0
    def __init__(self, context):
        super(Dashboard, self).__init__(context)

        # Create the widget and name it
        self._widget = QtWidgets.QWidget()
        self._widget.setObjectName("Dashboard")
        self.setObjectName("Dashboard")

        # Extend the widget with all attributes and children in the UI file
        ui_file = os.path.join(rospkg.RosPack().get_path("navigator_gui"),
                               "resource", "dashboard.ui")
        loadUi(ui_file, self._widget)

        self.remote = RemoteControl("dashboard")

        # Creates dictionaries that are used by the monitor functions to keep track of their node or service
        node_monitor_template = {
            "current": "Unknown",
            "displayed": "Unknown",
        }
        self.operating_mode = copy(node_monitor_template)
        self.battery_voltage = copy(node_monitor_template)
        self.kill_status = copy(node_monitor_template)
        self.kill_status["current"] = True
        self.system_time = copy(node_monitor_template)
        self.hosts = node_monitor_template.copy()
        self.clear_hosts()

        self.connect_ui()
        self.connect_ros()

        # Deals with problem when they're multiple instances of Dashboard plugin
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() +
                                        (" (%d)" % context.serial_number()))

        # Add widget to the user interface
        context.add_widget(self._widget)

        # Creates monitors that update data on the GUI periodically
        self.update_gui()
Example #60
0
    def __init__(self, context):
        super(Packml, self).__init__(context)
        self.setObjectName('Packml')

        from argparse import ArgumentParser
        parser = ArgumentParser()

        parser.add_argument("-q", "--quiet", action="store_true",
                      dest="quiet",
                      help="Put plugin in silent mode")
        args, unknowns = parser.parse_known_args(context.argv())
        if not args.quiet:
            print 'arguments: ', args
            print 'unknowns: ', unknowns

        # Create QWidget
        self._widget = QWidget()
        ui_file = os.path.join(rospkg.RosPack().get_path('packml_gui'), 'resource', 'packml.ui')
        loadUi(ui_file, self._widget)
        self._widget.setObjectName('Packml')

        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))

        context.add_widget(self._widget)

        # Custom code begins here
        self._widget.reset_button.clicked[bool].connect(self.__handle_reset_clicked)
        self._widget.start_button.clicked[bool].connect(self.__handle_start_clicked)
        self._widget.stop_button.clicked[bool].connect(self.__handle_stop_clicked)
        self._widget.clear_button.clicked[bool].connect(self.__handle_clear_clicked)
        self._widget.hold_button.clicked[bool].connect(self.__handle_hold_clicked)
        self._widget.unhold_button.clicked[bool].connect(self.__handle_unhold_clicked)
        self._widget.suspend_button.clicked[bool].connect(self.__handle_suspend_clicked)
        self._widget.unsuspend_button.clicked[bool].connect(self.__handle_unsuspend_clicked)
        self._widget.abort_button.clicked[bool].connect(self.__handle_abort_clicked)

        self._service_thread = Thread(target=self.wait_for_services, args=())
        self._service_thread.start()

        self._status_sub = rospy.Subscriber('packml/status', Status, self.status_callback)