Home

Awesome

flock2

flock2 can fly a swarm of DJI Tello drones. flock2 is built on top of ROS2, fiducial_vlam, and tello_ros.

Installation

1. Set up your Linux environment

Set up a Ubuntu 20.04 box or VM.

2. Set up your Python environment

Use your favorite Python package manager to set up Python 3.6+ and the following packages:

3. Set up your ROS environment

Install ROS2 Foxy with the ros-foxy-desktop option.

If you install binaries, be sure to also install the development tools and ROS tools from the source installation instructions.

Install these additional packages:

sudo apt install ros-foxy-cv-bridge ros-foxy-camera-calibration-parsers ros-foxy-gazebo-ros

4. Install dependencies

Download, compile and install the following packages:

mkdir -p ~/flock2_ws/src
cd ~/flock2_ws/src
git clone https://github.com/clydemcqueen/flock2.git
git clone https://github.com/clydemcqueen/tello_ros.git
git clone https://github.com/ptrmu/fiducial_vlam.git
git clone https://github.com/ptrmu/ros2_shared.git
cd ..
source /opt/ros/foxy/setup.bash
# If you didn't install Gazebo, avoid building tello_gazebo:
colcon build --event-handlers console_direct+ --packages-skip tello_gazebo

Running

Flying a single drone

launch_one.py will allow you to fly a drone using a wired XBox One gamepad.

Turn on the drone, connect to TELLO-XXXXX via wifi, and launch ROS2:

cd ~/flock2_ws
source install/setup.bash
ros2 launch flock2 launch_one.py

Gamepad controls:

Flying multiple drones

launch_two.py provides an example for flying multiple drones.

Key elements of multi-drone missions:

Design

Coordinate frames

ROS world coordinate frames are ENU (East, North, Up).

There are 3 significant coordinate frames in flock2:

The arena

An arena is a right rectangular prism defined by 2 points: (x1=0, y1=0, z1=0) and (x2, y2, z2). z1 defines the ground, so z2 must be positive. The ground must be flat. Drones will never fly outside of the arena.

There must be at least one 6x6 ArUco marker, with id 1, associated with the arena. Marker 1's pose is known in advance, the other ArUco marker poses are estimated during flight. The drones will use ArUco marker poses to estimate their current pose.

The mission (under development)

A mission is defined as autonomous flight by all drones. A mission is initiated when the user hits the start mission button on the gamepad. A mission will end on it's own, or when the user hits the stop mission button.

All drones must be able to localize on the ground to start a mission. In practice this means that all drones must be able to see marker 1 while sitting on the ground, or at least one drone has to be flown around manually to build a good map before the mission starts.

The overall mission dataflow looks like this:

  1. flock_base publishes a message on the /start_mission topic
  2. planner_node generates an overall pattern of flight for all drones, and publishes a sequence waypoints for each drone on /[prefix]/plan
  3. drone_base subscribes to ~plan and ~base_odom, runs a PID controller, and sends commands to tello_ros

If odometry stops arriving drone_base will execute a series of recovery tasks, which might include landing.

If flight indicates that a drone has a low battery drone_base will land the drone.

Simulating 4 drones in Gazebo

Install Gazebo 9 and build tello_gazebo, if you haven't already.

cd ~/flock2_ws
source install/setup.bash
export GAZEBO_MODEL_PATH=${PWD}/install/tello_gazebo/share/tello_gazebo/models
source /usr/share/gazebo/setup.sh
ros2 launch flock2 gazebo_launch.py

Hit the "B" button on the XBox controller to start the mission. You should see 4 drones take off, rotate through 4 positions, then land.

Node details

flock_base

Orchestrates the flight of one or more Tello drones.

Subscribed topics
Published topics
Parameters

drone_base

Controls a single Tello drone. Akin to move_base in the ROS navigation stack.

Subscribed topics
Published topics
Published services

planner_node

Compute and publish a set of waypoints for each drone in a flock.

Subscribed topics
Published topics
Parameters

Versions and branches

flock2 was developed along with several other projects while ROS2 was rapidly changing. All of the related projects adopted similar conventions around branch names:

The following projects and branches were tested together: