Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
QProgressBar::chunk {
background-color: """ + COLOR_BLUE + """;
}
"""
self.setStyleSheet(tcss)
else:
logger.info("Pre-Yosemite - skinny bar stylesheet not applied")
######################################################
self.cf = Crazyflie(ro_cache=None,
rw_cache=cfclient.config_path + "/cache")
cflib.crtp.init_drivers(enable_debug_driver=Config()
.get("enable_debug_driver"))
zmq_params = ZMQParamAccess(self.cf)
zmq_params.start()
zmq_leds = ZMQLEDDriver(self.cf)
zmq_leds.start()
self.scanner = ScannerThread()
self.scanner.interfaceFoundSignal.connect(self.foundInterfaces)
self.scanner.start()
# Create and start the Input Reader
self._statusbar_label = QLabel("No input-device found, insert one to"
" fly.")
self.statusBar().addWidget(self._statusbar_label)
self.is_connected = False
def _connection_lost(self, link_uri, msg):
"""Callback when disconnected after a connection has been made (i.e
Crazyflie moves out of range)"""
print("Connection to %s lost: %s" % (link_uri, msg))
def _disconnected(self, link_uri):
"""Callback when the Crazyflie is disconnected (called in all cases)"""
print("Disconnected from %s" % link_uri)
self.is_connected = False
if __name__ == '__main__':
# Initialize the low-level drivers (don't list the debug drivers)
cflib.crtp.init_drivers(enable_debug_driver=False)
# Scan for Crazyflies and use the first one found
print("Scanning interfaces for Crazyflies...")
available = cflib.crtp.scan_interfaces()
print("Crazyflies found:")
for i in available:
print(i[0])
if len(available) > 0:
pe = ParamExample(available[0][0])
# The Crazyflie lib doesn't contain anything to keep the application
# alive, so this is where your application should do something. In our
# case we are just waiting until we are disconnected.
while pe.is_connected:
time.sleep(1)
else:
print("No Crazyflies found, cannot run example")
self.is_connected = False
def _connection_lost(self, link_uri, msg):
"""Callback when disconnected after a connection has been made (i.e
Crazyflie moves out of range)"""
print("Connection to %s lost: %s" % (link_uri, msg))
def _disconnected(self, link_uri):
"""Callback when the Crazyflie is disconnected (called in all cases)"""
print("Disconnected from %s" % link_uri)
self.is_connected = False
if __name__ == '__main__':
# Initialize the low-level drivers (don't list the debug drivers)
cflib.crtp.init_drivers(enable_debug_driver=False)
# Scan for Crazyflies and use the first one found
print("Scanning interfaces for Crazyflies...")
available = cflib.crtp.scan_interfaces()
print("Crazyflies found:")
for i in available:
print(i[0])
if len(available) > 0:
le = EEPROMExample(available[0][0])
else:
print("No Crazyflies found, cannot run example")
# The Crazyflie lib doesn't contain anything to keep the application alive,
# so this is where your application should do something. In our case we
# are just waiting until we are disconnected.
try:
def scan():
"""
Scan for Crazyflie and return its URI.
"""
# Initiate the low level drivers
cflib.crtp.init_drivers(enable_debug_driver=False)
# Scan for Crazyflies
print('Scanning interfaces for Crazyflies...')
available = cflib.crtp.scan_interfaces()
interfaces = [uri for uri, _ in available]
if not interfaces:
return None
return choose(interfaces, 'Crazyflies found:', 'Select interface: ')
def __init__(self):
"""Initialize the headless client and libraries"""
cflib.crtp.init_drivers()
self._cf = Crazyflie(ro_cache=sys.path[0]+"/cflib/cache",
rw_cache=sys.path[1]+"/cache")
self.kinect = Kinect(self)
# Create PID controllers for piloting the Crazyflie
# The Kinect camera is in the back of the Crazyflie so
# pitch = depth, roll = x, thrust = y
self.r_pid = PID_RP(P=0.05, D=1.0, I=0.00025, set_point=0.0)
self.p_pid = PID_RP(P=0.1, D=1.0, I=0.00025, set_point=0.0)
self.t_pid = PID(P=30.0, D=500.0, I=40.0, set_point=0.0)
self.sp_x = 320
self.sp_y = 240
def __init__(self):
"""Initialize the headless client and libraries"""
cflib.crtp.init_drivers()
self._jr = JoystickReader(do_device_discovery=False)
self._cf = Crazyflie(ro_cache=None,
rw_cache=cfclient.config_path + "/cache")
signal.signal(signal.SIGINT, signal.SIG_DFL)
self._devs = []
for d in self._jr.available_devices():
self._devs.append(d.name)
while thrust >= 20000:
self._cf.commander.send_setpoint(roll, pitch, yawrate, thrust)
time.sleep(0.1)
if thrust >= 25000:
thrust_mult = -1
thrust += thrust_step * thrust_mult
self._cf.commander.send_setpoint(0, 0, 0, 0)
# Make sure that the last packet leaves before the link is closed
# since the message queue is not flushed before closing
time.sleep(0.1)
self._cf.close_link()
if __name__ == '__main__':
# Initialize the low-level drivers (don't list the debug drivers)
cflib.crtp.init_drivers(enable_debug_driver=False)
# Scan for Crazyflies and use the first one found
print("Scanning interfaces for Crazyflies...")
available = cflib.crtp.scan_interfaces()
print("Crazyflies found:")
for i in available:
print(i[0])
if len(available) > 0:
le = MotorRampExample(available[0][0])
else:
print("No Crazyflies found, cannot run example")