Crazyflie Swarm Controller documentation

Overview

Crazyflie Swarm Controller is a ROS package to fly a swarm of crazyflie in formation.

Main features:

  • Python API
  • Collision free trajectory planning via a DMPC algorithm
  • Fly swarm in various formations (square, circle, line…)
  • Simulation
  • Easy control with a joystick

This project was developped with the Mobile Robotics and Autonomous Systems Laboratory at Polytechnique Montréal.

To cite this project:

Todo

Add citation

Crazyflie Swarm Controller uses crazyflier_ros [CIT1] to send commands to the crazflies via ros.

The architecture used was inspired by the Crazyswarm project [CIT2].

Example

Formation Example

# Formation exemple
swarm = SwarmAPI()

# Link joystick buttons to commands
swarm.start_joystick("ds4")
swarm.link_joy_button("S", swarm.take_off)
swarm.link_joy_button("X", swarm.land)
swarm.link_joy_button("O", swarm.emergency)
swarm.link_joy_button("T", swarm.toggle_ctrl_mode)

# Start swarm
swarm.set_mode("formation")
swarm.set_formation("v")

swarm.take_off()
rospy.sleep(10)

# Change formation
swarm.set_formation("pyramid")

High level controller example

# Trade spots demo
swarm = SwarmAPI()
swarm.set_mode("automatic")

# Take off
swarm.take_off()

# Switch positions
pose = swarm.get_positions()
goals = {}
goals["cf_0"] = pose["cf_1"]
goals["cf_1"] = pose["cf_0"]
swarm.go_to(goals)

rospy.sleep(10)

# Land
swarm.land()
video1 video2

Python API

Python API

Files Tree

|-- README.md
|-- build.sh: Project build script
|-- pc_persmissions.sh
|-- requirements.txt
|-- docs: Folder with all thing related to documentation
|-- demos: Example scripts
|
|-- flight_data
    |-- flight_analysis.py: Script to analyse flight flight data
    |-- user_command.py: Script to read user input
    |-- all flight data...
|
|-- ros_ws
    |-- build
    |-- devel
    |-- src
        |-- CMakeLists.txt
        |-- crazyflie_ros
        |-- formation_manager
        |-- swarm_manager
        |-- trajectory_planner

ROS Architecture

To control the swarm, three different ros packages are used:

The general architecture can be found here General Architecture.