Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def scan(self, address):
self.interfaceFoundSignal.emit(cflib.crtp.scan_interfaces(address))
def scan(self, address):
self.interfaceFoundSignal.emit(cflib.crtp.scan_interfaces(address))
"""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 = LoggingExample(available[0][0])
else:
print("No Crazyflies found, cannot run example")
sys.exit(1)
# 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 le.is_connected:
time.sleep(1)
# MA 02110-1301, USA.
"""
Simple example that scans for available Crazyflies and lists them.
"""
import sys
sys.path.append("../src/cflib")
import cflib.crtp # noqa
# Initiate the low level drivers
cflib.crtp.init_drivers(enable_debug_driver=False)
print("Scanning interfaces for Crazyflies...")
available = cflib.crtp.scan_interfaces()
print("Crazyflies found:")
for i in available:
print(i[0])
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 _handle_scanning(self):
resp = {"version": 1}
interfaces = cflib.crtp.scan_interfaces()
resp["interfaces"] = []
for i in interfaces:
resp["interfaces"].append({"uri": i[0], "info": i[1]})
return resp
"""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:
while le.is_connected:
time.sleep(1)
except KeyboardInterrupt:
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")