I would like to be able to start multiple drones in a future product, which is why i want to be able to declare the drones into a variable, and boot them up. But i cannot figure out how to.
I've made two example programs to highlight my issue, the first one doesn't work, the second one does.
Code: Select all
scf = SyncCrazyflie(URI, cf=Crazyflie(rw_cache='./cache'))
mr = Multiranger(scf)
while True:
print(mr.front)
time.sleep(0.5)
Code: Select all
with SyncCrazyflie(URI, cf=Crazyflie(rw_cache='./cache')) as scf:
with Multiranger(scf) as mr:
while True:
print(mr.front)
time.sleep(0.5)
Initialization (works for both programs)
Code: Select all
import time
import logging
import cflib.crtp
from cflib.crazyflie import Crazyflie
from cflib.crazyflie.syncCrazyflie import SyncCrazyflie
from cflib.utils.multiranger import Multiranger
logging.basicConfig(level=logging.ERROR)
URI = 'radio://0/80/2M/E7E7E7E701'
cflib.crtp.init_drivers()