当前位置: 首页>>代码示例>>Python>>正文


Python ai.AttitudeIndicator类代码示例

本文整理汇总了Python中cfclient.ui.widgets.ai.AttitudeIndicator的典型用法代码示例。如果您正苦于以下问题:Python AttitudeIndicator类的具体用法?Python AttitudeIndicator怎么用?Python AttitudeIndicator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AttitudeIndicator类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, tabWidget, helper, *args):
        super(FlightTab, self).__init__(*args)
        self.setupUi(self)

        self.tabName = "Flight Control"
        self.menuName = "Flight Control"

        self.tabWidget = tabWidget
        self.helper = helper

        self.disconnectedSignal.connect(self.disconnected)
        self.connectionFinishedSignal.connect(self.connected)
        # Incomming signals
        self.helper.cf.connectSetupFinished.add_callback(self.connectionFinishedSignal.emit)
        self.helper.cf.disconnected.add_callback(self.disconnectedSignal.emit)
        self.helper.inputDeviceReader.inputUpdateSignal.connect(self.updateInputControl)
        self.helper.inputDeviceReader.calUpdateSignal.connect(self.calUpdateFromInput) 
        self.helper.inputDeviceReader.emergencyStopSignal.connect(self.updateEmergencyStop)

        self._imu_data_signal.connect(self._imu_data_received)
        self._motor_data_signal.connect(self._motor_data_received)

        # Connect UI signals that are in this tab
        self.flightModeCombo.currentIndexChanged.connect(self.flightmodeChange)
        self.minThrust.valueChanged.connect(self.minMaxThrustChanged)
        self.maxThrust.valueChanged.connect(self.minMaxThrustChanged)
        self.thrustLoweringSlewRateLimit.valueChanged.connect(self.thrustLoweringSlewRateLimitChanged)
        self.slewEnableLimit.valueChanged.connect(self.thrustLoweringSlewRateLimitChanged)
        self.targetCalRoll.valueChanged.connect(self._trim_roll_changed)
        self.targetCalPitch.valueChanged.connect(self._trim_pitch_changed)
        self.maxAngle.valueChanged.connect(self.maxAngleChanged)
        self.maxYawRate.valueChanged.connect(self.maxYawRateChanged)
        self.uiSetupReadySignal.connect(self.uiSetupReady)
        self.clientXModeCheckbox.toggled.connect(self.changeXmode)
        self.isInCrazyFlightmode = False
        self.uiSetupReady()

        self.clientXModeCheckbox.setChecked(Config().get("client_side_xmode"))
        
        self.crazyflieXModeCheckbox.clicked.connect(
                    lambda enabled: self.helper.cf.param.set_value("flightctrl.xmode", str(enabled)))
        self.helper.cf.param.add_update_callback("flightctrl.xmode", 
                    lambda name, checked: self.crazyflieXModeCheckbox.setChecked(eval(checked)))
        self.ratePidRadioButton.clicked.connect(
                    lambda enabled: self.helper.cf.param.set_value("flightctrl.ratepid", str(enabled)))
        self.angularPidRadioButton.clicked.connect(
                    lambda enabled: self.helper.cf.param.set_value("flightctrl.ratepid", str(not enabled)))
        self.helper.cf.param.add_update_callback("flightctrl.ratepid", 
                    lambda name, checked: self.ratePidRadioButton.setChecked(eval(checked)))


        self.ai = AttitudeIndicator()
        self.gridLayout.addWidget(self.ai, 0, 1)

        self.targetCalPitch.setValue(Config().get("trim_pitch"))
        self.targetCalRoll.setValue(Config().get("trim_roll"))
开发者ID:dreal,项目名称:quadcopter,代码行数:56,代码来源:FlightTab.py

示例2: __init__


#.........这里部分代码省略.........
        self._baro_data_signal.connect(self._baro_data_received)
        self._althold_data_signal.connect(self._althold_data_received)
        self._motor_data_signal.connect(self._motor_data_received)

        self._log_error_signal.connect(self._logging_error)

        # Connect UI signals that are in this tab
        self.flightModeCombo.currentIndexChanged.connect(self.flightmodeChange)
        self.minThrust.valueChanged.connect(self.minMaxThrustChanged)
        self.maxThrust.valueChanged.connect(self.minMaxThrustChanged)
        self.thrustLoweringSlewRateLimit.valueChanged.connect(
                                      self.thrustLoweringSlewRateLimitChanged)
        self.slewEnableLimit.valueChanged.connect(
                                      self.thrustLoweringSlewRateLimitChanged)
        self.targetCalRoll.valueChanged.connect(self._trim_roll_changed)
        self.targetCalPitch.valueChanged.connect(self._trim_pitch_changed)
        self.maxAngle.valueChanged.connect(self.maxAngleChanged)
        self.maxYawRate.valueChanged.connect(self.maxYawRateChanged)
        self.uiSetupReadySignal.connect(self.uiSetupReady)
        self.clientXModeCheckbox.toggled.connect(self.changeXmode)
        self.isInCrazyFlightmode = False
        self.uiSetupReady()

        self.clientXModeCheckbox.setChecked(Config().get("client_side_xmode"))

        self.crazyflieXModeCheckbox.clicked.connect(
                             lambda enabled:
                             self.helper.cf.param.set_value("flightmode.x",
                                                            str(enabled)))
        self.helper.cf.param.add_update_callback(
                        group="flightmode", name="xmode",
                        cb=( lambda name, checked:
                        self.crazyflieXModeCheckbox.setChecked(eval(checked))))

        self.ratePidRadioButton.clicked.connect(
                    lambda enabled:
                    self.helper.cf.param.set_value("flightmode.ratepid",
                                                   str(enabled)))

        self.angularPidRadioButton.clicked.connect(
                    lambda enabled:
                    self.helper.cf.param.set_value("flightmode.ratepid",
                                                   str(not enabled)))

        self._led_ring_headlight.clicked.connect(
                    lambda enabled:
                    self.helper.cf.param.set_value("ring.headlightEnable",
                                                   str(enabled)))

        self.helper.cf.param.add_update_callback(
                    group="flightmode", name="ratepid",
                    cb=(lambda name, checked:
                    self.ratePidRadioButton.setChecked(eval(checked))))

        self.helper.cf.param.add_update_callback(
                    group="cpu", name="flash",
                    cb=self._set_enable_client_xmode)

        self.helper.cf.param.add_update_callback(
                    group="ring", name="headlightEnable",
                    cb=(lambda name, checked:
                    self._led_ring_headlight.setChecked(eval(checked))))

        self.helper.cf.param.add_update_callback(
                    group="flightmode", name="althold",
                    cb=(lambda name, enabled:
                    self.helper.inputDeviceReader.enable_alt_hold(eval(enabled))))

        self._ledring_nbr_effects = 0

        self.helper.cf.param.add_update_callback(
                        group="ring",
                        name="neffect",
                        cb=(lambda name, value: self._set_neffect(eval(value))))

        self.helper.cf.param.add_update_callback(
                        group="imu_sensors",
                        cb=self._set_available_sensors)

        self.helper.cf.param.all_updated.add_callback(self._ring_populate_dropdown)

        self.logBaro = None
        self.logAltHold = None

        self.ai = AttitudeIndicator()
        self.verticalLayout_4.addWidget(self.ai)
        self.splitter.setSizes([1000,1])

        self.targetCalPitch.setValue(Config().get("trim_pitch"))
        self.targetCalRoll.setValue(Config().get("trim_roll"))

        self.helper.inputDeviceReader.alt1_updated.add_callback(self.alt1_updated)
        self.helper.inputDeviceReader.alt2_updated.add_callback(self.alt2_updated)
        self._tf_state = 0
        self._ring_effect = 0

        # Connect callbacks for input device limiting of rpöö/pitch/yaw/thust
        self.helper.inputDeviceReader.limiting_updated.add_callback(
            self._limiting_updated.emit)
        self._limiting_updated.connect(self._set_limiting_enabled)
开发者ID:cstanke,项目名称:crazyflie-clients-python,代码行数:101,代码来源:FlightTab.py

示例3: FlightTab


#.........这里部分代码省略.........
                    cb=(lambda name, checked:
                    self.ratePidRadioButton.setChecked(eval(checked))))

        self.helper.cf.param.add_update_callback(
                    group="cpu", name="flash",
                    cb=self._set_enable_client_xmode)

        self.helper.cf.param.add_update_callback(
                    group="ring", name="headlightEnable",
                    cb=(lambda name, checked:
                    self._led_ring_headlight.setChecked(eval(checked))))

        self.helper.cf.param.add_update_callback(
                    group="flightmode", name="althold",
                    cb=(lambda name, enabled:
                    self.helper.inputDeviceReader.enable_alt_hold(eval(enabled))))

        self._ledring_nbr_effects = 0

        self.helper.cf.param.add_update_callback(
                        group="ring",
                        name="neffect",
                        cb=(lambda name, value: self._set_neffect(eval(value))))

        self.helper.cf.param.add_update_callback(
                        group="imu_sensors",
                        cb=self._set_available_sensors)

        self.helper.cf.param.all_updated.add_callback(self._ring_populate_dropdown)

        self.logBaro = None
        self.logAltHold = None

        self.ai = AttitudeIndicator()
        self.verticalLayout_4.addWidget(self.ai)
        self.splitter.setSizes([1000,1])

        self.targetCalPitch.setValue(Config().get("trim_pitch"))
        self.targetCalRoll.setValue(Config().get("trim_roll"))

        self.helper.inputDeviceReader.alt1_updated.add_callback(self.alt1_updated)
        self.helper.inputDeviceReader.alt2_updated.add_callback(self.alt2_updated)
        self._tf_state = 0
        self._ring_effect = 0

        # Connect callbacks for input device limiting of rpöö/pitch/yaw/thust
        self.helper.inputDeviceReader.limiting_updated.add_callback(
            self._limiting_updated.emit)
        self._limiting_updated.connect(self._set_limiting_enabled)

    def _set_enable_client_xmode(self, name, value):
        if eval(value) <= 128:
            self.clientXModeCheckbox.setEnabled(True)
        else:
            self.clientXModeCheckbox.setEnabled(False)
            self.clientXModeCheckbox.setChecked(False)

    def _set_limiting_enabled(self, rp_limiting_enabled,
                                    yaw_limiting_enabled,
                                    thrust_limiting_enabled):
        self.maxAngle.setEnabled(rp_limiting_enabled)
        self.targetCalRoll.setEnabled(rp_limiting_enabled)
        self.targetCalPitch.setEnabled(rp_limiting_enabled)
        self.maxYawRate.setEnabled(yaw_limiting_enabled)
        self.maxThrust.setEnabled(thrust_limiting_enabled)
        self.minThrust.setEnabled(thrust_limiting_enabled)
开发者ID:cstanke,项目名称:crazyflie-clients-python,代码行数:67,代码来源:FlightTab.py

示例4: __init__


#.........这里部分代码省略.........
        self.acc_pub = rospy.Publisher("cf_accData", AccelData)
        self.gyro_pub = rospy.Publisher("cf_gyroData", GyroData)
        rospy.Subscriber("cf_textcmd", String, self._cmdCB)
        
        
        super(FlightTab, self).__init__(*args)
        self.setupUi(self)

        self.tabName = "Flight Control"
        self.menuName = "Flight Control"

        self.tabWidget = tabWidget
        self.helper = helper

        self.disconnectedSignal.connect(self.disconnected)
        self.connectionFinishedSignal.connect(self.connected)
        # Incomming signals
        self.helper.cf.connected.add_callback(
            self.connectionFinishedSignal.emit)
        self.helper.cf.disconnected.add_callback(self.disconnectedSignal.emit)

        self._input_updated_signal.connect(self.updateInputControl)
        self.helper.inputDeviceReader.input_updated.add_callback(
                                     self._input_updated_signal.emit)
        self._rp_trim_updated_signal.connect(self.calUpdateFromInput)
        self.helper.inputDeviceReader.rp_trim_updated.add_callback(
                                     self._rp_trim_updated_signal.emit)
        self._emergency_stop_updated_signal.connect(self.updateEmergencyStop)
        self.helper.inputDeviceReader.emergency_stop_updated.add_callback(
                                     self._emergency_stop_updated_signal.emit)
        
        self.helper.inputDeviceReader.althold_updated.add_callback(
                    lambda enabled: self.helper.cf.param.set_value("flightmode.althold", enabled))
        self._gyro_data_signal.connect(self._gyro_data_received)
        self._accel_data_signal.connect(self._accel_data_received)
        self._imu_data_signal.connect(self._imu_data_received)
        self._baro_data_signal.connect(self._baro_data_received)
        self._althold_data_signal.connect(self._althold_data_received)
        self._motor_data_signal.connect(self._motor_data_received)

        self._log_error_signal.connect(self._logging_error)

        # Connect UI signals that are in this tab
        self.flightModeCombo.currentIndexChanged.connect(self.flightmodeChange)
        self.minThrust.valueChanged.connect(self.minMaxThrustChanged)
        self.maxThrust.valueChanged.connect(self.minMaxThrustChanged)
        self.thrustLoweringSlewRateLimit.valueChanged.connect(
                                      self.thrustLoweringSlewRateLimitChanged)
        self.slewEnableLimit.valueChanged.connect(
                                      self.thrustLoweringSlewRateLimitChanged)
        self.targetCalRoll.valueChanged.connect(self._trim_roll_changed)
        self.targetCalPitch.valueChanged.connect(self._trim_pitch_changed)
        self.maxAngle.valueChanged.connect(self.maxAngleChanged)
        self.maxYawRate.valueChanged.connect(self.maxYawRateChanged)
        self.uiSetupReadySignal.connect(self.uiSetupReady)
        self.clientXModeCheckbox.toggled.connect(self.changeXmode)
        self.isInCrazyFlightmode = False
        self.uiSetupReady()

        self.clientXModeCheckbox.setChecked(GuiConfig().get("client_side_xmode"))

        self.crazyflieXModeCheckbox.clicked.connect(
                             lambda enabled:
                             self.helper.cf.param.set_value("flightmode.x",
                                                            str(enabled)))
        self.helper.cf.param.add_update_callback(
                        group="flightmode", name="xmode",
                        cb=( lambda name, checked:
                        self.crazyflieXModeCheckbox.setChecked(eval(checked))))
        self.ratePidRadioButton.clicked.connect(
                    lambda enabled:
                    self.helper.cf.param.set_value("flightmode.ratepid",
                                                   str(enabled)))
        self.angularPidRadioButton.clicked.connect(
                    lambda enabled:
                    self.helper.cf.param.set_value("flightmode.ratepid",
                                                   str(not enabled)))
        self.helper.cf.param.add_update_callback(
                    group="flightmode", name="ratepid",
                    cb=(lambda name, checked:
                    self.ratePidRadioButton.setChecked(eval(checked))))
        
        self.helper.cf.param.add_update_callback(
                    group="flightmode", name="althold",
                    cb=(lambda name, enabled:
                    self.helper.inputDeviceReader.setAltHold(eval(enabled))))

        self.helper.cf.param.add_update_callback(
                        group="imu_sensors",
                        cb=self._set_available_sensors)
                
        self.logBaro = None
        self.logAltHold = None

        self.ai = AttitudeIndicator()
        self.verticalLayout_4.addWidget(self.ai)
        self.splitter.setSizes([1000,1])

        self.targetCalPitch.setValue(GuiConfig().get("trim_pitch"))
        self.targetCalRoll.setValue(GuiConfig().get("trim_roll"))
开发者ID:WSCU,项目名称:crazyflie_ros,代码行数:101,代码来源:FlightTab.py

示例5: FlightTab


#.........这里部分代码省略.........
        self.crazyflieXModeCheckbox.clicked.connect(
                             lambda enabled:
                             self.helper.cf.param.set_value("flightmode.x",
                                                            str(enabled)))
        self.helper.cf.param.add_update_callback(
                        group="flightmode", name="xmode",
                        cb=( lambda name, checked:
                        self.crazyflieXModeCheckbox.setChecked(eval(checked))))
        self.ratePidRadioButton.clicked.connect(
                    lambda enabled:
                    self.helper.cf.param.set_value("flightmode.ratepid",
                                                   str(enabled)))
        self.angularPidRadioButton.clicked.connect(
                    lambda enabled:
                    self.helper.cf.param.set_value("flightmode.ratepid",
                                                   str(not enabled)))
        self.helper.cf.param.add_update_callback(
                    group="flightmode", name="ratepid",
                    cb=(lambda name, checked:
                    self.ratePidRadioButton.setChecked(eval(checked))))
        
        self.helper.cf.param.add_update_callback(
                    group="flightmode", name="althold",
                    cb=(lambda name, enabled:
                    self.helper.inputDeviceReader.setAltHold(eval(enabled))))

        self.helper.cf.param.add_update_callback(
                        group="imu_sensors",
                        cb=self._set_available_sensors)
                
        self.logBaro = None
        self.logAltHold = None

        self.ai = AttitudeIndicator()
        self.verticalLayout_4.addWidget(self.ai)
        self.splitter.setSizes([1000,1])

        self.targetCalPitch.setValue(GuiConfig().get("trim_pitch"))
        self.targetCalRoll.setValue(GuiConfig().get("trim_roll"))

    def thrustToPercentage(self, thrust):
        return ((thrust / MAX_THRUST) * 100.0)

    def uiSetupReady(self):
        flightComboIndex = self.flightModeCombo.findText(
                             GuiConfig().get("flightmode"), Qt.MatchFixedString)
        if (flightComboIndex < 0):
            self.flightModeCombo.setCurrentIndex(0)
            self.flightModeCombo.currentIndexChanged.emit(0)
        else:
            self.flightModeCombo.setCurrentIndex(flightComboIndex)
            self.flightModeCombo.currentIndexChanged.emit(flightComboIndex)

    def _logging_error(self, log_conf, msg):
        QMessageBox.about(self, "Log error", "Error when starting log config"
                " [%s]: %s" % (log_conf.name, msg))
    
    def _cmdCB(self, data):
        m = data.data
        print ("Recieved command: " + m)
        if m is 'q':
            self.helper.cf.commander.send_setpoint(0, 0, 0, 0)
        elif m.count(" ")>0:
            hpr,value=m.split(" ")
            if(hpr is "pitch" or hpr is "p"):
                D.pitch= float(value)
开发者ID:WSCU,项目名称:crazyflie_ros,代码行数:67,代码来源:FlightTab.py

示例6: FlightTab


#.........这里部分代码省略.........
        self.crazyflieXModeCheckbox.clicked.connect(
                             lambda enabled:
                             self.helper.cf.param.set_value("flightmode.x",
                                                            str(enabled)))
        self.helper.cf.param.add_update_callback(
                        group="flightmode", name="xmode",
                        cb=( lambda name, checked:
                        self.crazyflieXModeCheckbox.setChecked(eval(checked))))
        self.ratePidRadioButton.clicked.connect(
                    lambda enabled:
                    self.helper.cf.param.set_value("flightmode.ratepid",
                                                   str(enabled)))
        self.angularPidRadioButton.clicked.connect(
                    lambda enabled:
                    self.helper.cf.param.set_value("flightmode.ratepid",
                                                   str(not enabled)))
        self.helper.cf.param.add_update_callback(
                    group="flightmode", name="ratepid",
                    cb=(lambda name, checked:
                    self.ratePidRadioButton.setChecked(eval(checked))))
        
        self.helper.cf.param.add_update_callback(
                    group="flightmode", name="althold",
                    cb=(lambda name, enabled:
                    self.helper.inputDeviceReader.setAltHold(eval(enabled))))

        self.helper.cf.param.add_update_callback(
                        group="imu_sensors",
                        cb=self._set_available_sensors)
                
        self.logBaro = None
        self.logAltHold = None

        self.ai = AttitudeIndicator()
        #self.verticalLayout_4.addWidget(self.ai)
        #self.splitter.setSizes([1000,1])
        self.gridLayout.addWidget(self.ai, 0, 1)
        
        self.compass = Compass()
        self.gridLayout.addWidget(self.compass, 0, 2)

        self.targetCalPitch.setValue(GuiConfig().get("trim_pitch"))
        self.targetCalRoll.setValue(GuiConfig().get("trim_roll"))
        
        self.apitch = 0
        self.aroll = 0
        self.motor_power = 0

    def thrustToPercentage(self, thrust):
        return ((thrust / MAX_THRUST) * 100.0)

    def uiSetupReady(self):
        flightComboIndex = self.flightModeCombo.findText(
                             GuiConfig().get("flightmode"), Qt.MatchFixedString)
        if (flightComboIndex < 0):
            self.flightModeCombo.setCurrentIndex(0)
            self.flightModeCombo.currentIndexChanged.emit(0)
        else:
            self.flightModeCombo.setCurrentIndex(flightComboIndex)
            self.flightModeCombo.currentIndexChanged.emit(flightComboIndex)

    def _logging_error(self, log_conf, msg):
        QMessageBox.about(self, "Log error", "Error when starting log config"
                " [%s]: %s" % (log_conf.getName(), msg))

    def _motor_data_received(self, data, timestamp):
开发者ID:djvolz,项目名称:Self-Navigating-Crazyflie-Quadcopter,代码行数:67,代码来源:FlightTab.py

示例7: FlightTab

class FlightTab(Tab, flight_tab_class):

    uiSetupReadySignal = pyqtSignal()

    _motor_data_signal = pyqtSignal(object)
    _imu_data_signal = pyqtSignal(object)

    _input_updated_signal = pyqtSignal(float, float, float, float)
    _rp_trim_updated_signal = pyqtSignal(float, float)
    _emergency_stop_updated_signal = pyqtSignal(bool)

    UI_DATA_UPDATE_FPS = 10

    connectionFinishedSignal = pyqtSignal(str)
    disconnectedSignal = pyqtSignal(str)

    def __init__(self, tabWidget, helper, *args):
        super(FlightTab, self).__init__(*args)
        self.setupUi(self)

        self.tabName = "Flight Control"
        self.menuName = "Flight Control"

        self.tabWidget = tabWidget
        self.helper = helper

        self.disconnectedSignal.connect(self.disconnected)
        self.connectionFinishedSignal.connect(self.connected)
        # Incomming signals
        self.helper.cf.connectSetupFinished.add_callback(
                                     self.connectionFinishedSignal.emit)
        self.helper.cf.disconnected.add_callback(self.disconnectedSignal.emit)

        self._input_updated_signal.connect(self.updateInputControl)
        self.helper.inputDeviceReader.input_updated.add_callback(
                                     self._input_updated_signal.emit)
        self._rp_trim_updated_signal.connect(self.calUpdateFromInput)
        self.helper.inputDeviceReader.rp_trim_updated.add_callback(
                                     self._rp_trim_updated_signal)
        self._emergency_stop_updated_signal.connect(self.updateEmergencyStop)
        self.helper.inputDeviceReader.emergency_stop_updated.add_callback(
                                     self._emergency_stop_updated_signal.emit)

        self._imu_data_signal.connect(self._imu_data_received)
        self._motor_data_signal.connect(self._motor_data_received)

        # Connect UI signals that are in this tab
        self.flightModeCombo.currentIndexChanged.connect(self.flightmodeChange)
        self.minThrust.valueChanged.connect(self.minMaxThrustChanged)
        self.maxThrust.valueChanged.connect(self.minMaxThrustChanged)
        self.thrustLoweringSlewRateLimit.valueChanged.connect(
                                      self.thrustLoweringSlewRateLimitChanged)
        self.slewEnableLimit.valueChanged.connect(
                                      self.thrustLoweringSlewRateLimitChanged)
        self.targetCalRoll.valueChanged.connect(self._trim_roll_changed)
        self.targetCalPitch.valueChanged.connect(self._trim_pitch_changed)
        self.maxAngle.valueChanged.connect(self.maxAngleChanged)
        self.maxYawRate.valueChanged.connect(self.maxYawRateChanged)
        self.uiSetupReadySignal.connect(self.uiSetupReady)
        self.clientXModeCheckbox.toggled.connect(self.changeXmode)
        self.isInCrazyFlightmode = False
        self.uiSetupReady()

        self.clientXModeCheckbox.setChecked(GuiConfig().get("client_side_xmode"))

        self.crazyflieXModeCheckbox.clicked.connect(
                             lambda enabled:
                             self.helper.cf.param.set_value("flightctrl.xmode",
                                                            str(enabled)))
        self.helper.cf.param.add_update_callback(
                        "flightctrl.xmode",
                        lambda name, checked:
                        self.crazyflieXModeCheckbox.setChecked(eval(checked)))
        self.ratePidRadioButton.clicked.connect(
                    lambda enabled:
                    self.helper.cf.param.set_value("flightctrl.ratepid",
                                                   str(enabled)))
        self.angularPidRadioButton.clicked.connect(
                    lambda enabled:
                    self.helper.cf.param.set_value("flightctrl.ratepid",
                                                   str(not enabled)))
        self.helper.cf.param.add_update_callback("flightctrl.ratepid",
                    lambda name, checked:
                    self.ratePidRadioButton.setChecked(eval(checked)))

        self.ai = AttitudeIndicator()
        self.gridLayout.addWidget(self.ai, 0, 1)

        self.targetCalPitch.setValue(GuiConfig().get("trim_pitch"))
        self.targetCalRoll.setValue(GuiConfig().get("trim_roll"))

    def thrustToPercentage(self, thrust):
        return ((thrust / MAX_THRUST) * 100.0)

    def percentageToThrust(self, percentage):
        return int(MAX_THRUST * (percentage / 100.0))

    def uiSetupReady(self):
        flightComboIndex = self.flightModeCombo.findText(
                             GuiConfig().get("flightmode"), Qt.MatchFixedString)
#.........这里部分代码省略.........
开发者ID:EmilBechMadsen,项目名称:dronecharge,代码行数:101,代码来源:FlightTab.py

示例8: __init__

    def __init__(self, tabWidget, helper, *args):
        super(FlightTab, self).__init__(*args)
        self.setupUi(self)
        
        self.setStyleSheet("QToolTip { color: #ffffff; background-color: #2d2d2d; border: 1px solid #f0f0f0; border-radius: 3px; }")
        
        self.apitch = 0
        self.aroll = 0
        self.motor_power = 0
        self.tabName = "Flight Control"
        self.menuName = "Flight Control"
        
        self.ai = AttitudeIndicator()
        self.compass = CompassWidget()

        self.tabWidget = tabWidget
        self.helper = helper
        
        ########## Freefall related stuff          
        self.ffd = FFD(parent=self) # detection class          
        self.ffr = FFR(parent=self) # recovery class          
               
        # Connect the crash/free fall detections          
        self.ffd.sigFreeFall.connect(self.freefallDetected)          
        self.ffd.sigCrashed.connect(self.crashDetected)          
        self.ffr.sigRecoveryTimedOut.connect(self.recoveryAborted)          
               
        # continuously send acc, mean, var to AI          
        self.ffd.sigAccMeanVar.connect(self.ai.setFFAccMeanVar)          
        # Only set recovery on if both fall and crash detection are on as well as recovery          
        self.checkBox_ffd.stateChanged.connect(lambda on: self.ffGuiSync(0,on) )  # detect freefall on/off          
        self.checkBox_crash.stateChanged.connect(lambda on: self.ffGuiSync(1,on)) # detect crashing on/off          
        self.checkBox_ffr.stateChanged.connect(lambda on: self.ffGuiSync(2,on))   # recovery crashing on/off          
               
        # Use barometer for recovery (only clickedable if the checkbox activates in reaction to detecting a 10DOF flie          
        self.checkBox_ffbaro.clicked.connect(self.ffr.setUseBaro)          
               
        # intercept control commands          
        self.helper.inputDeviceReader.auto_input_updated.add_callback(self.ffr.step)          
        self.ffr.auto_input_updated.add_callback(self.helper.cf.commander.send_setpoint)          
        self.ffr.auto_input_updated.add_callback(self._input_updated_signal.emit)          
        self.ffr.althold_updated.add_callback(lambda param, arg: self.helper.cf.param.set_value(param, str(arg)))          
               
        # Emergency Stop          
        self._emergency_stop_updated_signal.connect(self.ffr.setKillSwitch)          
        #self._emergency_stop_updated_signal.connect(self.ai.setKillSwitch)          
               
        # Debugging Freefall          
        self.pushButton_ff.clicked.connect(self.ffd.sendFakeEmit)          
        self.pushButton_crash.clicked.connect(self.ffd.sendFakeLandingEmit)          
        self.doubleSpinBox_ff_falloff.valueChanged.connect(self.ffr.falloff.setWidth)          
        self.doubleSpinBox_ff_max.valueChanged.connect(self.ffr.falloff.setMaxThrust)          
        self.doubleSpinBox_ff_min.valueChanged.connect(self.ffr.falloff.setMinThrust)          
        self.doubleSpinBox_ff_time.valueChanged.connect(self.ffr.falloff.setTime)          
        self.pushButton_plot.clicked.connect(self.ffr.falloff.plot)          
               
        self.checkBox_debug.stateChanged.connect(self.toggleFFDebug)          
        self.checkBox_ffbaro.clicked.connect(self.toggleFFDebug)          
               
        # Slow down drawing to GUi items by keeping track of last received data time          
        self.lastImuTime = 0 

        self.disconnectedSignal.connect(self.disconnected)
        self.connectionFinishedSignal.connect(self.connected)
        # Incomming signals
        self.helper.cf.connected.add_callback(
            self.connectionFinishedSignal.emit)
        self.helper.cf.disconnected.add_callback(self.disconnectedSignal.emit)

        self._input_updated_signal.connect(self.updateInputControl)
        self.helper.inputDeviceReader.input_updated.add_callback(
                                     self._input_updated_signal.emit)
        self._rp_trim_updated_signal.connect(self.calUpdateFromInput)
        self.helper.inputDeviceReader.rp_trim_updated.add_callback(
                                     self._rp_trim_updated_signal.emit)
        self._emergency_stop_updated_signal.connect(self.updateEmergencyStop)
        self.helper.inputDeviceReader.emergency_stop_updated.add_callback(self._emergency_stop_updated_signal.emit)
        
        self._switch_mode_updated_signal.connect(self.switchMode)
        self.helper.inputDeviceReader.switch_mode_updated.add_callback(self._switch_mode_updated_signal.emit)
        
        self.helper.inputDeviceReader.althold_updated.add_callback(self.changeHoldmode)

        self._imu_data_signal.connect(self._imu_data_received)
        self._baro_data_signal.connect(self._baro_data_received)
        self._althold_data_signal.connect(self._althold_data_received)
        self._motor_data_signal.connect(self._motor_data_received)
        self._acc_data_signal.connect(self._acc_data_received)
        self._mag_data_signal.connect(self._mag_data_received)

        self._log_error_signal.connect(self._logging_error)

        # Connect UI signals that are in this tab
        self.flightModeCombo.currentIndexChanged.connect(self.flightmodeChange)
        self.minThrust.valueChanged.connect(self.minMaxThrustChanged)
        self.maxThrust.valueChanged.connect(self.minMaxThrustChanged)
        self.maxAltitude.valueChanged.connect(self.maxAltitudeChanged)
        self.thrustLoweringSlewRateLimit.valueChanged.connect(
                                      self.thrustLoweringSlewRateLimitChanged)
        self.slewEnableLimit.valueChanged.connect(
#.........这里部分代码省略.........
开发者ID:capriele,项目名称:crazyflie-clients-python,代码行数:101,代码来源:FlightTab.py

示例9: FlightTab

class FlightTab(Tab, flight_tab_class):

    uiSetupReadySignal = pyqtSignal()
    
    _mode_index = 0

    _motor_data_signal = pyqtSignal(int, object, object)
    _acc_data_signal = pyqtSignal(int, object, object)
    _imu_data_signal = pyqtSignal(int, object, object)
    _althold_data_signal = pyqtSignal(int, object, object)
    _baro_data_signal = pyqtSignal(int, object, object)
    _mag_data_signal = pyqtSignal(int, object, object)

    _input_updated_signal = pyqtSignal(float, float, float, float)
    _rp_trim_updated_signal = pyqtSignal(float, float)
    _emergency_stop_updated_signal = pyqtSignal(bool)
    _switch_mode_updated_signal = pyqtSignal()

    _log_error_signal = pyqtSignal(object, str)
    
    # UI_DATA_UPDATE_FPS = 10

    connectionFinishedSignal = pyqtSignal(str)
    disconnectedSignal = pyqtSignal(str)

    def __init__(self, tabWidget, helper, *args):
        super(FlightTab, self).__init__(*args)
        self.setupUi(self)
        
        self.setStyleSheet("QToolTip { color: #ffffff; background-color: #2d2d2d; border: 1px solid #f0f0f0; border-radius: 3px; }")
        
        self.apitch = 0
        self.aroll = 0
        self.motor_power = 0
        self.tabName = "Flight Control"
        self.menuName = "Flight Control"
        
        self.ai = AttitudeIndicator()
        self.compass = CompassWidget()

        self.tabWidget = tabWidget
        self.helper = helper
        
        ########## Freefall related stuff          
        self.ffd = FFD(parent=self) # detection class          
        self.ffr = FFR(parent=self) # recovery class          
               
        # Connect the crash/free fall detections          
        self.ffd.sigFreeFall.connect(self.freefallDetected)          
        self.ffd.sigCrashed.connect(self.crashDetected)          
        self.ffr.sigRecoveryTimedOut.connect(self.recoveryAborted)          
               
        # continuously send acc, mean, var to AI          
        self.ffd.sigAccMeanVar.connect(self.ai.setFFAccMeanVar)          
        # Only set recovery on if both fall and crash detection are on as well as recovery          
        self.checkBox_ffd.stateChanged.connect(lambda on: self.ffGuiSync(0,on) )  # detect freefall on/off          
        self.checkBox_crash.stateChanged.connect(lambda on: self.ffGuiSync(1,on)) # detect crashing on/off          
        self.checkBox_ffr.stateChanged.connect(lambda on: self.ffGuiSync(2,on))   # recovery crashing on/off          
               
        # Use barometer for recovery (only clickedable if the checkbox activates in reaction to detecting a 10DOF flie          
        self.checkBox_ffbaro.clicked.connect(self.ffr.setUseBaro)          
               
        # intercept control commands          
        self.helper.inputDeviceReader.auto_input_updated.add_callback(self.ffr.step)          
        self.ffr.auto_input_updated.add_callback(self.helper.cf.commander.send_setpoint)          
        self.ffr.auto_input_updated.add_callback(self._input_updated_signal.emit)          
        self.ffr.althold_updated.add_callback(lambda param, arg: self.helper.cf.param.set_value(param, str(arg)))          
               
        # Emergency Stop          
        self._emergency_stop_updated_signal.connect(self.ffr.setKillSwitch)          
        #self._emergency_stop_updated_signal.connect(self.ai.setKillSwitch)          
               
        # Debugging Freefall          
        self.pushButton_ff.clicked.connect(self.ffd.sendFakeEmit)          
        self.pushButton_crash.clicked.connect(self.ffd.sendFakeLandingEmit)          
        self.doubleSpinBox_ff_falloff.valueChanged.connect(self.ffr.falloff.setWidth)          
        self.doubleSpinBox_ff_max.valueChanged.connect(self.ffr.falloff.setMaxThrust)          
        self.doubleSpinBox_ff_min.valueChanged.connect(self.ffr.falloff.setMinThrust)          
        self.doubleSpinBox_ff_time.valueChanged.connect(self.ffr.falloff.setTime)          
        self.pushButton_plot.clicked.connect(self.ffr.falloff.plot)          
               
        self.checkBox_debug.stateChanged.connect(self.toggleFFDebug)          
        self.checkBox_ffbaro.clicked.connect(self.toggleFFDebug)          
               
        # Slow down drawing to GUi items by keeping track of last received data time          
        self.lastImuTime = 0 

        self.disconnectedSignal.connect(self.disconnected)
        self.connectionFinishedSignal.connect(self.connected)
        # Incomming signals
        self.helper.cf.connected.add_callback(
            self.connectionFinishedSignal.emit)
        self.helper.cf.disconnected.add_callback(self.disconnectedSignal.emit)

        self._input_updated_signal.connect(self.updateInputControl)
        self.helper.inputDeviceReader.input_updated.add_callback(
                                     self._input_updated_signal.emit)
        self._rp_trim_updated_signal.connect(self.calUpdateFromInput)
        self.helper.inputDeviceReader.rp_trim_updated.add_callback(
                                     self._rp_trim_updated_signal.emit)
#.........这里部分代码省略.........
开发者ID:capriele,项目名称:crazyflie-clients-python,代码行数:101,代码来源:FlightTab.py

示例10: FlightTab

class FlightTab(Tab, flight_tab_class):

    uiSetupReadySignal = pyqtSignal()
    
    _motor_data_signal = pyqtSignal(object)
    _imu_data_signal = pyqtSignal(object)
    _altimeter_data_signal = pyqtSignal(object)
    _mag_data_signal = pyqtSignal(object)

    UI_DATA_UPDATE_FPS = 10

    connectionFinishedSignal = pyqtSignal(str)
    disconnectedSignal = pyqtSignal(str)
    sendControlSetpointSignal = pyqtSignal(float, float, float, int)


    def __init__(self, tabWidget, helper, *args):
        super(FlightTab, self).__init__(*args)
        self.setupUi(self)

        self.tabName = "Flight Control"
        self.menuName = "Flight Control"

        self.tabWidget = tabWidget
        self.helper = helper

        self.disconnectedSignal.connect(self.disconnected)
        self.connectionFinishedSignal.connect(self.connected)
        # Incomming signals
        self.helper.cf.connectSetupFinished.add_callback(self.connectionFinishedSignal.emit)
        self.helper.cf.disconnected.add_callback(self.disconnectedSignal.emit)
        self.helper.inputDeviceReader.inputUpdateSignal.connect(self.updateInputControl)
        self.helper.inputDeviceReader.calUpdateSignal.connect(self.calUpdateFromInput) 

        self._imu_data_signal.connect(self._imu_data_received)
        self._motor_data_signal.connect(self._motor_data_received)
        self._altimeter_data_signal.connect(self._altimeter_data_received)
        self._mag_data_signal.connect(self._mag_data_received)

        # Connect UI signals that are in this tab
        self.flightModeCombo.currentIndexChanged.connect(self.flightmodeChange)
        self.minThrust.valueChanged.connect(self.minMaxThrustChanged)
        self.maxThrust.valueChanged.connect(self.minMaxThrustChanged)
        self.thrustLoweringSlewRateLimit.valueChanged.connect(self.thrustLoweringSlewRateLimitChanged)
        self.slewEnableLimit.valueChanged.connect(self.thrustLoweringSlewRateLimitChanged)
        self.targetCalRoll.valueChanged.connect(self._trim_roll_changed)
        self.targetCalPitch.valueChanged.connect(self._trim_pitch_changed)
        self.maxAngle.valueChanged.connect(self.maxAngleChanged)
        self.maxYawRate.valueChanged.connect(self.maxYawRateChanged)
        self.uiSetupReadySignal.connect(self.uiSetupReady)
        self.clientXModeCheckbox.toggled.connect(self.changeXmode)
        self.isInCrazyFlightmode = False
        self.uiSetupReady()

        self.clientXModeCheckbox.setChecked(Config().get("client_side_xmode"))
        
        self.crazyflieXModeCheckbox.clicked.connect(
                    lambda enabled: self.helper.cf.param.set_value("flightctrl.xmode", str(enabled)))
        self.helper.cf.param.add_update_callback("flightctrl.xmode", 
                    lambda name, checked: self.crazyflieXModeCheckbox.setChecked(eval(checked)))
        self.ratePidRadioButton.clicked.connect(
                    lambda enabled: self.helper.cf.param.set_value("flightctrl.ratepid", str(enabled)))
        self.angularPidRadioButton.clicked.connect(
                    lambda enabled: self.helper.cf.param.set_value("flightctrl.ratepid", str(not enabled)))
        self.helper.cf.param.add_update_callback("flightctrl.ratepid", 
                    lambda name, checked: self.ratePidRadioButton.setChecked(eval(checked)))


        self.ai = AttitudeIndicator()
        self.gridLayout.addWidget(self.ai, 0, 1)
        
        self.compass = Compass()
        self.gridLayout.addWidget(self.compass, 0, 2)

        self.targetCalPitch.setValue(Config().get("trim_pitch"))
        self.targetCalRoll.setValue(Config().get("trim_roll"))
        
        self.apitch = 0
        self.aroll = 0
        self.motor_power = 0
        
    def thrustToPercentage(self, thrust):
        return ((thrust/MAX_THRUST)*100.0)

    def percentageToThrust(self, percentage):
        return int(MAX_THRUST*(percentage/100.0))

    def uiSetupReady(self):
        flightComboIndex = self.flightModeCombo.findText(Config().get("flightmode"), Qt.MatchFixedString) 
        if (flightComboIndex < 0):
            self.flightModeCombo.setCurrentIndex(0)
            self.flightModeCombo.currentIndexChanged.emit(0)
        else:
            self.flightModeCombo.setCurrentIndex(flightComboIndex)
            self.flightModeCombo.currentIndexChanged.emit(flightComboIndex)

    def loggingError(self):
        logger.warning("Callback of error in LogEntry :(")

    def _motor_data_received(self, data):
#.........这里部分代码省略.........
开发者ID:djvolz,项目名称:Self-Navigating-Crazyflie-Quadcopter,代码行数:101,代码来源:FlightTab.py

示例11: __init__

    def __init__(self, tabWidget, helper, *args):
        super(AutoFlightTab, self).__init__(*args)
        self.setupUi(self)

        global TheTab, natnet, copter
        TheTab = self

        self.tabName = "Auto Flight Control"
        self.menuName = "Auto Flight Control"

        self.tabWidget = tabWidget
        self.helper = helper

        self.disconnectedSignal.connect(self.disconnected)
        self.connectionFinishedSignal.connect(self.connected)
        # Incomming signals
        self.helper.cf.connectSetupFinished.add_callback(
            self.connectionFinishedSignal.emit)
        self.helper.cf.disconnected.add_callback(self.disconnectedSignal.emit)
        self.helper.inputDeviceReader.inputUpdateSignal.connect(
            self.updateInputControl)
        self.helper.inputDeviceReader.calUpdateSignal.connect(
            self.calUpdateFromInput)
        self.helper.inputDeviceReader.emergencyStopSignal.connect(
            self.updateEmergencyStop)

        self._imu_data_signal.connect(self._imu_data_received)
        self._motor_data_signal.connect(self._motor_data_received)

        # Connect UI signals that are in this tab
        self.flightModeCombo.currentIndexChanged.connect(self.flightmodeChange)
        self.minThrust.valueChanged.connect(self.minMaxThrustChanged)
        self.maxThrust.valueChanged.connect(self.minMaxThrustChanged)
        self.thrustLoweringSlewRateLimit.valueChanged.connect(
            self.thrustLoweringSlewRateLimitChanged)
        self.slewEnableLimit.valueChanged.connect(
            self.thrustLoweringSlewRateLimitChanged)
        self.targetCalRoll.valueChanged.connect(self._trim_roll_changed)
        self.targetCalPitch.valueChanged.connect(self._trim_pitch_changed)
        self.maxAngle.valueChanged.connect(self.maxAngleChanged)
        self.maxYawRate.valueChanged.connect(self.maxYawRateChanged)
        self.uiSetupReadySignal.connect(self.uiSetupReady)
        self.clientXModeCheckbox.toggled.connect(self.changeXmode)
        self.isInCrazyFlightmode = False
        self.uiSetupReady()

        self.clientXModeCheckbox.setChecked(Config().get("client_side_xmode"))

        self.crazyflieXModeCheckbox.clicked.connect(
            lambda enabled:
            self.helper.cf.param.set_value("flightctrl.xmode",
                                           str(enabled)))
        self.helper.cf.param.add_update_callback(
            "flightctrl.xmode",
            lambda name, checked:
            self.crazyflieXModeCheckbox.setChecked(eval(checked)))
        self.ratePidRadioButton.clicked.connect(
            lambda enabled:
            self.helper.cf.param.set_value("flightctrl.ratepid",
                                           str(enabled)))
        self.angularPidRadioButton.clicked.connect(
            lambda enabled:
            self.helper.cf.param.set_value("flightctrl.ratepid",
                                           str(not enabled)))
        self.helper.cf.param.add_update_callback("flightctrl.ratepid",
                                                 lambda name, checked:
                                                 self.ratePidRadioButton.setChecked(eval(checked)))

        self.ai = AttitudeIndicator()
        self.gridLayout.addWidget(self.ai, 0, 1)

        self.targetCalPitch.setValue(Config().get("trim_pitch"))
        self.targetCalRoll.setValue(Config().get("trim_roll"))

        """
          ADDITION: automode ui
        """
        self.automodeCheckBox.toggled.connect(self.changeAutoMode)
        self.loopmodeCheckBox.toggled.connect(self.changeLoopMode)
        self.followmodeCheckBox.toggled.connect(self.changeFollowMode)
        self.launchButton.clicked.connect(self.launchButtonClicked)
        self.upButton.clicked.connect(self.upButtonClicked)
        self.downButton.clicked.connect(self.downButtonClicked)
        self.frontButton.clicked.connect(self.frontButtonClicked)
        self.backButton.clicked.connect(self.backButtonClicked)
        self.rightButton.clicked.connect(self.rightButtonClicked)
        self.leftButton.clicked.connect(self.leftButtonClicked)
        self.setAButton.clicked.connect(self.setAButtonClicked)
        self.setBButton.clicked.connect(self.setBButtonClicked)
        self.goAButton.clicked.connect(self.goAButtonClicked)
        self.goBButton.clicked.connect(self.goBButtonClicked)
        self.neutralThrustBox.valueChanged.connect(self.neutralThrustChanged)
        self.thrustScaleBox.valueChanged.connect(self.thrustScaleChanged)
        self.horzScaleBox.valueChanged.connect(self.horzScaleChanged)
        self.velocityScaleBox.valueChanged.connect(self.velocityScaleChanged)
        self.velocitySmoothBox.valueChanged.connect(self.velocitySmoothChanged)

        self.lastUIUpdate = time()

        """
#.........这里部分代码省略.........
开发者ID:mji999,项目名称:CopterLab,代码行数:101,代码来源:AutoFlightTab.py

示例12: AutoFlightTab

class AutoFlightTab(Tab, flight_tab_class):

    uiSetupReadySignal = pyqtSignal()

    _motor_data_signal = pyqtSignal(object)
    _imu_data_signal = pyqtSignal(object)

    UI_DATA_UPDATE_FPS = 10

    connectionFinishedSignal = pyqtSignal(str)
    disconnectedSignal = pyqtSignal(str)

    def __init__(self, tabWidget, helper, *args):
        super(AutoFlightTab, self).__init__(*args)
        self.setupUi(self)

        global TheTab, natnet, copter
        TheTab = self

        self.tabName = "Auto Flight Control"
        self.menuName = "Auto Flight Control"

        self.tabWidget = tabWidget
        self.helper = helper

        self.disconnectedSignal.connect(self.disconnected)
        self.connectionFinishedSignal.connect(self.connected)
        # Incomming signals
        self.helper.cf.connectSetupFinished.add_callback(
            self.connectionFinishedSignal.emit)
        self.helper.cf.disconnected.add_callback(self.disconnectedSignal.emit)
        self.helper.inputDeviceReader.inputUpdateSignal.connect(
            self.updateInputControl)
        self.helper.inputDeviceReader.calUpdateSignal.connect(
            self.calUpdateFromInput)
        self.helper.inputDeviceReader.emergencyStopSignal.connect(
            self.updateEmergencyStop)

        self._imu_data_signal.connect(self._imu_data_received)
        self._motor_data_signal.connect(self._motor_data_received)

        # Connect UI signals that are in this tab
        self.flightModeCombo.currentIndexChanged.connect(self.flightmodeChange)
        self.minThrust.valueChanged.connect(self.minMaxThrustChanged)
        self.maxThrust.valueChanged.connect(self.minMaxThrustChanged)
        self.thrustLoweringSlewRateLimit.valueChanged.connect(
            self.thrustLoweringSlewRateLimitChanged)
        self.slewEnableLimit.valueChanged.connect(
            self.thrustLoweringSlewRateLimitChanged)
        self.targetCalRoll.valueChanged.connect(self._trim_roll_changed)
        self.targetCalPitch.valueChanged.connect(self._trim_pitch_changed)
        self.maxAngle.valueChanged.connect(self.maxAngleChanged)
        self.maxYawRate.valueChanged.connect(self.maxYawRateChanged)
        self.uiSetupReadySignal.connect(self.uiSetupReady)
        self.clientXModeCheckbox.toggled.connect(self.changeXmode)
        self.isInCrazyFlightmode = False
        self.uiSetupReady()

        self.clientXModeCheckbox.setChecked(Config().get("client_side_xmode"))

        self.crazyflieXModeCheckbox.clicked.connect(
            lambda enabled:
            self.helper.cf.param.set_value("flightctrl.xmode",
                                           str(enabled)))
        self.helper.cf.param.add_update_callback(
            "flightctrl.xmode",
            lambda name, checked:
            self.crazyflieXModeCheckbox.setChecked(eval(checked)))
        self.ratePidRadioButton.clicked.connect(
            lambda enabled:
            self.helper.cf.param.set_value("flightctrl.ratepid",
                                           str(enabled)))
        self.angularPidRadioButton.clicked.connect(
            lambda enabled:
            self.helper.cf.param.set_value("flightctrl.ratepid",
                                           str(not enabled)))
        self.helper.cf.param.add_update_callback("flightctrl.ratepid",
                                                 lambda name, checked:
                                                 self.ratePidRadioButton.setChecked(eval(checked)))

        self.ai = AttitudeIndicator()
        self.gridLayout.addWidget(self.ai, 0, 1)

        self.targetCalPitch.setValue(Config().get("trim_pitch"))
        self.targetCalRoll.setValue(Config().get("trim_roll"))

        """
          ADDITION: automode ui
        """
        self.automodeCheckBox.toggled.connect(self.changeAutoMode)
        self.loopmodeCheckBox.toggled.connect(self.changeLoopMode)
        self.followmodeCheckBox.toggled.connect(self.changeFollowMode)
        self.launchButton.clicked.connect(self.launchButtonClicked)
        self.upButton.clicked.connect(self.upButtonClicked)
        self.downButton.clicked.connect(self.downButtonClicked)
        self.frontButton.clicked.connect(self.frontButtonClicked)
        self.backButton.clicked.connect(self.backButtonClicked)
        self.rightButton.clicked.connect(self.rightButtonClicked)
        self.leftButton.clicked.connect(self.leftButtonClicked)
        self.setAButton.clicked.connect(self.setAButtonClicked)
#.........这里部分代码省略.........
开发者ID:mji999,项目名称:CopterLab,代码行数:101,代码来源:AutoFlightTab.py


注:本文中的cfclient.ui.widgets.ai.AttitudeIndicator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。