This project is based on Crazyswarm developed by USC ACT Lab. The original code is licensed under the MIT License, which is included in this repository.
- Download Docker from here
- Get into the directory where
Dockerfileis located - On the command prompt, type the following commands
xhost +
docker compose build
docker compose up -d
docker exec -it {name of the folder}-ros-1 bash
cd ~/crazyswarm
./build.sh
After it is built, when you want to run the docker container on the command prompt in future, you can simply type the following commands.
xhost +
docker compose up -d
docker exec -it {name of the folder}-ros-1 bash
For more information, you can look at the instructions in here
- All the scripts are located in the directory
scriptsfolder in~/crazyswarm/ros_ws/src/crazyswarm/scriptsYou can access this folder by typing
cd ~/crazyswarm/ros_ws/src/crazyswarm/scripts
or
cd $SHORT
- In order to run the crazyswarm node, we need to type
roslaunch crazyswarm hover_swarm.launch
- Once the node is running, open another command propt and get into the docker file again, go to the
scriptsfolder, and run the python script - In case you would like to just run the simulation, type
python3 'python_script_name'.py --sim
- When turing on the crazyflie, press its power button for 3 seconds to put it into the bootloader mode
- Turn the CFclient, and go to Connect -> Bootloader -> Cold boot (recovery)
- Initiate bootloader cold boot -> Program
- Wait until everything is finished
- Go to here
- Clone the repo and follow the instructions (ours is Crazyradio PA)
- Note we have 4 crazyradio PAs flahsed and working
- First, you want to set up the initial positions of the crazyflies. We can do this by modifying
allCrazyflies.yamlfile in~/crazyswarm/ros_ws/src/crazyswarm/launch/ - In one comamnd prompt, go to the
scriptsfolder and runchooser.pyscript to select and deselect the crazyflies you would like to include in deployment. Selecting and Deselecting modifiescrazyflies.yamlfile in the same folder - Launch the crazyswarm node
- Now you are ready to run your script
- To test hovering and landing, you can run
first_test.pyin thescriptsfolder.
- We have
emergency_break.pythat constantly publishes the status=True ofCrazyswarmclass - If you interrupt
emergency_break.py, it will start publishing status=False, which can be used to terminate the ongoing script - Run the script while running your ros node, and interrupt the script if you want to land the drones straight down
crazyswarm_py.pyhasreturn_initial_controllerfunction, which brings back the drones back to their initial positions- Currently, it is set that if the ros node crashes, or the script terminates, the
return_initial_controllerfunction is automatically called
In case you get an error with an exit code -6 after launching the crazyswarm node, make sure
- You have typed
xhost +in a command prompt - You are connected to the right WiFi
- Vicon cameras are on and can sense the crazyflies (one way to check is run
roslaunch crazyswarm mocap_helper.launch) - You are connected to the right vicon system (You can check this by looking at the entry for
motion_capture_host_nameinhover_swarm.yamlfile) - Your chooser GUI is not on
- Your computer can recognize the Crazyradio PA, and the radio is also correctly flashed (the flashed ones have
okstickers) - You have connected enough Crazyradios, i.e. if you have 3 different channels, you need 3 radios
- If one crazyflie flips over while another crazyflie goes wild, check their numbers and locations. They might have been flipped
If the crazyflies flip over as soon as they take off, check
- Crazyradio PA is correctly flashed (the flashed ones have
okstickers) - The propellers are placed correctly (check here for more information)
- The crazyflies are using the RIGHT propellers (check here)
- Crazyflies are using the PID controller when doing velocity commands (You can check this by looking at the entry for
controllerinhover_swarm.launchfile) - Battery wires are not blocking the propellers (yeah, seriously. I learned it the hard way)
If the crazyflies suddenly flip over while flying
- Make sure you are not using goTo and cmdVelocityWorld together