Page 1 of 1

[SOLVED] Connection problems with radio and delay

Posted: Fri Apr 02, 2021 2:26 pm
by rampudia
Hi I have been using the Crazyflie for around a month and recently I noticed that when attaching the multiranger deck the Crazyflie's self test fails, but when I remove the deck then it passes. I would order a new deck but the problem is that now my Crazyflie is doing some weird things:

1- When using the Crazyflie client it takes a lot of time to connect to the quadcopter (>30secs) and once it does connect the logging of parameters has a delay of more than 15 seconds.
2 - When running "" it gets stuck at "Connecting to radio://0/80/2M" (the only change I made was the radio from 250K to 2M) and after debugging I realized it gets stuck in line 50:
"with SyncCrazyflie(URI, cf=Crazyflie(rw_cache='./cache')) as scf:"
3- connects, hovers and moves according to the keyboard commands correctly (with just the flow deck and without multiranger deck) but now with a slight lag in response that was not there before.

I already flashed the firmware and since these scripts were working before without a problem I am inclined to think it's something with the hardware but I am confused as why works if that's the case.

Does anyone have ideas of what could be happening? Or something that I could try? Please help!

Re: Connection problems with radio and delay

Posted: Tue Apr 06, 2021 9:12 am
by arnaud
Is the radio RED led lighting up a lot? While communicating with the Crazyflie, the radio green led is lit when a packet is sent successfully and the red led when the packet was lost. So looking at the led can give a good idea of the radio link quality.

One thing I have seen is that the radio quality can degrade greatly on some computer when connected to a USB3 port. There is three solution to that (from best to worst):
- Connect the radio to a USB2 hub
- Connect the radio to a USB2 extension cord
- Connect the radio to another USB port, sometime some USB port will leak less than others

Another thing to test would be to change the radio channel, maybe a new busy radio like wifi appeared around you.

Re: Connection problems with radio and delay

Posted: Tue Apr 06, 2021 4:22 pm
by rampudia
Thank you for the reply.

I changed the crazy radio from a USB3 to a USB2 hub and I see that in all cases the red LED on the Crazyflie is flashing a lot... Even when the Crazyflie is close to the antenna and I tried in different rooms to check it was not external interference of some sort. In contrast, when connecting to the Android app via Bluetooth, the LED flashes in green mostly.

I also noticed that when logging parameters (which still have a consistent delay of ~15 seconds) the pitch and roll seem to work correctly but the yaw tends back to 0 for some reason even when the position holds. Do you think there's a possibility this is not related to some internal HW damage of the Crazyflie?

Re: Connection problems with radio and delay

Posted: Fri Apr 09, 2021 8:37 am
by arnaud
You need to look at the Crazyradio leds, not the Crazyflie one. On the Crazyflie side green means one packet was received and red means one packet was sent. It is normal that it is mostly green when using the android client over bluetooth since the android client is only sending commander packet, it does not implement any logging on bluetooth.

So I am still interested of knowing what is the state of the LEDs on the Crazyradio side, is it only green or mostly red.

The symptoms you describe in your first message could be explained by a bad radio link, or a problem with USB. What OS are your running or are you running in a VM?

Also, I forgot to address the multiranger deck, What error do you see in the console when the deck is attached and the self-test fails? You should still be able to scan and connect to the Crazyflie via radio or USB and see the error in the console. It is possible that the deck is damaged and need replacement.

Re: Connection problems with radio and delay

Posted: Fri Apr 09, 2021 11:09 am
by rampudia
Oh in that case I think the following test of will bring clarity to what's happening:

- I run the program and the Crazyradio's red LED is blinking for ~1:20min (more less consistently in multiple tests) while the console prints:
Scanning interfaces for Crazyflies...

- After this time, only the Crazyradio's green LED starts blinking and the console prints:
Crazyflies found:
Connecting to radio://0/80/2M
Connected to radio://0/80/2M
- The console starts logging data with a consistent ~14s delay, only the Crazyflie's green LED keeps blinking (no red at all) and the program ends

The same delay happens when scanning (1:20min delay) and logging (14s delay) from the Crazyflie client. I am running the VM on Virtualbox in Windows10.

Re: Connection problems with radio and delay

Posted: Mon Apr 12, 2021 1:45 pm
by arnaud

I can reproduce what you are seeing with on Windows in using the VM.

I am not so sure where it come from yet but I am investigating.

One workarround is to log more slowly: when logging at 10Hz I do not see the delay anymore. Another workaround is to run natively: installing the latest lib and client on Windows is as simple as "pip install cfclient" or "pip install -e ." (to install from source). See the client install doc.

There still to be a problem where packets will queue somewhere and introduce the delay you are seeing. I have seen in in the VM, on native Windows but not on native Linux. I created a ticket to track the bug.

So my suggestion would be: if you want to log fast and in "real time", use the python lib and client in native rather than in the VM.

Re: Connection problems with radio and delay

Posted: Tue Apr 13, 2021 9:15 pm
by rampudia
The problem seems now to be solved by logging at 10Hz and also increasing the amount of resources allocated to the VM.

Also, important to set the USB controller in VirtualBox to USB2 and connect your CrazyRadio to a USB2 port.

Thanks for the help!