Parameter Downloading with Swarm()

Discussions about autonomous flight in general, regardless of positioning method
Post Reply
cgpenguin
Member
Posts: 35
Joined: Wed Aug 05, 2020 3:49 pm

Parameter Downloading with Swarm()

Post by cgpenguin »

Hey
I've been testing some swarm flight sequences based off of the swarm example and so far I've gotten most things working. However, there's one thing I am not sure what it does and why it acts like it does.

That thing is parameter downloading. There's the function that's waiting for parameter download, but I do not know what parameters those are and what's their main function. What I've noticed doing tests with my 3 drones is that, as I increase my drone count, the time it takes for this to execute grows a lot - 1 drone is ~10 seconds, 2 drones is ~35 seconds and 3 is ~50 seconds.

I wonder how much this could increase with more drones and if there's a way to reduce this effect? And what does that function do exactly?
kristoffer
Bitcraze
Posts: 479
Joined: Tue Jun 30, 2015 7:47 am

Re: Parameter Downloading with Swarm()

Post by kristoffer »

Hi!

When the python lib connects to a Crazyflie, a sequence of events take place as part of the connection process.
One part of this is to download the table of contents (ToC) for parameters and log variables from the Crazyflie to make the client aware of what log and params that are supported in the firmware. The current parameter values are also transferred to enable the client to display them correctly. This is a fair amount of data and takes a while, if you add more Crazyflies the time essentially increases linearly.

There is a caching mechanism that stores the ToCs in the PC and only downloads them if needed which speeds up the connection sequence considerably. The caching is disabled by default (as the lib does not know where to write the files) but is easy to enable. If you are using the Swarm class to connect, you can find an example of how to do it here https://github.com/bitcraze/crazyflie-l ... #L141-L142

To connect a single Crazyflie asynchronously using the cache use
cf = Crazyflie(rw_cache='./cache')
cf.open_link(link_uri)
# Do stuff

To connect a singel Crazyflie synchronously using the cache use
cf = Crazyflie(rw_cache='./cache')
with SyncCrazyflie('usb://0', cf=cf) as scf:
# Do stuff

If you enable the caching, the first connection will still take a while, but after that it should be quicker.
Post Reply