Running the swarm sequence.py script

Post here to get support
Post Reply
PO1
Beginner
Posts: 12
Joined: Fri Mar 23, 2018 9:02 am

Running the swarm sequence.py script

Post by PO1 » Fri Jun 22, 2018 8:59 am

hI, I would like to run the swarmSequence.py script in the Crazyflie lib python directory on Github, Its importing CachedCFFactory and Swarm.
I will run it from a python script but get a not found error. This particular code is not in the current release I have downloaded.
I've seen this instruction from another post

Until then just clone the repo and pip install -e path/to/your/cloned/cflib to run from the source in the repos instead.

Not sure about the pip install -e instruction, could somebody elaborate on this a little more please.



aesreal
Beginner
Posts: 22
Joined: Thu Mar 08, 2018 6:34 am

Re: Running the swarm sequence.py script

Post by aesreal » Fri Jun 22, 2018 1:59 pm

You would have to first install the crazyflie-lib package to your computer. swarmSequence.py should have been downloaded from the examples of crazyflie-lib here: https://github.com/bitcraze/crazyflie-l ... equence.py

In order for that to run, you first have to use your terminal to install the package itself.

Assuming you are using Linux,

pip is a Python package manager that searches for packages from their PyPI

The -e is an editable mode, which has already been described here: https://github.com/bitcraze/crazyflie-lib-python. It means that the package would be installed in a way that any changes made to the package would be directly reflected in your use environment: https://stackoverflow.com/questions/350 ... ip-install

To install, run the package "pip install path/directory", where path/directory is the full path to your cflib's setup.py file.
https://github.com/bitcraze/crazyflie-l ... r/setup.py

PO1
Beginner
Posts: 12
Joined: Fri Mar 23, 2018 9:02 am

Re: Running the swarm sequence.py script

Post by PO1 » Fri Jun 22, 2018 2:44 pm

1. I would like to stick to Windows 10 if thats possible?

2. I've installed cflib as per https://www.bitcraze.io/getting-started ... ne-bundle/

3. I guess I would like to run swarmSequence.py in the same way as other scripts i.e. from the python editor 'Idle' in Windows 10

Will this work with just the flow decks or does it need the Loco positioning system?

4. I would also like to run swarmSequenceCircle.py which uses math,time, cflib.crtp, cflib.crazyflie.swarm libraries

5. I'm using flow Decks on the Crazyflies

Thanks for your help

aesreal
Beginner
Posts: 22
Joined: Thu Mar 08, 2018 6:34 am

Re: Running the swarm sequence.py script

Post by aesreal » Sat Jun 23, 2018 8:50 am

It is possible to stick with WIndows 10. the command line has pip support.

To run swarmSeqeuence.py, Just type in python parth/to/swarmsequence. And it should work.

I haven't use flow decks before, but flow decks are just extensions to the crazyflies. You don't need it for the script to actually work.

Remember to first configure and setup your crazyflies to have the correct addresses, and update accordingly in the swarmsequence script.

PO1
Beginner
Posts: 12
Joined: Fri Mar 23, 2018 9:02 am

Re: Running the swarm sequence.py script

Post by PO1 » Sat Jun 23, 2018 10:56 am

When I run the swarmSequenceCircle.py script I get

Traceback (most recent call last):
File "swarmsequenceCircle.py", line 45, in <module>
from cflib.crazyflie.swarm import CachedCfFactory
ImportError: cannot import name 'CachedCfFactory'

I'm guessing this is because the cflib i have on my laptop is not quite up to date and doesent contain the additional CachedCfFactory class or the swarm.py.

Within Windows, how do i update the cflib on my machine, very little experience with this so a quick 'step by step' would be a great help, would be great to run it this weekend in time for next weeks work

big thanks

arnaud
Bitcraze
Posts: 2043
Joined: Tue Feb 06, 2007 12:36 pm

Re: Running the swarm sequence.py script

Post by arnaud » Mon Jul 02, 2018 7:41 am

If you cloned the crazyflie-lib project from source you should be able to use it instead of the pip-installed version. Open a command line window, navigate in the crazyflie-python-lib folder and type:

Code: Select all

pip uninstall cflib
pip install -e .
This will install the current folder for the cflib library in your system.

PO1
Beginner
Posts: 12
Joined: Fri Mar 23, 2018 9:02 am

Re: Running the swarm sequence.py script

Post by PO1 » Wed Jul 04, 2018 4:38 pm

Thank you Arnaud, all updated and working

Post Reply