def reset_curve_config(self): self.ui.nameLineEdit.setText(self.model.selected_curve.name) self.ui.enabledCheckBox.setChecked(self.model.selected_curve.enabled) self.ui.cbxKey.setCurrentText(self.model.selected_curve.key) self.ui.edit_lambda.setText(self.model.selected_curve.key_lambda) ui_utils.reset_textField_color(self.ui.edit_color, self.model.selected_curve.color)
def reset_curve_config(self): self.nameLineEdit.setText(self.selected_curve_config["name"]) self.enabledCheckBox.setChecked(self.selected_curve_config["enabled"]) self.cbxKey.setCurrentText(self.selected_curve_config["key"]) self.edit_lambda.setText(self.selected_curve_config["key_lambda"]) ui_utils.reset_textField_color(self.edit_color, self.selected_curve_config["color"])
def __init__(self, nao: nao.Nao, model: PlotModel): super(Plot, self).__init__() self.nao = nao self.identifier = uuid.uuid4() self.model = model """ self.data contains the data of curves. each curve data is a deque in this list: deque: - dict - "y": value # this key should be called 'y'; pyqtgraph - "timestamp": time received deque: .... """ self.data = [] self.should_update = False pg.setConfigOption('background', 'w') pg.setConfigOption('foreground', 'k') self.ui = Ui_PlotView() self.ui.setupUi(self) self.ui.cbxKey.completer().setFilterMode(qtc.Qt.MatchContains) self.ui.cbxKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) self.ui.spin_fps.valueChanged.connect(self.set_fps) self.ui.spin_buffer.valueChanged.connect(self.set_buffer_size) self.ui.legendCheckBox.stateChanged.connect(self.set_show_legend) self.ui.listWidget.itemSelectionChanged.connect(self.select_curve) self.ui.btnAccept.clicked.connect(self.accept) self.ui.btnDiscard.clicked.connect(self.discard) self.ui.btnAddCurve.clicked.connect(self.add_curve) self.ui.btnDeleteCurve.clicked.connect(self.delete_curve) self.ui.btnColor.clicked.connect(self.select_color) self.ui.btnSnap.clicked.connect(self.snap) self.ui.edit_color.returnPressed.connect( lambda: ui_utils.reset_textField_color(self.ui.edit_color, self.ui.edit_color.text())) self.update_list() self.timer = qtc.QTimer() self.timer.timeout.connect(self.update) self.reset_fps_spin() self.reset_buffer_size_spin() self.reset_show_legend() self.ui.tabWidget.currentChanged.connect(self.tab_changed) self.ui.tabWidget.setCurrentIndex(self.model.selected_tab.value) self.updateSignal.connect(self.data_received) if self.nao.is_connected(): self.connect(self.nao)
def __init__(self, main_window, nao: Nao, model=None): super(Main, self).__init__(main_window, self.name, nao) ui_utils.loadUi(__file__, self) self.model = ui_utils.load_model( os.path.dirname(__file__) + "/model.json", model) """ self.data contains the data of curves. each curve data is a deque in this list: deque: - dict - "y": value # this key should be called 'y'; pyqtgraph - "timestamp": time received deque: .... """ self.data = {} self.should_update = False self.plots = [] self.cbxKey.completer().setFilterMode(qtc.Qt.MatchContains) self.cbxKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) self.data_received_signal.connect(self.data_received) self.spinFps.valueChanged.connect(self.set_fps) self.spinBufferSize.valueChanged.connect(self.set_buffer_size) self.legendCheckBox.stateChanged.connect(self.set_show_legend) self.listWidget.itemSelectionChanged.connect(self.select_curve) self.btnAccept.clicked.connect(self.accept) self.btnDiscard.clicked.connect(self.discard) self.btnAddCurve.clicked.connect(self.add_curve) self.btnDeleteCurve.clicked.connect(self.delete_curve) self.btnColor.clicked.connect(self.select_color) self.btnSnap.clicked.connect(self.snap) self.edit_color.returnPressed.connect( lambda: ui_utils.reset_textField_color(self.edit_color, self.edit_color.text())) self.update_list() self.timer = qtc.QTimer() self.timer.timeout.connect(self.update) self.reset_fps_spin() self.reset_buffer_size_spin() self.reset_show_legend() self.tabWidget.currentChanged.connect(self.tab_changed) self.tabWidget.setCurrentIndex(self.model["selected_tab"]) self._init_datalist() self._init_plot() self.data_received_signal.connect(self.data_received) if self.nao.is_connected(): self.connect(self.nao)
def __init__(self, layer_model, parent, update_callback, nao: Nao): super(Config, self).__init__(parent) ui_utils.loadUi(__file__, self) self.layer_model = ui_utils.load_model( os.path.dirname(__file__) + "/model.json", layer_model) self.update_callback = update_callback self.nao = nao self.identifier = uuid.uuid4() self.config_to_ui = { "center_x": (lambda: self.spin_center_x.value(), lambda value: self.spin_center_x.setValue(value)), "center_y": (lambda: self.spin_center_y.value(), lambda value: self.spin_center_y.setValue(value)), "transformation": (lambda: { "key": self.cbx_TransformationKey.currentText(), "key_lambda": self.edit_TransformationKeyLambda.toPlainText() }, lambda config: [ self.cbx_TransformationKey.setCurrentText(config["key"]), self.edit_TransformationKeyLambda.setPlainText(config[ "key_lambda"]) ]), "motionPlan": (lambda: { "key": self.cbx_MotionPlannerKey.currentText(), "key_lambda": self.edit_MotionPlannerKeyLambda.toPlainText(), "targetCircleDiameter": self.spin_targetCircleDiameter.value( ), "targetColor": self.edit_targetColor.text() }, lambda config: [ self.cbx_MotionPlannerKey.setCurrentText(config["key"]), self.edit_MotionPlannerKeyLambda.setPlainText(config[ "key_lambda"]), self.spin_targetCircleDiameter.setValue(config[ "targetCircleDiameter"]), ui_utils.reset_textField_color(self.edit_targetColor, config[ "targetColor"]) ]) } self.cbx_TransformationKey.completer().setFilterMode( qtc.Qt.MatchContains) self.cbx_TransformationKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) self.cbx_MotionPlannerKey.completer().setFilterMode( qtc.Qt.MatchContains) self.cbx_MotionPlannerKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) ui_utils.init_Color_UI(self.btn_targetColor, self.edit_targetColor) self.btnAccept.pressed.connect(self.accept) self.btnDiscard.pressed.connect(self.discard) self.reset_widgets() if self.nao.is_connected(): self.connect(self.nao)
def __init__(self, layer, parent, update_callback, nao: nao.Nao): super(PoseConfig, self).__init__(parent) self.nao = nao self.layer = layer self.update_callback = update_callback self.identifier = uuid.uuid4() self.ui = Ui_PoseConfig() self.ui.setupUi(self) if self.layer["settings"] is None: self.layer["settings"] = { "center_x": 5.2, "center_y": -3.7, "transformation": { "key": "None", "key_lambda": "output=intput" }, "pose": { "key": "Brain.RobotPosition", "keyLambda": 'output = input["pose"]', "positionCircleDiameter": 0.35, "orientationLineLength": 0.35, "color": "#ffffff" }, "fov": { "jointSensorDataKey": "Motion.JointSensorData", "jointSensorDataKeyLambda": 'output = input["angles"]', "maxDistance": 2.5, "cameraOpeningAngle": 60.97 } } self.settings_to_ui = { "center_x": (lambda: self.ui.spin_center_x.value(), lambda value: self.ui.spin_center_x.setValue(value)), "center_y": (lambda: self.ui.spin_center_y.value(), lambda value: self.ui.spin_center_y.setValue(value)), "transformation": (lambda: { "key": self.ui.cbx_TransformationKey.currentText(), "key_lambda": self.ui.edit_TransformationKeyLambda.toPlainText( ), }, lambda settings: [ self.ui.cbx_TransformationKey.setCurrentText(settings["key"]), self.ui.edit_TransformationKeyLambda.setPlainText(settings[ "key_lambda"]), ]), "pose": (lambda: { "key": self.ui.cbx_PoseKey.currentText(), "keyLambda": self.ui.edit_poseKeyLambda.toPlainText(), "positionCircleDiameter": self.ui.spin_positionCircleDiameter.value(), "orientationLineLength": self.ui.spin_orientationLineLength.value(), "color": self.ui.edit_poseColor.text() }, lambda settings: [ self.ui.cbx_PoseKey.setCurrentText(settings["key"]), self.ui.edit_poseKeyLambda.setPlainText(settings["keyLambda"]), self.ui.spin_positionCircleDiameter.setValue(settings[ "positionCircleDiameter"]), self.ui.spin_orientationLineLength.setValue(settings[ "orientationLineLength"]), ui_utils.reset_textField_color(self.ui.edit_poseColor, settings["color"]) ]), "fov": (lambda: { "jointSensorDataKey": self.ui.cbx_JointSensorDataKey.currentText(), "jointSensorDataKeyLambda": self.ui.edit_jointSensorDataKeyLambda.toPlainText(), "maxDistance": self.ui.spin_maxDistance.value(), "cameraOpeningAngle": self.ui.spin_cameraOpeningAngle.value() }, lambda settings: [ self.ui.cbx_JointSensorDataKey.setCurrentText(settings[ "jointSensorDataKey"]), self.ui.edit_jointSensorDataKeyLambda.setPlainText(settings[ "jointSensorDataKeyLambda"]), self.ui.spin_maxDistance.setValue(settings["maxDistance"]), self.ui.spin_cameraOpeningAngle.setValue(settings[ "cameraOpeningAngle"]) ]) } self.ui.cbx_PoseKey.completer().setFilterMode(qtc.Qt.MatchContains) self.ui.cbx_PoseKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) self.ui.cbx_TransformationKey.completer().setFilterMode( qtc.Qt.MatchContains) self.ui.cbx_TransformationKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) self.ui.cbx_JointSensorDataKey.completer().setFilterMode( qtc.Qt.MatchContains) self.ui.cbx_JointSensorDataKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) ui_utils.init_Color_UI(self.ui.btn_poseColor, self.ui.edit_poseColor) self.ui.btnAccept.pressed.connect(self.accept) self.ui.btnDiscard.pressed.connect(self.discard) self.reset_widgets() if self.nao.is_connected(): self.connect(self.nao)
def __init__(self, layer, parent, update_callback, nao: nao.Nao): super(SelfPlayerConfig, self).__init__(parent) self.nao = nao self.layer = layer self.update_callback = update_callback self.identifier = uuid.uuid4() self.ui = Ui_SelfPlayerConfig() self.ui.setupUi(self) if self.layer["settings"] is None: self.layer["settings"] = { "center_x": 5.2, "center_y": -3.7, "pose": { "key": "Brain.RobotPosition", "keyLambda": 'output = input["pose"]', "drawPose": True, "positionCircleDiameter": 0.28, "orientationLineLength": 0.28, "drawPlayerNumber": True, "fixedColor": "#ffffff", "useFixedColor": False, "roleKey": "Brain.PlayingRoles", "roleKeyLambda": 'output = input["role"]', "defaultColor": "#ffffff", "keeperColor": "#0000ff", "defenderColor": "#00ff00", "supporterColor": "#ff00ff", "strikerColor": "#ff0000", "bishopColor": "#ffff00", "replacement_keeperColor": "#00ffff" }, "fov": { "jointSensorDataKey": "Motion.JointSensorData", "jointSensorDataKeyLambda": 'output = input["angles"]', "drawFOV": True, "maxDistance": 2.5, "cameraOpeningAngle": 60.97 }, "motionPlan": { "key": "Brain.MotionPlanner", "keyLambda": "output = input", "drawMotionPlan": True, "targetCircleDiameter": 0.28, "drawTranslation": False, "translationColor": "#ff0000" }, "ballSearch": { "key": "Brain.BallSearchPosition", "keyLambda": 'output = input["searchPosition"]', "drawSearchTarget": False, "searchCircleDiameter": 0.60 } } self.settings_to_ui = { "center_x": (lambda: self.ui.spin_center_x.value(), lambda value: self.ui.spin_center_x.setValue(value)), "center_y": (lambda: self.ui.spin_center_y.value(), lambda value: self.ui.spin_center_y.setValue(value)), "pose": (lambda: { "key": self.ui.cbx_PoseKey.currentText(), "keyLambda": self.ui.edit_poseKeyLambda.toPlainText(), "drawPose": self.ui.drawPoseCheckBox.isChecked(), "positionCircleDiameter": self.ui.spin_positionCircleDiameter.value(), "orientationLineLength": self.ui.spin_orientationLineLength.value(), "fixedColor": self.ui.edit_fixedColor.text(), "useFixedColor": self.ui.useFixedColorCheckBox.isChecked(), "roleKey": self.ui.cbx_RoleKey.currentText(), "roleKeyLambda": self.ui.edit_roleKeyLambda.toPlainText(), "defaultColor": self.ui.edit_defaultColor.text(), "keeperColor": self.ui.edit_keeperColor.text(), "defenderColor": self.ui.edit_defenderColor.text(), "supporterColor": self.ui.edit_supporterColor.text(), "strikerColor": self.ui.edit_strikerColor.text(), "bishopColor": self.ui.edit_bishopColor.text(), "replacement_keeperColor": self.ui.edit_replacementKeeperColor.text() }, lambda settings: [ self.ui.cbx_PoseKey.setCurrentText(settings["key"]), self.ui.edit_poseKeyLambda.setPlainText(settings["keyLambda"]), self.ui.drawPoseCheckBox.setChecked(settings["drawPose"]), self.ui.spin_positionCircleDiameter.setValue(settings[ "positionCircleDiameter"]), self.ui.spin_orientationLineLength.setValue(settings[ "orientationLineLength"]), ui_utils.reset_textField_color(self.ui.edit_fixedColor, settings["fixedColor"]), self.ui.useFixedColorCheckBox.setChecked(settings[ "useFixedColor"]), self.ui.cbx_RoleKey.setCurrentText(settings["roleKey"]), self.ui.edit_roleKeyLambda.setPlainText(settings[ "roleKeyLambda"]), ui_utils.reset_textField_color(self.ui.edit_defaultColor, settings["defaultColor"]), ui_utils.reset_textField_color(self.ui.edit_keeperColor, settings["keeperColor"]), ui_utils.reset_textField_color(self.ui.edit_defenderColor, settings["defenderColor"]), ui_utils.reset_textField_color(self.ui.edit_supporterColor, settings["supporterColor"]), ui_utils.reset_textField_color(self.ui.edit_strikerColor, settings["strikerColor"]), ui_utils.reset_textField_color(self.ui.edit_bishopColor, settings["bishopColor"]), ui_utils.reset_textField_color( self.ui.edit_replacementKeeperColor, settings[ "replacement_keeperColor"]) ]), "fov": (lambda: { "jointSensorDataKey": self.ui.cbx_JointSensorDataKey.currentText(), "jointSensorDataKeyLambda": self.ui.edit_jointSensorDataKeyLambda.toPlainText(), "drawFOV": self.ui.drawFOVCheckBox.isChecked(), "maxDistance": self.ui.spin_maxDistance.value(), "cameraOpeningAngle": self.ui.spin_cameraOpeningAngle.value() }, lambda settings: [ self.ui.cbx_JointSensorDataKey.setCurrentText(settings[ "jointSensorDataKey"]), self.ui.edit_jointSensorDataKeyLambda.setPlainText(settings[ "jointSensorDataKeyLambda"]), self.ui.drawFOVCheckBox.setChecked(settings["drawFOV"]), self.ui.spin_maxDistance.setValue(settings["maxDistance"]), self.ui.spin_cameraOpeningAngle.setValue(settings[ "cameraOpeningAngle"]) ]), "motionPlan": (lambda: { "key": self.ui.cbx_MotionPlannerKey.currentText(), "keyLambda": self.ui.edit_motionPlannerKeyLambda.toPlainText( ), "drawMotionPlan": self.ui.drawMotionPlanCheckBox.isChecked(), "targetCircleDiameter": self.ui.spin_targetCircleDiameter. value(), "drawTranslation": self.ui.drawTranslationCheckBox.isChecked( ), "translationColor": self.ui.edit_translationColor.text() }, lambda settings: [ self.ui.cbx_MotionPlannerKey.setCurrentText(settings["key"]), self.ui.edit_motionPlannerKeyLambda.setPlainText(settings[ "keyLambda"]), self.ui.drawMotionPlanCheckBox.setChecked(settings[ "drawMotionPlan"]), self.ui.spin_targetCircleDiameter.setValue(settings[ "targetCircleDiameter"]), self.ui.drawTranslationCheckBox.setChecked(settings[ "drawTranslation"]), ui_utils.reset_textField_color(self.ui.edit_translationColor, settings["translationColor"]) ]), "ballSearch": (lambda: { "key": self.ui.cbx_BallSearchKey.currentText(), "keyLambda": self.ui.edit_ballSearchKeyLambda.toPlainText(), "drawSearchTarget": self.ui.drawBallSearchCheckBox.isChecked( ), "searchCircleDiameter": self.ui.spin_searchCircleDiameter. value() }, lambda settings: [ self.ui.cbx_BallSearchKey.setCurrentText(settings["key"]), self.ui.edit_ballSearchKeyLambda.setPlainText(settings[ "keyLambda"]), self.ui.drawBallSearchCheckBox.setChecked(settings[ "drawSearchTarget"]), self.ui.spin_searchCircleDiameter.setValue(settings[ "searchCircleDiameter"]) ]) } self.ui.cbx_PoseKey.completer().setFilterMode(qtc.Qt.MatchContains) self.ui.cbx_PoseKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) self.ui.cbx_RoleKey.completer().setFilterMode(qtc.Qt.MatchContains) self.ui.cbx_RoleKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) self.ui.cbx_JointSensorDataKey.completer().setFilterMode( qtc.Qt.MatchContains) self.ui.cbx_JointSensorDataKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) self.ui.cbx_MotionPlannerKey.completer().setFilterMode( qtc.Qt.MatchContains) self.ui.cbx_MotionPlannerKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) self.ui.cbx_BallSearchKey.completer().setFilterMode( qtc.Qt.MatchContains) self.ui.cbx_BallSearchKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) ui_utils.init_Color_UI(self.ui.btn_fixedColor, self.ui.edit_fixedColor) ui_utils.init_Color_UI(self.ui.btn_defaultColor, self.ui.edit_defaultColor) ui_utils.init_Color_UI(self.ui.btn_keeperColor, self.ui.edit_keeperColor) ui_utils.init_Color_UI(self.ui.btn_defenderColor, self.ui.edit_defenderColor) ui_utils.init_Color_UI(self.ui.btn_supporterColor, self.ui.edit_supporterColor) ui_utils.init_Color_UI(self.ui.btn_strikerColor, self.ui.edit_strikerColor) ui_utils.init_Color_UI(self.ui.btn_bishopColor, self.ui.edit_bishopColor) ui_utils.init_Color_UI(self.ui.btn_translationColor, self.ui.edit_translationColor) self.ui.btnAccept.pressed.connect(self.accept) self.ui.btnDiscard.pressed.connect(self.discard) self.reset_widgets() if self.nao.is_connected(): self.connect(self.nao)
def __init__(self, layer, parent, update_callback, nao): super(LineDataConfig, self).__init__(parent) self.layer = layer self.update_callback = update_callback self.nao = nao self.identifier = uuid.uuid4() self.ui = Ui_LineDataConfig() self.ui.setupUi(self) if self.layer["settings"] is None: self.layer["settings"] = { "center_x": 5.2, "center_y": -3.7, "transformation": { "key": "Brain.RobotPosition", "key_lambda": 'output = input["pose"]' }, "lines": { "key": "Brain.LineData", "key_lambda": 'output = input["lines"]', "lineWidth": 0.05, "lineColor": "#ff0000" } } self.settings_to_ui = { "center_x": (lambda: self.ui.spin_center_x.value(), lambda value: self.ui.spin_center_x.setValue(value)), "center_y": (lambda: self.ui.spin_center_y.value(), lambda value: self.ui.spin_center_y.setValue(value)), "transformation": (lambda: { "key": self.ui.cbx_TransformationKey.currentText(), "key_lambda": self.ui.edit_TransformationKeyLambda.toPlainText( ) }, lambda settings: [ self.ui.cbx_TransformationKey.setCurrentText(settings["key"]), self.ui.edit_TransformationKeyLambda.setPlainText(settings[ "key_lambda"]) ]), "lines": (lambda: { "key": self.ui.cbx_LinesKey.currentText(), "key_lambda": self.ui.edit_LinesKeyLambda.toPlainText(), "lineWidth": self.ui.spin_lineWidth.value(), "lineColor": self.ui.edit_lineColor.text() }, lambda settings: [ self.ui.cbx_LinesKey.setCurrentText(settings["key"]), self.ui.edit_LinesKeyLambda.setPlainText(settings["key_lambda"] ), self.ui.spin_lineWidth.setValue(settings["lineWidth"]), ui_utils.reset_textField_color(self.ui.edit_lineColor, settings["lineColor"]) ]) } self.ui.cbx_TransformationKey.completer().setFilterMode( qtc.Qt.MatchContains) self.ui.cbx_TransformationKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) self.ui.cbx_LinesKey.completer().setFilterMode(qtc.Qt.MatchContains) self.ui.cbx_LinesKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) ui_utils.init_Color_UI(self.ui.btn_lineColor, self.ui.edit_lineColor) self.ui.btnAccept.pressed.connect(self.accept) self.ui.btnDiscard.pressed.connect(self.discard) self.reset_widgets() if self.nao.is_connected(): self.connect(self.nao)
def __init__(self, layer, parent, update_callback, nao): super(ObstacleDataConfig, self).__init__(parent) self.layer = layer self.update_callback = update_callback self.nao = nao self.identifier = uuid.uuid4() self.ui = Ui_ObstacleDataConfig() self.ui.setupUi(self) if self.layer["settings"] is None: self.layer["settings"] = { "center_x": 5.2, "center_y": -3.7, "transformation": { "key": "Brain.RobotPosition", "key_lambda": 'output = input["pose"]' }, "obstacles": { "key": "Brain.TeamObstacleData", "key_lambda": 'output = input["obstacles"]', "goalPostColor": "#000000", "unknownColor": "#ff5500", "anonymousRobotColor": "#ff00ff", "hostileRobotColor": "#ff0000", "teamRobotColor": "#0000ff", "fallenAnonymousRobotColor": "#7f007f", "fallenHostileRobotColor": "#7f0000", "fallenTeamRobotColor": "#00007f", "ballColor": "#000000", "freeKickAreaColor": "#ffffff", "penWidth": 0.03 } } self.settings_to_ui = { "center_x": (lambda: self.ui.spin_center_x.value(), lambda value: self.ui.spin_center_x.setValue(value)), "center_y": (lambda: self.ui.spin_center_y.value(), lambda value: self.ui.spin_center_y.setValue(value)), "transformation": (lambda: { "key": self.ui.cbx_TransformationKey.currentText(), "key_lambda": self.ui.edit_TransformationKeyLambda.toPlainText( ) }, lambda settings: [ self.ui.cbx_TransformationKey.setCurrentText(settings["key"]), self.ui.edit_TransformationKeyLambda.setPlainText(settings[ "key_lambda"]) ]), "obstacles": (lambda: { "key": self.ui.cbx_ObstacleDataKey.currentText(), "key_lambda": self.ui.edit_ObstacleDataKeyLambda.toPlainText(), "goalPostColor": self.ui.edit_goalPostColor.text(), "unknownColor": self.ui.edit_unknownColor.text(), "anonymousRobotColor": self.ui.edit_anonymousRobotColor.text(), "hostileRobotColor": self.ui.edit_hostileRobotColor.text(), "teamRobotColor": self.ui.edit_teamRobotColor.text(), "fallenAnonymousRobotColor": self.ui.edit_fallenAnonymousRobotColor.text(), "fallenHostileRobotColor": self.ui.edit_fallenHostileRobotColor.text(), "fallenTeamRobotColor": self.ui.edit_fallenTeamRobotColor.text(), "ballColor": self.ui.edit_ballColor.text(), "freeKickAreaColor": self.ui.edit_freeKickAreaColor.text(), "penWidth": self.ui.spin_penWidth.value() }, lambda settings: [ self.ui.cbx_ObstacleDataKey.setCurrentText(settings["key"]), self.ui.edit_ObstacleDataKeyLambda.setPlainText(settings[ "key_lambda"]), ui_utils.reset_textField_color(self.ui.edit_goalPostColor, settings["goalPostColor"]), ui_utils.reset_textField_color(self.ui.edit_unknownColor, settings["unknownColor"]), ui_utils.reset_textField_color( self.ui.edit_anonymousRobotColor, settings[ "anonymousRobotColor"]), ui_utils.reset_textField_color(self.ui.edit_hostileRobotColor, settings["hostileRobotColor"]), ui_utils.reset_textField_color(self.ui.edit_teamRobotColor, settings["teamRobotColor"]), ui_utils.reset_textField_color( self.ui.edit_fallenAnonymousRobotColor, settings[ "fallenAnonymousRobotColor"]), ui_utils.reset_textField_color( self.ui.edit_fallenHostileRobotColor, settings[ "fallenHostileRobotColor"]), ui_utils.reset_textField_color( self.ui.edit_fallenTeamRobotColor, settings[ "fallenTeamRobotColor"]), ui_utils.reset_textField_color(self.ui.edit_ballColor, settings["ballColor"]), ui_utils.reset_textField_color(self.ui.edit_freeKickAreaColor, settings["freeKickAreaColor"]), self.ui.spin_penWidth.setValue(settings["penWidth"]) ]) } self.ui.cbx_TransformationKey.completer().setFilterMode( qtc.Qt.MatchContains) self.ui.cbx_TransformationKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) self.ui.cbx_ObstacleDataKey.completer().setFilterMode( qtc.Qt.MatchContains) self.ui.cbx_ObstacleDataKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) ui_utils.init_Color_UI(self.ui.btn_goalPostColor, self.ui.edit_goalPostColor) ui_utils.init_Color_UI(self.ui.btn_unknownColor, self.ui.edit_unknownColor) ui_utils.init_Color_UI(self.ui.btn_anonymousRobotColor, self.ui.edit_anonymousRobotColor) ui_utils.init_Color_UI(self.ui.btn_hostileRobotColor, self.ui.edit_hostileRobotColor) ui_utils.init_Color_UI(self.ui.btn_teamRobotColor, self.ui.edit_teamRobotColor) ui_utils.init_Color_UI(self.ui.btn_fallenAnonymousRobotColor, self.ui.edit_fallenAnonymousRobotColor) ui_utils.init_Color_UI(self.ui.btn_fallenHostileRobotColor, self.ui.edit_fallenHostileRobotColor) ui_utils.init_Color_UI(self.ui.btn_fallenTeamRobotColor, self.ui.edit_fallenTeamRobotColor) ui_utils.init_Color_UI(self.ui.btn_ballColor, self.ui.edit_ballColor) ui_utils.init_Color_UI(self.ui.btn_freeKickAreaColor, self.ui.edit_freeKickAreaColor) self.ui.btnAccept.pressed.connect(self.accept) self.ui.btnDiscard.pressed.connect(self.discard) self.reset_widgets() if self.nao.is_connected(): self.connect(self.nao)
def __init__(self, layer_model, parent, update_callback, nao: Nao): super(Config, self).__init__(parent) ui_utils.loadUi(__file__, self) self.layer_model = ui_utils.load_model( os.path.dirname(__file__) + "/model.json", layer_model) self.update_callback = update_callback self.nao = nao self.identifier = uuid.uuid4() self.config_to_ui = { "center_x": (lambda: self.spin_center_x.value(), lambda value: self.spin_center_x.setValue(value)), "center_y": (lambda: self.spin_center_y.value(), lambda value: self.spin_center_y.setValue(value)), "transformation": (lambda: { "key": self.cbx_TransformationKey.currentText(), "key_lambda": self.edit_TransformationKeyLambda.toPlainText() }, lambda config: [ self.cbx_TransformationKey.setCurrentText(config["key"]), self.edit_TransformationKeyLambda.setPlainText(config[ "key_lambda"]) ]), "obstacles": (lambda: { "key": self.cbx_ObstacleDataKey.currentText(), "key_lambda": self.edit_ObstacleDataKeyLambda.toPlainText(), "goalPostColor": self.edit_goalPostColor.text(), "unknownColor": self.edit_unknownColor.text(), "anonymousRobotColor": self.edit_anonymousRobotColor.text(), "hostileRobotColor": self.edit_hostileRobotColor.text(), "teamRobotColor": self.edit_teamRobotColor.text(), "fallenAnonymousRobotColor": self.edit_fallenAnonymousRobotColor.text(), "fallenHostileRobotColor": self.edit_fallenHostileRobotColor.text(), "fallenTeamRobotColor": self.edit_fallenTeamRobotColor.text(), "ballColor": self.edit_ballColor.text(), "freeKickAreaColor": self.edit_freeKickAreaColor.text(), "penWidth": self.spin_penWidth.value() }, lambda config: [ self.cbx_ObstacleDataKey.setCurrentText(config["key"]), self.edit_ObstacleDataKeyLambda.setPlainText(config[ "key_lambda"]), ui_utils.reset_textField_color(self.edit_goalPostColor, config[ "goalPostColor"]), ui_utils.reset_textField_color(self.edit_unknownColor, config[ "unknownColor"]), ui_utils.reset_textField_color(self.edit_anonymousRobotColor, config["anonymousRobotColor"]), ui_utils.reset_textField_color(self.edit_hostileRobotColor, config["hostileRobotColor"]), ui_utils.reset_textField_color(self.edit_teamRobotColor, config["teamRobotColor"]), ui_utils.reset_textField_color( self.edit_fallenAnonymousRobotColor, config[ "fallenAnonymousRobotColor"]), ui_utils.reset_textField_color( self.edit_fallenHostileRobotColor, config[ "fallenHostileRobotColor"]), ui_utils.reset_textField_color(self.edit_fallenTeamRobotColor, config["fallenTeamRobotColor"]), ui_utils.reset_textField_color(self.edit_ballColor, config[ "ballColor"]), ui_utils.reset_textField_color(self.edit_freeKickAreaColor, config["freeKickAreaColor"]), self.spin_penWidth.setValue(config["penWidth"]) ]) } self.cbx_TransformationKey.completer().setFilterMode( qtc.Qt.MatchContains) self.cbx_TransformationKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) self.cbx_ObstacleDataKey.completer().setFilterMode( qtc.Qt.MatchContains) self.cbx_ObstacleDataKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) ui_utils.init_Color_UI(self.btn_goalPostColor, self.edit_goalPostColor) ui_utils.init_Color_UI(self.btn_unknownColor, self.edit_unknownColor) ui_utils.init_Color_UI(self.btn_anonymousRobotColor, self.edit_anonymousRobotColor) ui_utils.init_Color_UI(self.btn_hostileRobotColor, self.edit_hostileRobotColor) ui_utils.init_Color_UI(self.btn_teamRobotColor, self.edit_teamRobotColor) ui_utils.init_Color_UI(self.btn_fallenAnonymousRobotColor, self.edit_fallenAnonymousRobotColor) ui_utils.init_Color_UI(self.btn_fallenHostileRobotColor, self.edit_fallenHostileRobotColor) ui_utils.init_Color_UI(self.btn_fallenTeamRobotColor, self.edit_fallenTeamRobotColor) ui_utils.init_Color_UI(self.btn_ballColor, self.edit_ballColor) ui_utils.init_Color_UI(self.btn_freeKickAreaColor, self.edit_freeKickAreaColor) self.btnAccept.pressed.connect(self.accept) self.btnDiscard.pressed.connect(self.discard) self.reset_widgets() if self.nao.is_connected(): self.connect(self.nao)
def __init__(self, layer, parent, update_callback, nao): super(CoordinateSystemConfig, self).__init__(parent) self.layer = layer self.update_callback = update_callback self.ui = Ui_CoordinateSystemConfig() self.ui.setupUi(self) if self.layer["settings"] is None: self.layer["settings"] = { "center_x": 5.2, "center_y": -3.7, "coordinateSystem": { "width": 10.4, "height": 7.4, "backgroundColor": "#008000", "backgroundAlpha": 255, "lineWidth": 0.01, "stepSizeY": 1.0, "stepSizeX": 1.0, "lineColor": "#808080", "polar": False, "polarAngleStepSize": 30.0, "radialStepSize": 1.0 } } self.settings_to_ui = { "center_x": ( lambda: self.ui.spin_center_x.value(), lambda value: self.ui.spin_center_x.setValue(value)), "center_y": ( lambda: self.ui.spin_center_y.value(), lambda value: self.ui.spin_center_y.setValue(value)), "coordinateSystem": ( lambda: { "width": self.ui.spin_coordinateSystem_width.value(), "height": self.ui.spin_coordinateSystem_height.value(), "backgroundColor": self.ui.edit_bgColor.text(), "backgroundAlpha": self.ui.spin_coordinateSystem_bgAlpha.value(), "lineWidth": self.ui.spin_coordinateSystem_lineWidth.value(), "stepSizeY": self.ui.spin_coordinateSystem_stepSizeY.value(), "stepSizeX": self.ui.spin_coordinateSystem_stepSizeX.value(), "lineColor": self.ui.edit_lineColor.text(), "polar": self.ui.polarCheckBox.isChecked(), "polarAngleStepSize": self.ui.spin_coordinateSystem_angleStepSize.value(), "radialStepSize": self.ui.spin_coordinateSystem_radialStepSize.value()}, lambda settings: [ self.ui.spin_coordinateSystem_width.setValue( settings["width"]), self.ui.spin_coordinateSystem_height.setValue( settings["height"]), ui_utils.reset_textField_color( self.ui.edit_bgColor, settings["backgroundColor"]), self.ui.spin_coordinateSystem_bgAlpha.setValue( settings["backgroundAlpha"]), self.ui.spin_coordinateSystem_lineWidth.setValue( settings["lineWidth"]), self.ui.spin_coordinateSystem_stepSizeY.setValue( settings["stepSizeY"]), self.ui.spin_coordinateSystem_stepSizeX.setValue( settings["stepSizeX"]), ui_utils.reset_textField_color( self.ui.edit_lineColor, settings["lineColor"]), self.ui.polarCheckBox.setChecked( settings["polar"]), self.ui.spin_coordinateSystem_angleStepSize.setValue( settings["polarAngleStepSize"]), self.ui.spin_coordinateSystem_radialStepSize.setValue( settings["radialStepSize"])])} ui_utils.init_Color_UI(self.ui.btn_bgColor, self.ui.edit_bgColor) ui_utils.init_Color_UI(self.ui.btn_lineColor, self.ui.edit_lineColor) self.ui.btnAccept.pressed.connect(self.accept) self.ui.btnDiscard.pressed.connect(self.discard) self.reset_widgets()
def __init__(self, layer_model, parent, update_callback, nao: Nao): super(Config, self).__init__(parent) ui_utils.loadUi(__file__, self) self.nao = nao self.layer_model = ui_utils.load_model( os.path.dirname(__file__) + "/model.json", layer_model) self.update_callback = update_callback self.identifier = uuid.uuid4() self.config_to_ui = { "center_x": (lambda: self.spin_center_x.value(), lambda value: self.spin_center_x.setValue(value)), "center_y": (lambda: self.spin_center_y.value(), lambda value: self.spin_center_y.setValue(value)), "transformation": (lambda: { "key": self.cbx_TransformationKey.currentText(), "key_lambda": self.edit_TransformationKeyLambda.toPlainText(), }, lambda config: [ self.cbx_TransformationKey.setCurrentText(config["key"]), self.edit_TransformationKeyLambda.setPlainText(config[ "key_lambda"]), ]), "pose": (lambda: { "key": self.cbx_PoseKey.currentText(), "keyLambda": self.edit_poseKeyLambda.toPlainText(), "positionCircleDiameter": self.spin_positionCircleDiameter. value(), "orientationLineLength": self.spin_orientationLineLength. value(), "color": self.edit_poseColor.text() }, lambda config: [ self.cbx_PoseKey.setCurrentText(config["key"]), self.edit_poseKeyLambda.setPlainText(config["keyLambda"]), self.spin_positionCircleDiameter.setValue(config[ "positionCircleDiameter"]), self.spin_orientationLineLength.setValue(config[ "orientationLineLength"]), ui_utils.reset_textField_color(self.edit_poseColor, config[ "color"]) ]), "fov": (lambda: { "jointSensorDataKey": self.cbx_JointSensorDataKey.currentText(), "jointSensorDataKeyLambda": self.edit_jointSensorDataKeyLambda.toPlainText(), "maxDistance": self.spin_maxDistance.value(), "cameraOpeningAngle": self.spin_cameraOpeningAngle.value() }, lambda config: [ self.cbx_JointSensorDataKey.setCurrentText(config[ "jointSensorDataKey"]), self.edit_jointSensorDataKeyLambda.setPlainText(config[ "jointSensorDataKeyLambda"]), self.spin_maxDistance.setValue(config["maxDistance"]), self.spin_cameraOpeningAngle.setValue(config[ "cameraOpeningAngle"]) ]) } self.cbx_PoseKey.completer().setFilterMode(qtc.Qt.MatchContains) self.cbx_PoseKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) self.cbx_TransformationKey.completer().setFilterMode( qtc.Qt.MatchContains) self.cbx_TransformationKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) self.cbx_JointSensorDataKey.completer().setFilterMode( qtc.Qt.MatchContains) self.cbx_JointSensorDataKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) ui_utils.init_Color_UI(self.btn_poseColor, self.edit_poseColor) self.btnAccept.pressed.connect(self.accept) self.btnDiscard.pressed.connect(self.discard) self.reset_widgets() if self.nao.is_connected(): self.connect(self.nao)
def __init__(self, layer, parent, update_callback, nao: nao.Nao): super(TeamPlayersConfig, self).__init__(parent) self.nao = nao self.layer = layer self.update_callback = update_callback self.identifier = uuid.uuid4() self.ui = Ui_TeamPlayersConfig() self.ui.setupUi(self) if self.layer["settings"] is None: self.layer["settings"] = { "center_x": 5.2, "center_y": -3.7, "teamPlayers": { "key": "Brain.TeamPlayers", "keyLambda": 'output = input["players"]', "showPlayer": True, "poseCircleDiameter": 0.28, "showTarget": True, "targetCircleDiameter": 0.28, "showFOV": False, "maxDistance": 2.5, "cameraOpeningAngle": 60.97, "defaultColor": "#ffffff", "keeperColor": "#0000ff", "defenderColor": "#00ff00", "supporterColor": "#ff00ff", "strikerColor": "#ff0000", "bishopColor": "#ffff00", "replacement_keeperColor": "#00ffff", "showSearchPosition": False, "searchPositionDiameter": 0.6 } } self.settings_to_ui = { "center_x": (lambda: self.ui.spin_center_x.value(), lambda value: self.ui.spin_center_x.setValue(value)), "center_y": (lambda: self.ui.spin_center_y.value(), lambda value: self.ui.spin_center_y.setValue(value)), "teamPlayers": (lambda: { "key": self.ui.cbx_TeamPlayersKey.currentText(), "keyLambda": self.ui.edit_TeamPlayersKeyLambda.toPlainText(), "showPlayer": self.ui.playerCheckbox.isChecked(), "poseCircleDiameter": self.ui.spin_poseCircleDiameter.value(), "showTarget": self.ui.targetCheckbox.isChecked(), "targetCircleDiameter": self.ui.spin_targetCircleDiameter.value(), "showFOV": self.ui.fovCheckbox.isChecked(), "maxDistance": self.ui.spin_maxDistance.value(), "cameraOpeningAngle": self.ui.spin_cameraOpeningAngle.value(), "defaultColor": self.ui.edit_defaultColor.text(), "keeperColor": self.ui.edit_keeperColor.text(), "defenderColor": self.ui.edit_defenderColor.text(), "supporterColor": self.ui.edit_supporterColor.text(), "strikerColor": self.ui.edit_strikerColor.text(), "bishopColor": self.ui.edit_bishopColor.text(), "replacement_keeperColor": self.ui.edit_replacementKeeperColor.text(), "showSearchPosition": self.ui.searchPositionCheckbox.isChecked(), "searchPositionDiameter": self.ui.spin_searchPositionDiameter.value() }, lambda settings: [ self.ui.cbx_TeamPlayersKey.setCurrentText(settings["key"]), self.ui.edit_TeamPlayersKeyLambda.setPlainText(settings[ "keyLambda"]), self.ui.playerCheckbox.setChecked(settings["showPlayer"]), self.ui.spin_poseCircleDiameter.setValue(settings[ "poseCircleDiameter"]), self.ui.targetCheckbox.setChecked(settings["showTarget"]), self.ui.spin_targetCircleDiameter.setValue(settings[ "targetCircleDiameter"]), self.ui.fovCheckbox.setChecked(settings["showFOV"]), self.ui.spin_maxDistance.setValue(settings["maxDistance"]), self.ui.spin_cameraOpeningAngle.setValue(settings[ "cameraOpeningAngle"]), ui_utils.reset_textField_color(self.ui.edit_defaultColor, settings["defaultColor"]), ui_utils.reset_textField_color(self.ui.edit_keeperColor, settings["keeperColor"]), ui_utils.reset_textField_color(self.ui.edit_defenderColor, settings["defenderColor"]), ui_utils.reset_textField_color(self.ui.edit_supporterColor, settings["supporterColor"]), ui_utils.reset_textField_color(self.ui.edit_strikerColor, settings["strikerColor"]), ui_utils.reset_textField_color(self.ui.edit_bishopColor, settings["bishopColor"]), ui_utils.reset_textField_color( self.ui.edit_replacementKeeperColor, settings[ "replacement_keeperColor"]), self.ui.searchPositionCheckbox.setChecked(settings[ "showSearchPosition"]), self.ui.spin_searchPositionDiameter.setValue(settings[ "searchPositionDiameter"]) ]) } self.ui.cbx_TeamPlayersKey.completer().setFilterMode( qtc.Qt.MatchContains) self.ui.cbx_TeamPlayersKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) self.ui.btnAccept.pressed.connect(self.accept) self.ui.btnDiscard.pressed.connect(self.discard) ui_utils.init_Color_UI(self.ui.btn_defaultColor, self.ui.edit_defaultColor) ui_utils.init_Color_UI(self.ui.btn_keeperColor, self.ui.edit_keeperColor) ui_utils.init_Color_UI(self.ui.btn_defenderColor, self.ui.edit_defenderColor) ui_utils.init_Color_UI(self.ui.btn_supporterColor, self.ui.edit_supporterColor) ui_utils.init_Color_UI(self.ui.btn_strikerColor, self.ui.edit_strikerColor) ui_utils.init_Color_UI(self.ui.btn_bishopColor, self.ui.edit_bishopColor) ui_utils.init_Color_UI(self.ui.btn_replacementKeeperColor, self.ui.edit_replacementKeeperColor) self.reset_widgets() if self.nao.is_connected(): self.connect(self.nao)
def __init__(self, layer, parent, update_callback, nao): super(SonarSensorsConfig, self).__init__(parent) self.layer = layer self.update_callback = update_callback self.nao = nao self.identifier = uuid.uuid4() self.ui = Ui_SonarSensorsConfig() self.ui.setupUi(self) if self.layer["settings"] is None: self.layer["settings"] = { "center_x": 5.2, "center_y": -3.7, "transformation": { "key": "Brain.RobotPosition", "key_lambda": 'output = input["pose"]' }, "sonar": { "rawKey": "Motion.SonarSensorData", "rawKey_lambda": 'output = input', "filteredKey": "Motion.SonarData", "filteredKey_lambda": 'output = input', "openingAngle": 60.0, "zAngle": 25.0, "yOffset": 4.16, "color": "#ffffff" } } self.settings_to_ui = { "center_x": (lambda: self.ui.spin_center_x.value(), lambda value: self.ui.spin_center_x.setValue(value)), "center_y": (lambda: self.ui.spin_center_y.value(), lambda value: self.ui.spin_center_y.setValue(value)), "transformation": (lambda: { "key": self.ui.cbx_TransformationKey.currentText(), "key_lambda": self.ui.edit_TransformationKeyLambda.toPlainText( ) }, lambda settings: [ self.ui.cbx_TransformationKey.setCurrentText(settings["key"]), self.ui.edit_TransformationKeyLambda.setPlainText(settings[ "key_lambda"]) ]), "sonar": (lambda: { "rawKey": self.ui.cbx_RawSonarKey.currentText(), "rawKey_lambda": self.ui.edit_RawSonarKeyLambda.toPlainText(), "filteredKey": self.ui.cbx_FilteredSonarKey.currentText(), "filteredKey_lambda": self.ui.edit_FilteredSonarKeyLambda.toPlainText(), "openingAngle": self.ui.spin_sonarOpeningAngle.value(), "zAngle": self.ui.spin_sonarZAngle.value(), "yOffset": self.ui.spin_sonarYOffset.value(), "color": self.ui.edit_sonarColor.text() }, lambda settings: [ self.ui.cbx_RawSonarKey.setCurrentText(settings["rawKey"]), self.ui.edit_RawSonarKeyLambda.setPlainText(settings[ "rawKey_lambda"]), self.ui.cbx_FilteredSonarKey.setCurrentText(settings[ "filteredKey"]), self.ui.edit_FilteredSonarKeyLambda.setPlainText(settings[ "filteredKey_lambda"]), self.ui.spin_sonarOpeningAngle.setValue(settings["openingAngle" ]), self.ui.spin_sonarZAngle.setValue(settings["zAngle"]), self.ui.spin_sonarYOffset.setValue(settings["yOffset"]), ui_utils.reset_textField_color(self.ui.edit_sonarColor, settings["color"]) ]) } self.ui.cbx_TransformationKey.completer().setFilterMode( qtc.Qt.MatchContains) self.ui.cbx_TransformationKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) self.ui.cbx_RawSonarKey.completer().setFilterMode(qtc.Qt.MatchContains) self.ui.cbx_RawSonarKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) self.ui.cbx_FilteredSonarKey.completer().setFilterMode( qtc.Qt.MatchContains) self.ui.cbx_FilteredSonarKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) ui_utils.init_Color_UI(self.ui.btn_sonarColor, self.ui.edit_sonarColor) self.ui.btnAccept.pressed.connect(self.accept) self.ui.btnDiscard.pressed.connect(self.discard) self.reset_widgets() if self.nao.is_connected(): self.connect(self.nao)
def __init__(self, layer_model, parent, update_callback, nao: Nao): super(Config, self).__init__(parent) ui_utils.loadUi(__file__, self) self.nao = nao self.layer_model = ui_utils.load_model( os.path.dirname(__file__) + "/model.json", layer_model) self.update_callback = update_callback self.identifier = uuid.uuid4() self.config_to_ui = { "center_x": (lambda: self.spin_center_x.value(), lambda value: self.spin_center_x.setValue(value)), "center_y": (lambda: self.spin_center_y.value(), lambda value: self.spin_center_y.setValue(value)), "pose": (lambda: { "key": self.cbx_PoseKey.currentText(), "keyLambda": self.edit_poseKeyLambda.toPlainText(), "drawPose": self.drawPoseCheckBox.isChecked(), "positionCircleDiameter": self.spin_positionCircleDiameter. value(), "orientationLineLength": self.spin_orientationLineLength.value( ), "fixedColor": self.edit_fixedColor.text(), "useFixedColor": self.useFixedColorCheckBox.isChecked(), "roleKey": self.cbx_RoleKey.currentText(), "roleKeyLambda": self.edit_roleKeyLambda.toPlainText(), "defaultColor": self.edit_defaultColor.text(), "keeperColor": self.edit_keeperColor.text(), "defenderColor": self.edit_defenderColor.text(), "supporterColor": self.edit_supporterColor.text(), "strikerColor": self.edit_strikerColor.text(), "bishopColor": self.edit_bishopColor.text(), "replacement_keeperColor": self.edit_replacementKeeperColor. text(), "loserColor": self.edit_loserColor.text(), "searcherColor": self.edit_searcherColor.text() }, lambda config: [ self.cbx_PoseKey.setCurrentText(config["key"]), self.edit_poseKeyLambda.setPlainText(config["keyLambda"]), self.drawPoseCheckBox.setChecked(config["drawPose"]), self.spin_positionCircleDiameter.setValue(config[ "positionCircleDiameter"]), self.spin_orientationLineLength.setValue(config[ "orientationLineLength"]), ui_utils.reset_textField_color(self.edit_fixedColor, config[ "fixedColor"]), self.useFixedColorCheckBox.setChecked(config["useFixedColor"]), self.cbx_RoleKey.setCurrentText(config["roleKey"]), self.edit_roleKeyLambda.setPlainText(config["roleKeyLambda"]), ui_utils.reset_textField_color(self.edit_defaultColor, config[ "defaultColor"]), ui_utils.reset_textField_color(self.edit_keeperColor, config[ "keeperColor"]), ui_utils.reset_textField_color(self.edit_defenderColor, config[ "defenderColor"]), ui_utils.reset_textField_color(self.edit_supporterColor, config["supporterColor"]), ui_utils.reset_textField_color(self.edit_strikerColor, config[ "strikerColor"]), ui_utils.reset_textField_color(self.edit_bishopColor, config[ "bishopColor"]), ui_utils.reset_textField_color( self.edit_replacementKeeperColor, config[ "replacement_keeperColor"]), ui_utils.reset_textField_color(self.edit_loserColor, config[ "loserColor"]), ui_utils.reset_textField_color(self.edit_searcherColor, config[ "searcherColor"]) ]), "fov": (lambda: { "jointSensorDataKey": self.cbx_JointSensorDataKey.currentText(), "jointSensorDataKeyLambda": self.edit_jointSensorDataKeyLambda.toPlainText(), "drawFOV": self.drawFOVCheckBox.isChecked(), "maxDistance": self.spin_maxDistance.value(), "cameraOpeningAngle": self.spin_cameraOpeningAngle.value() }, lambda config: [ self.cbx_JointSensorDataKey.setCurrentText(config[ "jointSensorDataKey"]), self.edit_jointSensorDataKeyLambda.setPlainText(config[ "jointSensorDataKeyLambda"]), self.drawFOVCheckBox.setChecked(config["drawFOV"]), self.spin_maxDistance.setValue(config["maxDistance"]), self.spin_cameraOpeningAngle.setValue(config[ "cameraOpeningAngle"]) ]), "motionPlan": (lambda: { "key": self.cbx_MotionPlannerKey.currentText(), "keyLambda": self.edit_motionPlannerKeyLambda.toPlainText(), "drawMotionPlan": self.drawMotionPlanCheckBox.isChecked(), "targetCircleDiameter": self.spin_targetCircleDiameter.value( ), "drawTranslation": self.drawTranslationCheckBox.isChecked(), "translationColor": self.edit_translationColor.text() }, lambda config: [ self.cbx_MotionPlannerKey.setCurrentText(config["key"]), self.edit_motionPlannerKeyLambda.setPlainText(config[ "keyLambda"]), self.drawMotionPlanCheckBox.setChecked(config["drawMotionPlan" ]), self.spin_targetCircleDiameter.setValue(config[ "targetCircleDiameter"]), self.drawTranslationCheckBox.setChecked(config[ "drawTranslation"]), ui_utils.reset_textField_color(self.edit_translationColor, config["translationColor"]) ]), "ballSearch": (lambda: { "key": self.cbx_BallSearchKey.currentText(), "keyLambda": self.edit_ballSearchKeyLambda.toPlainText(), "drawSearchTarget": self.drawBallSearchCheckBox.isChecked(), "searchCircleDiameter": self.spin_searchCircleDiameter.value( ) }, lambda config: [ self.cbx_BallSearchKey.setCurrentText(config["key"]), self.edit_ballSearchKeyLambda.setPlainText(config["keyLambda"] ), self.drawBallSearchCheckBox.setChecked(config[ "drawSearchTarget"]), self.spin_searchCircleDiameter.setValue(config[ "searchCircleDiameter"]) ]) } self.cbx_PoseKey.completer().setFilterMode(qtc.Qt.MatchContains) self.cbx_PoseKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) self.cbx_RoleKey.completer().setFilterMode(qtc.Qt.MatchContains) self.cbx_RoleKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) self.cbx_JointSensorDataKey.completer().setFilterMode( qtc.Qt.MatchContains) self.cbx_JointSensorDataKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) self.cbx_MotionPlannerKey.completer().setFilterMode( qtc.Qt.MatchContains) self.cbx_MotionPlannerKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) self.cbx_BallSearchKey.completer().setFilterMode(qtc.Qt.MatchContains) self.cbx_BallSearchKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) ui_utils.init_Color_UI(self.btn_fixedColor, self.edit_fixedColor) ui_utils.init_Color_UI(self.btn_defaultColor, self.edit_defaultColor) ui_utils.init_Color_UI(self.btn_keeperColor, self.edit_keeperColor) ui_utils.init_Color_UI(self.btn_defenderColor, self.edit_defenderColor) ui_utils.init_Color_UI(self.btn_supporterColor, self.edit_supporterColor) ui_utils.init_Color_UI(self.btn_strikerColor, self.edit_strikerColor) ui_utils.init_Color_UI(self.btn_bishopColor, self.edit_bishopColor) ui_utils.init_Color_UI(self.btn_replacementKeeperColor, self.edit_replacementKeeperColor) ui_utils.init_Color_UI(self.btn_loserColor, self.edit_loserColor) ui_utils.init_Color_UI(self.btn_searcherColor, self.edit_searcherColor) ui_utils.init_Color_UI(self.btn_translationColor, self.edit_translationColor) self.btnAccept.pressed.connect(self.accept) self.btnDiscard.pressed.connect(self.discard) self.reset_widgets() if self.nao.is_connected(): self.connect(self.nao)
def __init__(self, layer_model, parent, update_callback, nao: Nao): super(Config, self).__init__(parent) ui_utils.loadUi(__file__, self) self.nao = nao self.layer_model = ui_utils.load_model(os.path.dirname(__file__) + "/model.json", layer_model) self.update_callback = update_callback self.identifier = uuid.uuid4() self.config_to_ui = { "center_x": ( lambda: self.spin_center_x.value(), lambda value: self.spin_center_x.setValue(value)), "center_y": ( lambda: self.spin_center_y.value(), lambda value: self.spin_center_y.setValue(value)), "teamPlayers": ( lambda: { "key": self.cbx_TeamPlayersKey.currentText(), "keyLambda": self.edit_TeamPlayersKeyLambda.toPlainText(), "showPlayer": self.playerCheckbox.isChecked(), "poseCircleDiameter": self.spin_poseCircleDiameter.value(), "showTarget": self.targetCheckbox.isChecked(), "targetCircleDiameter": self.spin_targetCircleDiameter.value(), "showFOV": self.fovCheckbox.isChecked(), "maxDistance": self.spin_maxDistance.value(), "cameraOpeningAngle": self.spin_cameraOpeningAngle.value(), "defaultColor": self.edit_defaultColor.text(), "keeperColor": self.edit_keeperColor.text(), "defenderLeftColor": self.edit_defenderLeftColor.text(), "defenderRightColor": self.edit_defenderRightColor.text(), "supporterColor": self.edit_supporterColor.text(), "strikerColor": self.edit_strikerColor.text(), "bishopColor": self.edit_bishopColor.text(), "replacement_keeperColor": self.edit_replacementKeeperColor.text(), "showSearchPosition": self.searchPositionCheckbox.isChecked(), "searchPositionDiameter": self.spin_searchPositionDiameter.value()}, lambda config: [ self.cbx_TeamPlayersKey.setCurrentText( config["key"]), self.edit_TeamPlayersKeyLambda.setPlainText( config["keyLambda"]), self.playerCheckbox.setChecked( config["showPlayer"]), self.spin_poseCircleDiameter.setValue( config["poseCircleDiameter"]), self.targetCheckbox.setChecked( config["showTarget"]), self.spin_targetCircleDiameter.setValue( config["targetCircleDiameter"]), self.fovCheckbox.setChecked( config["showFOV"]), self.spin_maxDistance.setValue( config["maxDistance"]), self.spin_cameraOpeningAngle.setValue( config["cameraOpeningAngle"]), ui_utils.reset_textField_color( self.edit_defaultColor, config["defaultColor"]), ui_utils.reset_textField_color( self.edit_keeperColor, config["keeperColor"]), ui_utils.reset_textField_color( self.edit_defenderLeftColor, config["defenderLeftColor"]), ui_utils.reset_textField_color( self.edit_defenderRightColor, config["defenderRightColor"]), ui_utils.reset_textField_color( self.edit_supporterColor, config["supporterColor"]), ui_utils.reset_textField_color( self.edit_strikerColor, config["strikerColor"]), ui_utils.reset_textField_color( self.edit_bishopColor, config["bishopColor"]), ui_utils.reset_textField_color( self.edit_replacementKeeperColor, config["replacement_keeperColor"]), self.searchPositionCheckbox.setChecked( config["showSearchPosition"]), self.spin_searchPositionDiameter.setValue( config["searchPositionDiameter"])]) } self.cbx_TeamPlayersKey.completer().setFilterMode( qtc.Qt.MatchContains) self.cbx_TeamPlayersKey.completer().setCompletionMode( qtw.QCompleter.PopupCompletion) self.btnAccept.pressed.connect(self.accept) self.btnDiscard.pressed.connect(self.discard) ui_utils.init_Color_UI( self.btn_defaultColor, self.edit_defaultColor) ui_utils.init_Color_UI( self.btn_keeperColor, self.edit_keeperColor) ui_utils.init_Color_UI( self.btn_defenderLeftColor, self.edit_defenderLeftColor) ui_utils.init_Color_UI( self.btn_defenderRightColor, self.edit_defenderRightColor) ui_utils.init_Color_UI( self.btn_supporterColor, self.edit_supporterColor) ui_utils.init_Color_UI( self.btn_strikerColor, self.edit_strikerColor) ui_utils.init_Color_UI( self.btn_bishopColor, self.edit_bishopColor) ui_utils.init_Color_UI( self.btn_replacementKeeperColor, self.edit_replacementKeeperColor) self.reset_widgets() if self.nao.is_connected(): self.connect(self.nao)
def __init__(self, layer_model, parent, update_callback, nao: Nao): super(Config, self).__init__(parent) ui_utils.loadUi(__file__, self) self.layer_model = ui_utils.load_model( os.path.dirname(__file__) + "/model.json", layer_model) self.update_callback = update_callback self.config_to_ui = { "center_x": (lambda: self.spin_center_x.value(), lambda value: self.spin_center_x.setValue(value)), "center_y": (lambda: self.spin_center_y.value(), lambda value: self.spin_center_y.setValue(value)), "coordinateSystem": (lambda: { "width": self.spin_coordinateSystem_width.value(), "height": self.spin_coordinateSystem_height.value(), "backgroundColor": self.edit_bgColor.text(), "backgroundAlpha": self.spin_coordinateSystem_bgAlpha.value(), "lineWidth": self.spin_coordinateSystem_lineWidth.value(), "stepSizeY": self.spin_coordinateSystem_stepSizeY.value(), "stepSizeX": self.spin_coordinateSystem_stepSizeX.value(), "lineColor": self.edit_lineColor.text(), "polar": self.polarCheckBox.isChecked(), "polarAngleStepSize": self.spin_coordinateSystem_angleStepSize.value(), "radialStepSize": self.spin_coordinateSystem_radialStepSize.value() }, lambda config: [ self.spin_coordinateSystem_width.setValue(config["width"]), self.spin_coordinateSystem_height.setValue(config["height"]), ui_utils.reset_textField_color(self.edit_bgColor, config[ "backgroundColor"]), self.spin_coordinateSystem_bgAlpha.setValue(config[ "backgroundAlpha"]), self.spin_coordinateSystem_lineWidth.setValue(config[ "lineWidth"]), self.spin_coordinateSystem_stepSizeY.setValue(config[ "stepSizeY"]), self.spin_coordinateSystem_stepSizeX.setValue(config[ "stepSizeX"]), ui_utils.reset_textField_color(self.edit_lineColor, config[ "lineColor"]), self.polarCheckBox.setChecked(config["polar"]), self.spin_coordinateSystem_angleStepSize.setValue(config[ "polarAngleStepSize"]), self.spin_coordinateSystem_radialStepSize.setValue(config[ "radialStepSize"]) ]) } ui_utils.init_Color_UI(self.btn_bgColor, self.edit_bgColor) ui_utils.init_Color_UI(self.btn_lineColor, self.edit_lineColor) self.btnAccept.pressed.connect(self.accept) self.btnDiscard.pressed.connect(self.discard) self.reset_widgets()