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


Python AttitudeIndicator.setKillSwitch方法代码示例

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


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

示例1: FlightTab

# 需要导入模块: from cfclient.ui.widgets.ai import AttitudeIndicator [as 别名]
# 或者: from cfclient.ui.widgets.ai.AttitudeIndicator import setKillSwitch [as 别名]
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,代码行数:103,代码来源:FlightTab.py


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