Crazyradio sees URI as '-f'
Posted: Thu Jul 08, 2021 3:28 pm
When trying to fly a Crazyflie using the multiranger_push.py code (found here https://github.com/bitcraze/crazyflie-l ... er_push.py), the code prints "Connecting to -f", followed by "Connection to -f failed: No driver found or malformed URI: -f". This is peculiar, as I am able to get other code to run smoothly, but have problems only with this particular python file.
Is there anything that might be causing this? Perhaps an outdated repository, or a library I've forgotten to install? Thanks for any help!
(The CF talks on radio://0/100/2M/E7E7E7E702 normally to other programs, by the way. This name should not be the problem.)
Code below:
import logging
import sys
import time
import cflib.crtp
from cflib.crazyflie import Crazyflie
from cflib.crazyflie.syncCrazyflie import SyncCrazyflie
from cflib.positioning.motion_commander import MotionCommander
from cflib.utils import uri_helper
from cflib.utils.multiranger import Multiranger
URI = uri_helper.uri_from_env(default='radio://0/100/2M/E7E7E7E702')
if len(sys.argv) > 1:
URI = sys.argv[1]
# Only output errors from the logging framework
logging.basicConfig(level=logging.ERROR)
def is_close(range):
MIN_DISTANCE = 0.2 # m
if range is None:
return False
else:
return range < MIN_DISTANCE
if __name__ == '__main__':
# Initialize the low-level drivers
cflib.crtp.init_drivers()
cf = Crazyflie(rw_cache='./cache')
with SyncCrazyflie(URI, cf=cf) as scf:
with MotionCommander(scf) as motion_commander:
with Multiranger(scf) as multiranger:
keep_flying = True
while keep_flying:
VELOCITY = 0.5
velocity_x = 0.0
velocity_y = 0.0
if is_close(multiranger.front):
velocity_x -= VELOCITY
if is_close(multiranger.back):
velocity_x += VELOCITY
if is_close(multiranger.left):
velocity_y -= VELOCITY
if is_close(multiranger.right):
velocity_y += VELOCITY
if is_close(multiranger.up):
keep_flying = False
motion_commander.start_linear_motion(
velocity_x, velocity_y, 0)
time.sleep(0.1)
print('Demo terminated!')
Error response:
Is there anything that might be causing this? Perhaps an outdated repository, or a library I've forgotten to install? Thanks for any help!
(The CF talks on radio://0/100/2M/E7E7E7E702 normally to other programs, by the way. This name should not be the problem.)
Code below:
import logging
import sys
import time
import cflib.crtp
from cflib.crazyflie import Crazyflie
from cflib.crazyflie.syncCrazyflie import SyncCrazyflie
from cflib.positioning.motion_commander import MotionCommander
from cflib.utils import uri_helper
from cflib.utils.multiranger import Multiranger
URI = uri_helper.uri_from_env(default='radio://0/100/2M/E7E7E7E702')
if len(sys.argv) > 1:
URI = sys.argv[1]
# Only output errors from the logging framework
logging.basicConfig(level=logging.ERROR)
def is_close(range):
MIN_DISTANCE = 0.2 # m
if range is None:
return False
else:
return range < MIN_DISTANCE
if __name__ == '__main__':
# Initialize the low-level drivers
cflib.crtp.init_drivers()
cf = Crazyflie(rw_cache='./cache')
with SyncCrazyflie(URI, cf=cf) as scf:
with MotionCommander(scf) as motion_commander:
with Multiranger(scf) as multiranger:
keep_flying = True
while keep_flying:
VELOCITY = 0.5
velocity_x = 0.0
velocity_y = 0.0
if is_close(multiranger.front):
velocity_x -= VELOCITY
if is_close(multiranger.back):
velocity_x += VELOCITY
if is_close(multiranger.left):
velocity_y -= VELOCITY
if is_close(multiranger.right):
velocity_y += VELOCITY
if is_close(multiranger.up):
keep_flying = False
motion_commander.start_linear_motion(
velocity_x, velocity_y, 0)
time.sleep(0.1)
print('Demo terminated!')
Error response: