A Large Nano-Quadcopter Swarm.
The documentation is available here: http://crazyswarm.readthedocs.io/en/latest/.
Please start a Discussion for...
- Getting Crazyswarm to work with your hardware setup.
- Advice on how to use the Crazyswarm Python API to achieve your goals.
- Rough ideas for a new feature.
Please open an Issue if you believe that fixing your problem will involve a change in the Crazyswarm source code, rather than your own configuration files. For example...
- Bug reports.
- New feature proposals with details.
Quick start guide on setting up crazyflies for our lab.
The official documentation in crazyswarm is pretty good. Id highly recommend reading that too/first.
As of Feb 2 2022, Ubuntu 20 installation worked, but ubuntu 18 did not work for us. Some issue in the libmotioncapture sdk.
You will need
- ROS
- cfclient (
python3 -m pip install cfclient
) - cflib (Optional, will be autoinstalled by cfclient) (
python3 -m pip install cflib
) - crazyswarm (Follow instructions at https://crazyswarm.readthedocs.io/en/latest/installation.html)
- We used Ubuntu 20, and Python3
- Update the radio firmware following instructions here: https://github.com/bitcraze/crazyradio-firmware
Note, you should always use
python3
commands, notpython
as some of the documentation suggests. The radio module is labelled with "PA" on radios in our lab. - If you get 'No module named
usb
runpython3 -m pip install pyusb
- Update the firmware on the quad using instructions here: https://www.bitcraze.io/documentation/repository/crazyflie-firmware/master/building-and-flashing/build/ or using the cfclient
- Connect crazyradio to the usb port.
- Connect battery to crazyflie. Note the number of the crazyflie, as this is the ID of the drone.
- Open cfclient (In terminal
cfclient
) - Where you see Addreses (near top left) set the address in the following form
0xE7E7E7E7<ID>
where<ID>
is the quad's id. - Hit Scan
- You should see the interface switch to something like
radio://0/40/2M/E7E7E7E7<ID>
where the first arg is the usb device number (assigned by Ubuntu) the second is the channel number (needed later) the third is the data rate (eg 2M), and the fourth is the uri of the quad. - It should now have connected to the quad. Moving the quad should move the horizon.
- Create a object in vicon tracker for this quad. Call the object
cf<ID>
, for instance, for crazyflie id 7, it should be labelledcf7
. Make sure the forward direction on the quad is aligned to the +X axis of the vicon room.
IN TERMINAL 1:
cd crazyswarm
the package provided by crazyswarmexport CSW_PYTHON=python3
./build.sh
to build the project (build is used instead of catkin_make or anything similar)cd ros_ws
andsource devel/setup.bash
- Next, we run through configuration: https://crazyswarm.readthedocs.io/en/latest/configuration.html#
- Configure
crazyswarm/ros_ws/src/crazyswarm/launch/allcrazyflies.yaml
Here, add a config for each crazyflie you will be running. Use the ID, channel etc from earlier setup. The initial position will be ignored if using motionCapture. Type='default' for the small crazyflies. - Choose which crazyflies will be run in current experiment.
cd crazyswarm/ros_ws/src/crazyswarm/scripts
and runpython3 chooser.py
Use the checkboxes to select which quads are running. This will immediately replacecrazyswarm/ros_ws/src/crazyswarm/launch/crazyflies.yaml
, which is what is used in the final launch script. - Edit the launch script in
crazyswarm/ros_ws/src/crazyswarm/launch/hover_swarm.launch
Mainly, you need to specifymotion_capture_type: "vicon",
motion_capture_host_name:and
object_tracking_type: "motionCapture"` I also commented out the teleop and joy nodes that were in the script originally, but that is upto you. - Ensure vicon is running
- Launch the launch script:
roslaunch crazyswarm hover_swarm.launch
You should see a rviz window pop up, and the the quad should be visible in it.
IN TERMINAL 2:
cd crazyswawm/ros_ws
source devel/setup.bash
cd src/crazyswarm/scripts
python3 niceHover.py
This should launch the drone, and make it hover!
- update
allcrazyflies.yaml
appropriately and runpython3 chooser.py
to set the correct quads up. - source the
ros_ws/devel/setup.py
in each terminal. - In one terminal run
roslaunch crazyswarm hover_launch.launch
- In a second terminal run
python3 figure_8_simple.py
It might be useful to figure out which channel is best: https://blog.crazyflie.net/?p=18