[SOLVED] Connection problems with radio and delay

Firmware/software/electronics/mechanics
Post Reply
rampudia
Beginner
Posts: 11
Joined: Fri Mar 26, 2021 4:21 pm

[SOLVED] Connection problems with radio and delay

Post 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 "flowsequenceSync.py" 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- multiranger_pointcloud.py 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 multiranger_pointcloud.py works if that's the case.

Does anyone have ideas of what could be happening? Or something that I could try? Please help!
Last edited by rampudia on Wed Apr 14, 2021 8:15 pm, edited 1 time in total.
arnaud
Bitcraze
Posts: 2466
Joined: Tue Feb 06, 2007 12:36 pm

Re: Connection problems with radio and delay

Post 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.
rampudia
Beginner
Posts: 11
Joined: Fri Mar 26, 2021 4:21 pm

Re: Connection problems with radio and delay

Post 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?
arnaud
Bitcraze
Posts: 2466
Joined: Tue Feb 06, 2007 12:36 pm

Re: Connection problems with radio and delay

Post 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.
rampudia
Beginner
Posts: 11
Joined: Fri Mar 26, 2021 4:21 pm

Re: Connection problems with radio and delay

Post by rampudia »

Oh in that case I think the following test of basiclog.py 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:
radio://0/80/2M
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.
arnaud
Bitcraze
Posts: 2466
Joined: Tue Feb 06, 2007 12:36 pm

Re: Connection problems with radio and delay

Post by arnaud »

Hi,

I can reproduce what you are seeing with basiclog.py 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.
rampudia
Beginner
Posts: 11
Joined: Fri Mar 26, 2021 4:21 pm

Re: Connection problems with radio and delay

Post 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!
Post Reply