def __init__(self, parent=None, current_values=None): super(BlacklistDialog, self).__init__(parent) self.setWindowTitle("Blacklist") vbox = QVBoxLayout() self.setLayout(vbox) self._blacklist = Blacklist() if isinstance(current_values, list): for val in current_values: self._blacklist.append(val) vbox.addWidget(self._blacklist) controls_layout = QHBoxLayout() add_button = QPushButton(icon=QIcon.fromTheme('list-add')) rem_button = QPushButton(icon=QIcon.fromTheme('list-remove')) ok_button = QPushButton("Ok") cancel_button = QPushButton("Cancel") add_button.clicked.connect(self._add_item) rem_button.clicked.connect(self._remove_item) ok_button.clicked.connect(self.accept) cancel_button.clicked.connect(self.reject) controls_layout.addWidget(add_button) controls_layout.addWidget(rem_button) controls_layout.addStretch(0) controls_layout.addWidget(ok_button) controls_layout.addWidget(cancel_button) vbox.addLayout(controls_layout)
def addTxtInputFld(self, layout): ''' Creates text input field label and text field in a horizontal box layout. Adds that hbox layout to the passed-in layout. Sets instance variables: 1. C{self.speechInputFld} @param layout: Layout object to which the label/txt-field C{hbox} is to be added. @type layout: QLayout ''' speechControlsLayout = QHBoxLayout(); speechControlsLayout.addStretch(1); speechInputFldLabel = QLabel("<b>What to say:</b>") speechControlsLayout.addWidget(speechInputFldLabel); self.speechInputFld = TextPanel(numLines=5); self.speechInputFld.setStyleSheet(SpeakEasyGUI.inputFldStylesheet); self.speechInputFld.setFontPointSize(SpeakEasyGUI.EDIT_FIELD_TEXT_SIZE); speechControlsLayout.addWidget(self.speechInputFld); layout.addLayout(speechControlsLayout); # Create and hide the dialog for adding Cepstral voice modulation # markup to text in the text input field: self.speechControls = MarkupManagementUI(textPanel=self.speechInputFld, parent=self);
def addOnceOrRepeat_And_VoiceRadioButtons(self, layout): ''' Creates radio buttons for selecting whether a sound is to play once, or repeatedly until stopped. Also adds radio buttons for selecting voices. Places all in a horizontal box layout. Adds that hbox layout to the passed-in layout. Sets instance variables: 1. C{self.onceOrRepeatDict} 2. C{self.voicesRadioButtonsDict} @param layout: Layout object to which the label/txt-field C{hbox} is to be added. @type layout: QLayout ''' hbox = QHBoxLayout(); (self.onceOrRepeatGroup, onceOrRepeatButtonLayout, self.onceOrRepeatDict) =\ self.buildRadioButtons([SpeakEasyGUI.interactionWidgets['PLAY_ONCE'], SpeakEasyGUI.interactionWidgets['PLAY_REPEATEDLY'] ], Orientation.HORIZONTAL, Alignment.LEFT, activeButtons=[SpeakEasyGUI.interactionWidgets['PLAY_ONCE']], behavior=CheckboxGroupBehavior.RADIO_BUTTONS); self.replayPeriodSpinBox = QDoubleSpinBox(self); self.replayPeriodSpinBox.setRange(0.0, 99.9); # seconds self.replayPeriodSpinBox.setSingleStep(0.5); self.replayPeriodSpinBox.setDecimals(1); onceOrRepeatButtonLayout.addWidget(self.replayPeriodSpinBox); secondsLabel = QLabel("secs delay"); onceOrRepeatButtonLayout.addWidget(secondsLabel); # Create an array of voice radio button labels: voiceRadioButtonLabels = []; for voiceKey in SpeakEasyGUI.voices.keys(): voiceRadioButtonLabels.append(SpeakEasyGUI.interactionWidgets[voiceKey]); (self.voicesGroup, voicesButtonLayout, self.voicesRadioButtonsDict) =\ self.buildRadioButtons(voiceRadioButtonLabels, Orientation.HORIZONTAL, Alignment.RIGHT, activeButtons=[SpeakEasyGUI.interactionWidgets['VOICE_1']], behavior=CheckboxGroupBehavior.RADIO_BUTTONS); # Style all the radio buttons: for playFreqButton in self.onceOrRepeatDict.values(): playFreqButton.setStyleSheet(SpeakEasyGUI.playOnceRepeatButtonStylesheet); for playFreqButton in self.voicesRadioButtonsDict.values(): playFreqButton.setStyleSheet(SpeakEasyGUI.voiceButtonStylesheet); #...and the replay delay spinbox: self.replayPeriodSpinBox.setStyleSheet(SpeakEasyGUI.playRepeatSpinboxStylesheet); #****** replayPeriodSpinBox styling hbox.addLayout(onceOrRepeatButtonLayout); hbox.addStretch(1); hbox.addLayout(voicesButtonLayout); layout.addLayout(hbox);
def addTitle(self,layout): title = QLabel("<H1>SpeakEasy</H1>"); hbox = QHBoxLayout(); hbox.addStretch(1); hbox.addWidget(title); hbox.addStretch(1); layout.addLayout(hbox);
def __init__(self, nodename, masteruri, loggername, level='INFO', parent=None): ''' Creates a new item. ''' QFrame.__init__(self, parent) self.setObjectName("LoggerItem") self.nodename = nodename self.masteruri = masteruri self.loggername = loggername self.current_level = None layout = QHBoxLayout(self) layout.setContentsMargins(1, 1, 1, 1) self.debug = QRadioButton() self.debug.setStyleSheet( "QRadioButton{ background-color: #39B54A;}") # QColor(57, 181, 74) self.debug.toggled.connect(self.toggled_debug) layout.addWidget(self.debug) self.info = QRadioButton() self.info.setStyleSheet("QRadioButton{ background-color: #FFFAFA;}") self.info.toggled.connect(self.toggled_info) layout.addWidget(self.info) self.warn = QRadioButton() self.warn.setStyleSheet( "QRadioButton{ background-color: #FFC706;}") # QColor(255, 199, 6) self.warn.toggled.connect(self.toggled_warn) layout.addWidget(self.warn) self.error = QRadioButton() self.error.setStyleSheet( "QRadioButton{ background-color: #DE382B;}") # QColor(222, 56, 43) self.error.toggled.connect(self.toggled_error) layout.addWidget(self.error) self.fatal = QRadioButton() self.fatal.setStyleSheet("QRadioButton{ background-color: #FF0000;}") self.fatal.toggled.connect(self.toggled_fatal) layout.addWidget(self.fatal) self.label = QLabel(loggername) layout.addWidget(self.label) layout.addStretch() self._callback = None # used to set all logger self.success_signal.connect(self.on_succes_update) self.error_signal.connect(self.on_error_update) self.set_level(level)
def __init__(self, parent=None, subscribe=False): QWidget.__init__(self, parent) # start widget vbox = QVBoxLayout() vbox.setMargin(0) vbox.setContentsMargins(0, 0, 0, 0) # add error status text edit self.error_status_text_box = QErrorStatusTextBox() self.error_status_text_box_layout = QHBoxLayout() self.error_status_text_box_layout.addWidget(self.error_status_text_box) vbox.addLayout(self.error_status_text_box_layout) # add panel hbox = QHBoxLayout() # clear push button self.execute_command = QPushButton("Clear") self.execute_command.clicked.connect(self.error_status_text_box.clear) hbox.addWidget(self.execute_command) hbox.addStretch() # hide window checkbox hide_window_check_box = QCheckBox("Hide") hide_window_check_box.stateChanged.connect(self.state_changed) hbox.addWidget(hide_window_check_box) # end panel vbox.addLayout(hbox) # end widget self.setLayout(vbox) #self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum) # subscriber if subscribe: self.error_status_sub = rospy.Subscriber("error_status", ErrorStatus, self.error_status_callback) self.subscribed = subscribe # connect signal slot internally to prevent crash by subscriber self.error_status_signal.connect(self.append_error_status)
def __init__(self, parent = None, subscribe = False): QWidget.__init__(self, parent) # start widget vbox = QVBoxLayout() vbox.setMargin(0) vbox.setContentsMargins(0, 0, 0, 0) # add error status text edit self.error_status_text_box = QErrorStatusTextBox() self.error_status_text_box_layout = QHBoxLayout() self.error_status_text_box_layout.addWidget(self.error_status_text_box) vbox.addLayout(self.error_status_text_box_layout) # add panel hbox = QHBoxLayout() # clear push button self.execute_command = QPushButton("Clear") self.execute_command.clicked.connect(self.error_status_text_box.clear) hbox.addWidget(self.execute_command) hbox.addStretch() # hide window checkbox hide_window_check_box = QCheckBox("Hide") hide_window_check_box.stateChanged.connect(self.state_changed) hbox.addWidget(hide_window_check_box) # end panel vbox.addLayout(hbox) # end widget self.setLayout(vbox) #self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum) # subscriber if (subscribe): self.error_status_sub = rospy.Subscriber("error_status", ErrorStatus, self.error_status_callback) self.subscribed = subscribe # connect signal slot internally to prevent crash by subscriber self.error_status_signal.connect(self.append_error_status)
def buildOptionsRadioButtons(self, layout): hbox = QHBoxLayout(); (self.playLocalityGroup, playLocalityButtonLayout, self.playLocalityRadioButtonsDict) =\ self.buildRadioButtons([SpeakEasyGUI.interactionWidgets['PLAY_LOCALLY'], SpeakEasyGUI.interactionWidgets['PLAY_AT_ROBOT'] ], Orientation.HORIZONTAL, Alignment.LEFT, activeButtons=[SpeakEasyGUI.interactionWidgets[DEFAULT_PLAY_LOCATION]], behavior=CheckboxGroupBehavior.RADIO_BUTTONS); #behavior=CheckboxGroupBehavior.CHECKBOXES); # Style all the radio buttons: for playLocalityButton in self.playLocalityRadioButtonsDict.values(): playLocalityButton.setStyleSheet(SpeakEasyGUI.voiceButtonStylesheet); hbox.addLayout(playLocalityButtonLayout); hbox.addStretch(1); self.buildConvenienceButtons(hbox); layout.addLayout(hbox);
def __init__(self, parent=None): super(VisualizerWidget, self).__init__(parent) self.setWindowTitle('Graph Profiler Visualizer') vbox = QVBoxLayout() self.setLayout(vbox) toolbar_layout = QHBoxLayout() refresh_button = QPushButton() refresh_button.setIcon(QIcon.fromTheme('view-refresh')) auto_refresh_checkbox = QCheckBox("Auto Refresh") hide_disconnected_topics = QCheckBox("Hide Disconnected Topics") topic_blacklist_button = QPushButton("Topic Blacklist") node_blacklist_button = QPushButton("Node Blacklist") refresh_button.clicked.connect(self._refresh) topic_blacklist_button.clicked.connect(self._edit_topic_blacklist) node_blacklist_button.clicked.connect(self._edit_node_blacklist) auto_refresh_checkbox.setCheckState(2) auto_refresh_checkbox.stateChanged.connect(self._autorefresh_changed) hide_disconnected_topics.setCheckState(2) hide_disconnected_topics.stateChanged.connect(self._hidedisconnectedtopics_changed) toolbar_layout.addWidget(refresh_button) toolbar_layout.addWidget(auto_refresh_checkbox) toolbar_layout.addStretch(0) toolbar_layout.addWidget(hide_disconnected_topics) toolbar_layout.addWidget(topic_blacklist_button) toolbar_layout.addWidget(node_blacklist_button) vbox.addLayout(toolbar_layout) # Initialize the Visualizer self._view = qt_view.QtView() self._adapter = rosprofiler_adapter.ROSProfileAdapter(self._view) self._adapter.set_topic_quiet_list(TOPIC_BLACKLIST) self._adapter.set_node_quiet_list(NODE_BLACKLIST) vbox.addWidget(self._view)
def __init__(self, context): #super(PositionModeDialog, self).__init__(context) #self.setObjectName('PositionModeDialog') super(PositionModeWidget, self).__init__() self.name = 'PositionModeWidget' self.updateStateSignal.connect(self.on_updateState) self.updatePelvisSignal.connect(self.on_updatePelvis) self.updateGhostSignal.connect(self.on_updateGhost) ## Process standalone plugin command-line arguments #from argparse import ArgumentParser #parser = ArgumentParser() ## Add argument(s) to the parser. #parser.add_argument("-f", "--file", # dest="file", # help="Input file name") #args, unknowns = parser.parse_known_args(context.argv()) #print 'arguments: ', args #print 'unknowns: ', unknowns # #if ((args.file == "") or (args.file == None)): # print "No file specified - abort!" # sys.exit(-1) # Define how long the trajectories will take to execute self.time_factor = rospy.get_param('~time_factor', 2.1) print "Using ",self.time_factor, " as the time factor for all trajectories" # Joint Name : Child Link :OSRF self.joint_names=[] self.joint_names.append('back_bkz') # : ltorso : 0 self.joint_names.append('back_bky') # : mtorso : 1 self.joint_names.append('back_bkx') # : utorso : 2 self.joint_names.append('neck_ry') # : head : 3 self.joint_names.append('l_leg_hpz') # : l_uglut : 4 self.joint_names.append('l_leg_hpx') # : l_lglut : 5 self.joint_names.append('l_leg_hpy') # : l_uleg : 6 self.joint_names.append('l_leg_kny') # : l_lleg : 7 self.joint_names.append('l_leg_aky') # : l_talus : 8 self.joint_names.append('l_leg_akx') # : l_foot : 9 self.joint_names.append('r_leg_hpz') # : r_uglut : 10 self.joint_names.append('r_leg_hpx') # : r_lglut : 11 self.joint_names.append('r_leg_hpy') # : r_uleg : 12 self.joint_names.append('r_leg_kny') # : r_lleg : 13 self.joint_names.append('r_leg_aky') # : r_talus : 14 self.joint_names.append('r_leg_akx') # : r_foot : 15 self.joint_names.append('l_arm_shz') # : l_clav : 16 self.joint_names.append('l_arm_shx') # : l_scap : 17 self.joint_names.append('l_arm_ely') # : l_uarm : 18 self.joint_names.append('l_arm_elx') # : l_larm : 19 self.joint_names.append('l_arm_wry') # : l_farm : 20 self.joint_names.append('l_arm_wrx') # : l_hand : 21 self.joint_names.append('l_arm_wry2') # : l_farm : 22 self.joint_names.append('r_arm_shz') # : r_clav : 23 self.joint_names.append('r_arm_shx') # : r_scap : 24 self.joint_names.append('r_arm_ely') # : r_uarm : 25 self.joint_names.append('r_arm_elx') # : r_larm : 26 self.joint_names.append('r_arm_wry') # : r_farm : 27 self.joint_names.append('r_arm_wrx') # : r_hand : 28 self.joint_names.append('r_arm_wry2') # : r_farm : 29 self.joint_states = JointState() self.pelvis_names=[] self.joint_names.append('forward') # : 30 self.joint_names.append('lateral') # : 31 self.joint_names.append('height') # : 32 self.joint_names.append('roll') # : 33 self.joint_names.append('pitch') # : 34 self.joint_names.append('yaw') # : 35 self.pelvis_states = JointState() self.pelvis_states.position = [0.0, 0.0, 0.85, 0.0, 0.0, 0.0] # default pelvis pose #self._widget = QWidget() self._widget = context vbox = QVBoxLayout() # Define checkboxes radios = QWidget(); hbox_radio = QHBoxLayout() self.radioGroup = QButtonGroup() self.radioGroup.setExclusive(True) self.radio_ghost_target = QRadioButton() self.radio_ghost_target.setText("Ghost") self.radio_robot_target = QRadioButton() self.radio_robot_target.setText("Robot") self.radioGroup.addButton(self.radio_ghost_target,0) self.radioGroup.addButton(self.radio_robot_target,1) self.radio_ghost_target.setChecked(True) self.commandGroup = QButtonGroup() self.commandGroup.setExclusive(True) self.radio_position_command = QRadioButton() self.radio_position_command.setText("Position") self.commandGroup.addButton(self.radio_position_command,0) self.radio_trajectory_command = QRadioButton() self.radio_trajectory_command.setText("Trajectory") self.commandGroup.addButton(self.radio_trajectory_command,1) self.radio_trajectory_command.setChecked(True) #print "position button is checked: ",self.radio_position_command.isChecked() #print "trajectory button is checked: ",self.radio_trajectory_command.isChecked() print "Default group button checked is ",self.radioGroup.checkedId() print "Default command button checked is ",self.commandGroup.checkedId() hbox_radio.addStretch() hbox_radio.addWidget(self.radio_ghost_target) #hbox_radio.addWidget(QLabel("Ghost")) hbox_radio.addStretch() vbox_robot = QVBoxLayout() widget_robot = QWidget() widget_robot_sel = QWidget() hbox_sel = QHBoxLayout() hbox_radio.addStretch() hbox_sel.addWidget(self.radio_robot_target) #hbox_sel.addWidget(QLabel("Robot")) hbox_radio.addStretch() widget_robot_sel.setLayout(hbox_sel) vbox_robot.addWidget(widget_robot_sel); widget_cmd = QWidget() hbox_cmd = QHBoxLayout() hbox_radio.addStretch() hbox_cmd.addWidget(self.radio_position_command) #hbox_cmd.addWidget(QLabel("Position")) hbox_radio.addStretch() hbox_cmd.addWidget(self.radio_trajectory_command) #hbox_cmd.addWidget(QLabel("Trajectory")) hbox_radio.addStretch() widget_cmd.setLayout(hbox_cmd) vbox_robot.addWidget(widget_cmd); widget_robot.setLayout(vbox_robot) hbox_radio.addWidget(widget_robot) radios.setLayout(hbox_radio) vbox.addWidget(radios) positions_widget = QWidget() hbox = QHBoxLayout() #self.robot = URDF.from_parameter_server() self.chains=[] # Subscribe to Joint States update /atlas/atlas_state #print "Load parameters" #print rospy.get_param_names() #fileName = rospy.get_param('positions_file', '/opt/vigir/catkin_ws/src/vigir_ocs_eui/vigir_rqt/vigir_rqt_position_mode/launch/r_arm_positions.txt') #print "FileName:",fileName # Left to right layout numFiles = rospy.get_param("~num_files"); for i in range(1,numFiles+1): path = "~position_files/file_" + str(i) foobar = str(rospy.get_param(path)) self.chains.append(ChainData(self, foobar, hbox)) #add stretch at end so all GUI elements are at left of dialog hbox.addStretch(1) positions_widget.setLayout(hbox) vbox.addWidget(positions_widget) vbox.addStretch(1) self._widget.setLayout(vbox) #context.add_widget(self._widget) self.stateSubscriber = rospy.Subscriber('/atlas/joint_states', JointState, self.stateCallbackFnc) self.ghostSubscriber = rospy.Subscriber('/flor/ghost/get_joint_states', JointState, self.ghostCallbackFnc) self.pelvisSubscriber = rospy.Subscriber('/robot_controllers/pelvis_traj_controller/current_states',JointState, self.pelvisCallbackFnc)
def __init__(self, context): super(JointControlWidget, self).__init__() self.updateStateSignal.connect(self.on_update_state) self.updateGhostSignal.connect(self.on_update_ghost) self.joint_states = JointState() self.ghost_joint_states = JointState() self._widget = context vbox = QVBoxLayout() # Define checkboxes radios = QWidget() hbox_radio = QHBoxLayout() self.radioGroup = QButtonGroup() self.radioGroup.setExclusive(True) self.radio_ghost_target = QRadioButton() self.radio_ghost_target.setText("Ghost") self.radioGroup.addButton(self.radio_ghost_target, 0) self.radio_ghost_target.setChecked(True) self.radio_robot_target = QRadioButton() self.radio_robot_target.setText("Robot") self.radioGroup.addButton(self.radio_robot_target, 1) hbox_radio.addStretch() hbox_radio.addWidget(self.radio_ghost_target) hbox_radio.addStretch() hbox_radio.addWidget(self.radio_robot_target) hbox_radio.addStretch() radios.setLayout(hbox_radio) vbox.addWidget(radios) duration_box = QHBoxLayout() duration_box.setAlignment(Qt.AlignLeft) duration_box.addWidget(QLabel("Trajectory duration (s):")) self.traj_duration_spin = QDoubleSpinBox() self.traj_duration_spin.setValue(1.0) self.traj_duration_spin.valueChanged.connect(self.on_traj_duration_changed) duration_box.addWidget(self.traj_duration_spin) self.update_controllers_buttonn = QPushButton("Update Controllers") self.update_controllers_buttonn.pressed.connect(self.on_update_controllers) duration_box.addWidget(self.update_controllers_buttonn) vbox.addLayout(duration_box) widget = QWidget() hbox = QHBoxLayout() # Left to right layout self.joint_control = JointControl(self, hbox) widget.setLayout(hbox) vbox.addWidget(widget) print "Add buttons to apply all ..." all_widget = QWidget() all_box = QHBoxLayout() self.snap_to_ghost_button = QPushButton("SnapAllGhost") self.snap_to_ghost_button.pressed.connect(self.on_snap_ghost_pressed) all_box.addWidget(self.snap_to_ghost_button) self.snap_to_current_button = QPushButton("SnapAllCurrent") self.snap_to_current_button.pressed.connect(self.on_snap_current_pressed) all_box.addWidget(self.snap_to_current_button) self.apply_to_robot_button = QPushButton("ApplyAllRobot") self.apply_to_robot_button.pressed.connect(self.on_apply_robot_pressed) all_box.addWidget(self.apply_to_robot_button) self.apply_to_robot_button = QPushButton("Apply WBC Robot") self.apply_to_robot_button.pressed.connect(self.on_apply_wbc_robot_pressed) all_box.addWidget(self.apply_to_robot_button) all_widget.setLayout(all_box) vbox.addWidget(all_widget) override_box = QHBoxLayout() self.override = QCheckBox() self.override.setChecked(False) self.override.stateChanged.connect(self.on_override_changed) override_box.addWidget(self.override) override_label = QLabel("SAFETY OVERRIDE") override_label.setStyleSheet('QLabel { color: red }') override_box.addWidget(override_label) override_box.addStretch() vbox.addLayout(override_box) vbox.addStretch() self._widget.setLayout(vbox) self.first_time = True self.stateSubscriber = rospy.Subscriber('/joint_states', JointState, self.state_callback_fnc) self.ghostSubscriber = rospy.Subscriber('/flor/ghost/get_joint_states', JointState, self.ghost_callback_fnc) self.wbc_robot_pub = rospy.Publisher('/flor/wbc_controller/joint_states', JointState, queue_size=10) self.time_last_update_state = time.time() self.time_last_update_ghost = time.time()
def __init__(self, context): super(SensorParamControlDialog, self).__init__(context) self.setObjectName('SensorParamControlDialog') self._widget = QWidget() vbox = QVBoxLayout() ### Multisense ### ms_groupbox = QGroupBox( "Multisense" ) ms_vbox = QVBoxLayout() ms_gain_hbox = QHBoxLayout() self.ms_gain_label = QLabel("Image Gain [1, 1, 8]") ms_gain_hbox.addWidget( self.ms_gain_label ) self.ms_gain = QDoubleSpinBox() self.ms_gain.setSingleStep(.01) self.ms_gain.setRange(1,8) ms_gain_hbox.addWidget( self.ms_gain ) ms_vbox.addLayout( ms_gain_hbox ) ms_exp_hbox = QHBoxLayout() self.ms_exp_auto = QCheckBox("Image Exposure [.03, 0.5]") ms_exp_hbox.addWidget( self.ms_exp_auto ) self.ms_exp = QDoubleSpinBox() self.ms_exp.setSingleStep( .001 ) self.ms_exp.setRange( .025,.5 ) ms_exp_hbox.addWidget( self.ms_exp ) ms_vbox.addLayout( ms_exp_hbox ) ms_spindle_hbox = QHBoxLayout() ms_spindle_label = QLabel("Spindle Speed [0, 5.2]") ms_spindle_hbox.addWidget( ms_spindle_label ) self.ms_spindle = QDoubleSpinBox() self.ms_spindle.setSingleStep(.01) self.ms_spindle.setRange( 0,15.2 ) ms_spindle_hbox.addWidget( self.ms_spindle ) ms_vbox.addLayout( ms_spindle_hbox ) ms_light_hbox = QHBoxLayout() ms_light_label = QLabel("Light Brightness") ms_light_hbox.addWidget(ms_light_label) self.ms_light = QSlider(Qt.Horizontal) self.ms_light.setRange(0,100) ms_light_hbox.addWidget( self.ms_light ) ms_vbox.addLayout( ms_light_hbox ) ms_button_hbox = QHBoxLayout() ms_button_hbox.addStretch(1) ms_button_get = QPushButton("Get Settings") ms_button_get.pressed.connect(self.ms_get_callback) #ms_button_hbox.addWidget( ms_button_get ) ms_button_set = QPushButton("Set Settings") ms_button_set.pressed.connect(self.ms_set_callback) ms_button_hbox.addWidget( ms_button_set ) ms_vbox.addLayout( ms_button_hbox ) ms_groupbox.setLayout( ms_vbox ) vbox.addWidget( ms_groupbox ) ### Left SA ### sa_left_groupbox = QGroupBox( "Left SA Camera" ) sa_left_vbox = QVBoxLayout() sa_left_gain_hbox = QHBoxLayout() sa_left_gain_label = QLabel("Image Gain [0, 0, 25]") sa_left_gain_hbox.addWidget( sa_left_gain_label ) self.sa_left_gain = QDoubleSpinBox() self.sa_left_gain.setSingleStep(.01) self.sa_left_gain.setRange( 0, 25 ) sa_left_gain_hbox.addWidget( self.sa_left_gain ) sa_left_vbox.addLayout( sa_left_gain_hbox ) sa_left_exp_hbox = QHBoxLayout() sa_left_exp_label = QLabel("Image Shutter [0, 5.5, 25]") sa_left_exp_hbox.addWidget( sa_left_exp_label ) self.sa_left_exp = QDoubleSpinBox() self.sa_left_exp.setSingleStep(.01) self.sa_left_exp.setRange( 0, 25 ) sa_left_exp_hbox.addWidget( self.sa_left_exp ) sa_left_vbox.addLayout( sa_left_exp_hbox ) sa_left_button_hbox = QHBoxLayout() sa_left_button_hbox.addStretch(1) sa_left_button_get = QPushButton("Get Settings") sa_left_button_get.pressed.connect(self.sa_left_get_callback) #sa_left_button_hbox.addWidget( sa_left_button_get ) sa_left_button_set = QPushButton("Set Settings") sa_left_button_set.pressed.connect(self.sa_left_set_callback) sa_left_button_hbox.addWidget( sa_left_button_set ) sa_left_vbox.addLayout( sa_left_button_hbox ) sa_left_groupbox.setLayout( sa_left_vbox ) vbox.addWidget(sa_left_groupbox) ### Right SA ### sa_right_groupbox = QGroupBox( "Right SA Camera" ) sa_right_vbox = QVBoxLayout() sa_right_gain_hbox = QHBoxLayout() sa_right_gain_label = QLabel("Image Gain [0, 0, 25]") sa_right_gain_hbox.addWidget( sa_right_gain_label ) self.sa_right_gain = QDoubleSpinBox() self.sa_right_gain.setSingleStep(.01) self.sa_right_gain.setRange( 0, 25 ) sa_right_gain_hbox.addWidget( self.sa_right_gain ) sa_right_vbox.addLayout( sa_right_gain_hbox ) sa_right_exp_hbox = QHBoxLayout() sa_right_exp_label = QLabel("Image Shutter [0, 5.5, 25]") sa_right_exp_hbox.addWidget( sa_right_exp_label ) self.sa_right_exp = QDoubleSpinBox() self.sa_right_exp.setSingleStep(.01) self.sa_right_exp.setRange( 0, 25 ) sa_right_exp_hbox.addWidget( self.sa_right_exp ) sa_right_vbox.addLayout( sa_right_exp_hbox ) sa_right_button_hbox = QHBoxLayout() sa_right_button_hbox.addStretch(1) sa_right_button_get = QPushButton("Get Settings") sa_right_button_get.pressed.connect(self.sa_right_get_callback) #sa_right_button_hbox.addWidget( sa_right_button_get ) sa_right_button_set = QPushButton("Set Settings") sa_right_button_set.pressed.connect(self.sa_right_set_callback) sa_right_button_hbox.addWidget( sa_right_button_set ) sa_right_vbox.addLayout( sa_right_button_hbox ) sa_right_groupbox.setLayout( sa_right_vbox ) vbox.addWidget(sa_right_groupbox) vbox.addStretch(1) self._widget.setLayout(vbox) context.add_widget(self._widget) # publishers and subscribers self.ms_cam_pub = rospy.Publisher( '/multisense_sl/set_cam_parameters', Float64MultiArray, queue_size=10) self.ms_light_pub = rospy.Publisher( '/multisense_sl/set_light_brightness', Float64, queue_size=10) self.ms_spindle_pub = rospy.Publisher( '/multisense_sl/set_spindle_speed', Float64, queue_size=10) self.sa_left_cam_pub = rospy.Publisher( '/sa/left/set_cam_parameters', Float64MultiArray, queue_size=10) self.sa_right_cam_pub = rospy.Publisher( '/sa/right/set_cam_parameters', Float64MultiArray, queue_size=10)
def __init__(self, context): # super(BDIPelvisPoseWidget, self).__init__(context) # self.setObjectName('BDIPelvisPoseWidget') super(BDIPelvisPoseWidget, self).__init__() self.name = "BDIPelvisPoseWidget" self.updateStateSignal.connect(self.on_updateState) # self._widget = QWidget() self._widget = context vbox = QVBoxLayout() self.forward_position = 0.0 self.lateral_position = 0.0 self.height_position = 0.91 self.roll_position = 0.0 self.pitch_position = 0.0 self.yaw_position = 0.0 self.currentForward = 0.0 self.currentLateral = 0.0 self.currentHeight = 0.91 self.currentRoll = 0.0 self.currentPitch = 0.0 self.currentYaw = 0.0 # Define checkboxes vbox = QVBoxLayout() label = QLabel() label.setText("BDI Pelvis Height (Manipulate Mode Only)") # todo - connect controller mode vbox.addWidget(label) self.enable_checkbox = QCheckBox("Enable") self.enable_checkbox.stateChanged.connect(self.on_enable_check) vbox.addWidget(self.enable_checkbox) self.snap_to_current_button = QPushButton("Snap to Current") self.snap_to_current_button.pressed.connect(self.on_snapCurrentPressed) vbox.addWidget(self.snap_to_current_button) self.roll_slider = QSlider(Qt.Horizontal) self.roll_label = QLabel() self.roll_label.setText("Roll") vbox.addWidget(self.roll_label) self.roll_slider.setRange(int(-100), int(101)) self.roll_slider.setValue(int(0)) self.roll_slider.setSingleStep((200) / 50) self.roll_slider.setTickInterval(25) self.roll_slider.valueChanged.connect(self.on_rollSliderMoved) vbox.addWidget(self.roll_slider) self.roll_progress_bar = QProgressBar() self.roll_progress_bar.setRange(int(-100), int(101)) self.roll_progress_bar.setValue((6.0 / math.pi) * self.currentRoll * 100) self.roll_progress_bar.setFormat("%.6f" % self.currentRoll) vbox.addWidget(self.roll_progress_bar) self.pitch_slider = QSlider(Qt.Horizontal) self.pitch_label = QLabel() self.pitch_label.setText("Pitch") vbox.addWidget(self.pitch_label) self.pitch_slider.setRange(int(-100), int(101)) self.pitch_slider.setValue(int(0)) self.pitch_slider.setSingleStep((200) / 50) self.pitch_slider.setTickInterval(25) self.pitch_slider.valueChanged.connect(self.on_pitchSliderMoved) vbox.addWidget(self.pitch_slider) self.pitch_progress_bar = QProgressBar() self.pitch_progress_bar.setRange(int(-100), int(101)) self.pitch_progress_bar.setValue((6.0 / math.pi) * self.currentPitch * 100) self.pitch_progress_bar.setFormat("%.6f" % self.currentPitch) vbox.addWidget(self.pitch_progress_bar) self.yaw_slider = QSlider(Qt.Horizontal) self.yaw_label = QLabel() self.yaw_label.setText("Yaw") vbox.addWidget(self.yaw_label) self.yaw_slider.setRange(int(-100), int(101)) self.yaw_slider.setValue(int(0)) self.yaw_slider.setSingleStep((200) / 50) self.yaw_slider.setTickInterval(25) self.yaw_slider.valueChanged.connect(self.on_yawSliderMoved) vbox.addWidget(self.yaw_slider) self.yaw_progress_bar = QProgressBar() self.yaw_progress_bar.setRange(int(-100), int(101)) self.yaw_progress_bar.setValue((4.0 / math.pi) * self.currentYaw * 100) self.yaw_progress_bar.setFormat("%.6f" % self.currentYaw) vbox.addWidget(self.yaw_progress_bar) self.forward_label = QLabel() self.forward_label.setText("Forward") vbox.addWidget(self.forward_label) widget = QWidget() hbox = QHBoxLayout() hbox.addStretch() self.forward_slider = QSlider(Qt.Vertical) # self.forward_slider.setText("Height") self.forward_slider.setRange(int(-101), int(100)) self.forward_slider.setValue(int(0)) self.forward_slider.setSingleStep(1) self.forward_slider.setTickInterval(10) self.forward_slider.valueChanged.connect(self.on_forwardSliderMoved) hbox.addWidget(self.forward_slider) self.forward_progress_bar = QProgressBar() self.forward_progress_bar.setOrientation(Qt.Vertical) self.forward_progress_bar.setRange(int(-100), int(101)) self.forward_progress_bar.setValue((self.currentForward / 0.075) * 100) self.forward_progress_bar.setTextVisible(False) hbox.addWidget(self.forward_progress_bar) self.forward_progress_bar_label = QLabel() self.forward_progress_bar_label.setText("%.6f" % self.currentForward) hbox.addWidget(self.forward_progress_bar_label) hbox.addStretch() widget.setLayout(hbox) vbox.addWidget(widget) self.lateral_label = QLabel() self.lateral_label.setText("Lateral") vbox.addWidget(self.lateral_label) self.lateral_slider = QSlider(Qt.Horizontal) # self.lateral_slider.setText("Lateral") self.lateral_slider.setRange(int(-100), int(101)) self.lateral_slider.setValue(int(0)) self.lateral_slider.setSingleStep((200) / 50) self.lateral_slider.setTickInterval(25) self.lateral_slider.valueChanged.connect(self.on_lateralSliderMoved) vbox.addWidget(self.lateral_slider) self.lateral_progress_bar = QProgressBar() self.lateral_progress_bar.setRange(int(-100), int(101)) self.lateral_progress_bar.setValue((self.currentLateral / 0.15) * 100) self.lateral_progress_bar.setFormat("%.6f" % self.currentLateral) vbox.addWidget(self.lateral_progress_bar) self.height_label = QLabel() self.height_label.setText("Height") vbox.addWidget(self.height_label) widget = QWidget() hbox = QHBoxLayout() hbox.addStretch() self.height_slider = QSlider(Qt.Vertical) # self.height_slider.setText("Height") self.height_slider.setRange(int(55), int(105)) self.height_slider.setValue(int(91)) self.height_slider.setSingleStep(2) self.height_slider.setTickInterval(10) self.height_slider.valueChanged.connect(self.on_heightSliderMoved) hbox.addWidget(self.height_slider) self.height_progress_bar = QProgressBar() self.height_progress_bar.setOrientation(Qt.Vertical) self.height_progress_bar.setRange(int(55), int(105)) self.height_progress_bar.setValue(self.currentHeight * 100) self.height_progress_bar.setTextVisible(False) hbox.addWidget(self.height_progress_bar) self.height_progress_bar_label = QLabel() self.height_progress_bar_label.setText("%.6f" % self.currentHeight) hbox.addWidget(self.height_progress_bar_label) hbox.addStretch() widget.setLayout(hbox) vbox.addWidget(widget) vbox.addStretch() self._widget.setLayout(vbox) # context.add_widget(self._widget) self.height_position = 0.91 self.lateral_position = 0.0 self.yaw_position = 0.0 self.first_time = True self.enable_checkbox.setChecked(False) self.yaw_slider.setEnabled(False) self.roll_slider.setEnabled(False) self.pitch_slider.setEnabled(False) self.forward_slider.setEnabled(False) self.lateral_slider.setEnabled(False) self.height_slider.setEnabled(False) self.pub_robot = rospy.Publisher("/flor/controller/bdi_desired_pelvis_pose", PoseStamped, queue_size=10) # self.stateSubscriber = rospy.Subscriber('/flor/pelvis_controller/current_states',JointState, self.stateCallbackFnc) # self.pub_bdi_pelvis = rospy.Publisher('/bdi_manipulate_pelvis_pose_rpy',PoseStamped) self.pelvis_trajectory_pub = rospy.Publisher( "/robot_controllers/pelvis_traj_controller/command", JointTrajectory, queue_size=10 ) self.stateSubscriber = rospy.Subscriber( "/robot_controllers/pelvis_traj_controller/state", JointTrajectoryControllerState, self.stateCallbackFnc )
def __init__(self, context): super(NoLimitJointControlDialog, self).__init__(context) self.setObjectName('NoLimitJointControlDialog') self.updateStateSignal.connect(self.on_updateState) self.updateGhostSignal.connect(self.on_updateGhost) self.joint_states = JointState() self.ghost_joint_states = JointState() self._widget = QWidget() vbox = QVBoxLayout() # Define checkboxes radios = QWidget(); hbox_radio = QHBoxLayout() self.radioGroup = QButtonGroup() self.radioGroup.setExclusive(True) self.radio_ghost_target = QRadioButton() self.radio_ghost_target.setText("Ghost") self.radioGroup.addButton(self.radio_ghost_target,0) self.radio_ghost_target.setChecked(True) self.radio_robot_target = QRadioButton() self.radio_robot_target.setText("Robot") self.radioGroup.addButton(self.radio_robot_target,1) hbox_radio.addStretch() hbox_radio.addWidget(self.radio_ghost_target) #hbox_radio.addWidget(QLabel("Ghost")) hbox_radio.addStretch() hbox_radio.addWidget(self.radio_robot_target) #hbox_radio.addWidget(QLabel("Robot")) hbox_radio.addStretch() radios.setLayout(hbox_radio) vbox.addWidget(radios) widget = QWidget() hbox = QHBoxLayout() # Left to right layout self.joint_control = NoLimitJointControl(self, roslib.packages.get_pkg_dir('vigir_rqt_no_limit_joint_control') + '/launch/joints.txt',hbox) widget.setLayout(hbox) vbox.addWidget(widget) print "Add buttons to apply all ..." all_widget = QWidget() all_box = QHBoxLayout() self.snap_to_ghost_button = QPushButton("SnapAllGhost") self.snap_to_ghost_button.pressed.connect(self.on_snapGhostPressed) all_box.addWidget(self.snap_to_ghost_button) self.snap_to_current_button = QPushButton("SnapAllCurrent") self.snap_to_current_button.pressed.connect(self.on_snapCurrentPressed) all_box.addWidget(self.snap_to_current_button) self.apply_to_robot_button = QPushButton("ApplyAllRobot") self.apply_to_robot_button.pressed.connect(self.on_applyRobotPressed) all_box.addWidget(self.apply_to_robot_button) self.apply_to_robot_button = QPushButton("Apply WBC Robot") self.apply_to_robot_button.pressed.connect(self.on_applyWBCRobotPressed) all_box.addWidget(self.apply_to_robot_button) all_widget.setLayout(all_box) vbox.addWidget(all_widget) # all_hbox = QHBoxLayout() # all_hbox.addStretch() # all_hbox.addWidget(all_widget) # all_hbox.addStretch() # bottom_widget=QWidget() # bottom_widget.setLayout(all_jbox) # vbox.addWidget(bottom_widget) vbox.addStretch() self._widget.setLayout(vbox) context.add_widget(self._widget) self.first_time = True self.stateSubscriber = rospy.Subscriber('/atlas/joint_states', JointState, self.stateCallbackFnc) self.ghostSubscriber = rospy.Subscriber('/flor/ghost/get_joint_states', JointState, self.ghostCallbackFnc) self.wbc_robot_pub = rospy.Publisher('/flor/wbc_controller/joint_states',JointState, queue_size=10)
class LogicalMarkerPlugin(Plugin): def __init__(self, context): super(LogicalMarkerPlugin, self).__init__(context) # Create an image for the original map. This will never change. try: self.map_yaml_file_str = rospy.get_param("~map_file") self.data_directory = rospy.get_param("~data_directory") except KeyError: rospy.logfatal("~map_file and ~data_directory need to be set to use the logical marker") return map_image_location = getImageFileLocation(self.map_yaml_file_str) map = loadMapFromFile(self.map_yaml_file_str) locations_file = getLocationsFileLocationFromDataDirectory(self.data_directory) doors_file = getDoorsFileLocationFromDataDirectory(self.data_directory) objects_file = getObjectsFileLocationFromDataDirectory(self.data_directory) # Give QObjects reasonable names self.setObjectName('LogicalMarkerPlugin') # Create QWidget self.master_widget = QWidget() self.master_layout = QVBoxLayout(self.master_widget) # Main Functions - Doors, Locations, Objects self.function_layout = QHBoxLayout() self.master_layout.addLayout(self.function_layout) self.function_buttons = [] self.current_function = None for button_text in ['Locations', 'Doors', 'Objects']: button = QPushButton(button_text, self.master_widget) button.clicked[bool].connect(self.handle_function_button) button.setCheckable(True) self.function_layout.addWidget(button) self.function_buttons.append(button) self.function_layout.addStretch(1) self.master_layout.addWidget(self.get_horizontal_line()) # Subfunction toolbar self.subfunction_layout = QHBoxLayout() clearLayoutAndFixHeight(self.subfunction_layout) self.master_layout.addLayout(self.subfunction_layout) self.current_subfunction = None self.master_layout.addWidget(self.get_horizontal_line()) self.image = MapImage(map_image_location, self.master_widget) self.master_layout.addWidget(self.image) self.master_layout.addWidget(self.get_horizontal_line()) # Configuration toolbar self.configuration_layout = QHBoxLayout() clearLayoutAndFixHeight(self.configuration_layout) self.master_layout.addLayout(self.configuration_layout) # Add a stretch at the bottom. self.master_layout.addStretch(1) self.master_widget.setObjectName('LogicalMarkerPluginUI') if context.serial_number() > 1: self.master_widget.setWindowTitle(self.master_widget.windowTitle() + (' (%d)' % context.serial_number())) context.add_widget(self.master_widget) # Activate the functions self.functions = {} self.functions['Locations'] = LocationFunction(locations_file, map, self.master_widget, self.subfunction_layout, self.configuration_layout, self.image) self.functions['Doors'] = DoorFunction(doors_file, map, self.functions['Locations'], self.master_widget, self.subfunction_layout, self.configuration_layout, self.image) self.functions['Objects'] = ObjectFunction(objects_file, map, self.functions['Locations'], self.master_widget, self.subfunction_layout, self.configuration_layout, self.image) def construct_layout(self): pass def get_horizontal_line(self): """ http://stackoverflow.com/questions/5671354/how-to-programmatically-make-a-horizontal-line-in-qt """ hline = QFrame() hline.setFrameShape(QFrame.HLine) hline.setFrameShadow(QFrame.Sunken) return hline def handle_function_button(self): source = self.sender() if source.text() == self.current_function: source.setChecked(True) return # Depress all other buttons. for button in self.function_buttons: if button != source: button.setChecked(False) if self.current_function is not None: self.functions[self.current_function].deactivateFunction() self.current_function = source.text() # Clear all subfunction buttons. clearLayoutAndFixHeight(self.subfunction_layout) if self.current_function is not None: self.functions[self.current_function].activateFunction() def shutdown_plugin(self): modified = False for function in self.functions: if self.functions[function].isModified(): modified = True if modified: ret = QMessageBox.warning(self.master_widget, "Save", "The logical map has been modified.\n" "Do you want to save your changes?", QMessageBox.Save | QMessageBox.Discard) if ret == QMessageBox.Save: for function in self.functions: self.functions[function].saveConfiguration() def save_settings(self, plugin_settings, instance_settings): pass def restore_settings(self, plugin_settings, instance_settings): pass
class LogicalMarkerPlugin(Plugin): def __init__(self, context): super(LogicalMarkerPlugin, self).__init__(context) # Create an image for the original map. This will never change. try: self.map_yaml_file_str = rospy.get_param("~map_file") self.data_directory = rospy.get_param("~data_directory") except KeyError: rospy.logfatal( "~map_file and ~data_directory need to be set to use the logical marker" ) return map_image_location = getImageFileLocation(self.map_yaml_file_str) map = loadMapFromFile(self.map_yaml_file_str) locations_file = getLocationsFileLocationFromDataDirectory( self.data_directory) doors_file = getDoorsFileLocationFromDataDirectory(self.data_directory) objects_file = getObjectsFileLocationFromDataDirectory( self.data_directory) # Give QObjects reasonable names self.setObjectName('LogicalMarkerPlugin') # Create QWidget self.master_widget = QWidget() self.master_layout = QVBoxLayout(self.master_widget) # Main Functions - Doors, Locations, Objects self.function_layout = QHBoxLayout() self.master_layout.addLayout(self.function_layout) self.function_buttons = [] self.current_function = None for button_text in ['Locations', 'Doors', 'Objects']: button = QPushButton(button_text, self.master_widget) button.clicked[bool].connect(self.handle_function_button) button.setCheckable(True) self.function_layout.addWidget(button) self.function_buttons.append(button) self.function_layout.addStretch(1) self.master_layout.addWidget(self.get_horizontal_line()) # Subfunction toolbar self.subfunction_layout = QHBoxLayout() clearLayoutAndFixHeight(self.subfunction_layout) self.master_layout.addLayout(self.subfunction_layout) self.current_subfunction = None self.master_layout.addWidget(self.get_horizontal_line()) self.image = MapImage(map_image_location, self.master_widget) self.master_layout.addWidget(self.image) self.master_layout.addWidget(self.get_horizontal_line()) # Configuration toolbar self.configuration_layout = QHBoxLayout() clearLayoutAndFixHeight(self.configuration_layout) self.master_layout.addLayout(self.configuration_layout) # Add a stretch at the bottom. self.master_layout.addStretch(1) self.master_widget.setObjectName('LogicalMarkerPluginUI') if context.serial_number() > 1: self.master_widget.setWindowTitle( self.master_widget.windowTitle() + (' (%d)' % context.serial_number())) context.add_widget(self.master_widget) # Activate the functions self.functions = {} self.functions['Locations'] = LocationFunction( locations_file, map, self.master_widget, self.subfunction_layout, self.configuration_layout, self.image) self.functions['Doors'] = DoorFunction( doors_file, map, self.functions['Locations'], self.master_widget, self.subfunction_layout, self.configuration_layout, self.image) self.functions['Objects'] = ObjectFunction( objects_file, map, self.functions['Locations'], self.master_widget, self.subfunction_layout, self.configuration_layout, self.image) def construct_layout(self): pass def get_horizontal_line(self): """ http://stackoverflow.com/questions/5671354/how-to-programmatically-make-a-horizontal-line-in-qt """ hline = QFrame() hline.setFrameShape(QFrame.HLine) hline.setFrameShadow(QFrame.Sunken) return hline def handle_function_button(self): source = self.sender() if source.text() == self.current_function: source.setChecked(True) return # Depress all other buttons. for button in self.function_buttons: if button != source: button.setChecked(False) if self.current_function is not None: self.functions[self.current_function].deactivateFunction() self.current_function = source.text() # Clear all subfunction buttons. clearLayoutAndFixHeight(self.subfunction_layout) if self.current_function is not None: self.functions[self.current_function].activateFunction() def shutdown_plugin(self): modified = False for function in self.functions: if self.functions[function].isModified(): modified = True if modified: ret = QMessageBox.warning( self.master_widget, "Save", "The logical map has been modified.\n" "Do you want to save your changes?", QMessageBox.Save | QMessageBox.Discard) if ret == QMessageBox.Save: for function in self.functions: self.functions[function].saveConfiguration() def save_settings(self, plugin_settings, instance_settings): pass def restore_settings(self, plugin_settings, instance_settings): pass
def __init__(self, context): self.control_mode = 0 self.mode_pub = rospy.Publisher('/flor/controller/mode_command', VigirControlModeCommand, queue_size=10) self._widget = context self.vbox = QVBoxLayout() #Add input for setting the spindle speed list_label = QLabel("Select Control Mode") self.vbox.addWidget(list_label) # Indexed list of allowed control modes from feedback self.allowed_modes = rospy.get_param("/atlas_controller/allowed_control_modes") self.allowed_modes=rospy.get_param("/atlas_controller/allowed_control_modes") self.mode_ids={} self.mode_ids for ndx,txt in enumerate(self.allowed_modes): self.mode_ids[txt] = ndx # API 2.13 ordering self.bdi_mode_names=['NONE ', 'FREEZE ', 'STAND_PREP ', \ 'STAND ', 'WALK ', 'STEP ', 'MANIPULATE ', \ 'USER ', 'CALIBRATE '] self.list_box = QListWidget(None) self.list_box.addItems(self.allowed_modes) self.list_box.currentItemChanged.connect(self.handle_selection_change) self.vbox.addWidget(self.list_box) self.selection_label = QLabel("Flor Selected: "+self.allowed_modes[0]+"("+str(self.control_mode)+")") self.vbox.addWidget(self.selection_label) self.label = QLabel("Flor Command : "+self.allowed_modes[0]+"("+str(self.control_mode)+")") self.vbox.addWidget(self.label) self.flor_mode = 0 self.bdi_current_mode = 0 self.bdi_desired_mode = 0 self.flor_mode_label = QLabel("Flor Mode : "+self.allowed_modes[self.flor_mode]+"("+str(self.flor_mode)+")"+" BDI:("+str(self.bdi_current_mode)+", "+str(self.bdi_desired_mode)+")") self.vbox.addWidget(self.flor_mode_label) #Add combo box for available settings self.available_modes = QComboBox(); self.available_modes.addItem(""); self.available_modes.addItem("BDI"); self.available_modes.addItem("Enable Upper Body"); self.available_modes.addItem("Enable Whole Body"); self.available_modes.currentIndexChanged.connect(self.handle_avail_modes_changed) self.vbox.addWidget(self.available_modes); self.vbox.addStretch(1) #Add Button for sending the behavior mode command self.push_button = QPushButton("Set Mode") self.push_button.clicked.connect(self.handle_set_mode) self.vbox.addWidget(self.push_button) self.vbox.addStretch(1) hbox = QHBoxLayout() hbox.addStretch(1) self.stop_enable= QCheckBox() self.stop_enable.setChecked(False) hbox.addWidget(self.stop_enable) self.stop_enable.clicked.connect(self.handle_stop_enable) self.stop_button = QPushButton("STOP!") self.stop_button.clicked.connect(self.handle_stop) self.stop_button.setStyleSheet('QPushButton {background-color: gray }') hbox.addWidget(self.stop_button) hbox.addStretch(1) self.vbox.addLayout(hbox) self._widget.setLayout(self.vbox) #add stretch at end so all GUI elements are at top of dialog self.vbox.addStretch(1) self.flor_mode_cmd_sub = rospy.Subscriber("/flor/controller/mode", FlorControlMode, self.florModeCallback)