communication delay over time in hover mode

Firmware/software/electronics/mechanics
Post Reply
nl_frcf
Beginner
Posts: 3
Joined: Sat Nov 09, 2013 5:28 pm

communication delay over time in hover mode

Post by nl_frcf »

Hi guys,

I'm using omwdunkley's hover mode source for both firmware and client. https://bitbucket.org/omwdunkley/crazyflie-pc-client.
I'm running on the Bitcraze 0.4 xubuntu VM.

Everything is working fine, hover works great (well, i'm working on trying to make it as 99% perfect as i can with PID tweaking :P), but after a while, I get this werid thing that the commands that I send to the CF are received with some delay. Looking at the Flight Control tab I see ther is a real delay between the gyro presented and the actual orientation of the CF and the the change of the targeted RPY vs. when I actually move my stick.

I noticed that it starts with the GUI and then it actually evolves into being an actual communication delay.

What could be wrong? Should I check on my CPU usage (because otherwise, all the other process on my machine are smooth)?

Thanks in advance,
nl_frcf
Beginner
Posts: 3
Joined: Sat Nov 09, 2013 5:28 pm

Re: communication delay over time in hover mode

Post by nl_frcf »

Maybe it has to do with this?

WARNING:cflib.crazyflie:ExpectAnswer: ERROR! Older timer whas running while scheduling new one on [5]
INFO:cflib.crazyflie:Callback->Connected to [radio://0/7/250K]
ERROR:cflib.crazyflie.toc:Got packet that was not on TOC channel, TOC fetch will probably not succeed
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: communication delay over time in hover mode

Post by tobias »

I have not seen this but it might be due to an overloaded queue in the Crazyflie or bad radio link. Have you tried changing the datarate to 2M?
nl_frcf
Beginner
Posts: 3
Joined: Sat Nov 09, 2013 5:28 pm

Re: communication delay over time in hover mode

Post by nl_frcf »

So it seems that removing the flight control tab does the job. For some reason, that tab is very CPU intensive, in such a way that impares with the processing of communication between the radio and the CF.

Any way to overpass this delay the flight tab is causing, without having to close it?
omwdunkley
Expert
Posts: 162
Joined: Thu Jun 06, 2013 9:56 pm
Location: Munich

Re: communication delay over time in hover mode

Post by omwdunkley »

nl_frcf wrote:So it seems that removing the flight control tab does the job. For some reason, that tab is very CPU intensive, in such a way that impares with the processing of communication between the radio and the CF.

Any way to overpass this delay the flight tab is causing, without having to close it?
Hi, I guess its because the tab is being updated faster than it needs to be :)

Check the following files
crazyflie-pc-client/lib/cfclient/tabs/FlightTab.py
crazyflie-pc-client/lib/cfclient/ui/widgets/ai.py

The first thing you can try is to reduce the logging frequency from the flie. Everytime you see something like this:

Code: Select all

lg = LogConfig("Stabalizer", 50)
(eg line 213 in FlightTab)
It means that the Stabilizer log group is initialised at 50hz (ie updates per second), so try to change the number down to 10 or 5.

Right now its implemented in such a way that whenever new info is available, it updates the GUI. There are other log groups too (Motors, Baro, Hover) and each incoming update triggers a GUI update.
So you could change it in such a way that only one of the callback updates the GUI and the rest just set a value. (remove some of the self.repaint() lines in the setXXX(self, data) functions in ai.py).

Im not in a position to test changes to code right now, so maybe you can fiddle with it for the moment :)

Does this help?
Cheers!
jodgey
Beginner
Posts: 1
Joined: Mon Nov 18, 2013 9:55 pm

Re: communication delay over time in hover mode

Post by jodgey »

Are you able to post you results for the new hover coding?
Post Reply