Crazyflie Gates Example

This project contains the simulated version, which uses Gazebo Platform, and the real version, which uses Crazyflie Platform. You can install them following the instructions in Gazebo Platform installation section and Crazyflie Platform installation section.

To install this project, please clone the repository:

git clone https://github.com/aerostack2/project_crazyflie_gates

To start using this project, please go to the root folder of the project.

Execution

The flags for the components launcher are:

  • -s: launch the components for the simulated version.

  • -m: launch the components for the swarm multiagent system.

  • -t: launch keyboard teleoperation.

  • -r: record rosbag.

  • -n: use custom dron namespace.

Arguments for the components launcher are:

  • -e: estimator type. Allowed values [ground_truth, raw_odometry, mocap]. Default: ground_truth.

Simulated execution

We can execute this project in simulation mode. This will open a simulation in Gazebo and the Aerostack2 components will use simulation time.

Single drone

In order to launch the components for a single drone, do:

./launch_as2.bash -s -t

This will open a simulation for a single drone alongside the Aerostack2 components necessary for the mission execution.

A window like the following image should open.

../../../_images/single_drone_sim.png

Gazebo simulator

It will also open a keyboard teleoperation (argument -t), which you can use to teleoperate the drone with the aerostack2 keyboard teleoperation user interface.

A window like the following image should popup:

../../../_images/keyboard_teleop_view1.png

Keyboard teleoperation

To start the mission, go to a new terminal line and execute:

python3 mission.py -s

Here is an example of the simulated execution of the mission with a single drone:

To do a clean exit of tmux, execute:

./stop.bash cf0

Swarm drones

In order to launch the components for a swarm of 2 drones, do:

./launch_as2.bash -s -m -t

This will open a simulation for a swarm (argument -m) of 3 drones alongside the Aerostack2 components necessary for the mission execution.

A window like the following image should open.

../../../_images/swarm_sim.png

Gazebo simulator

It will also open a keyboard teleoperation (argument -t), which you can use to teleoperate the swarm with the aerostack2 keyboard teleoperation user interface.

A window like the following image should popup:

../../../_images/keyboard_swarm_view.png

Keyboard teleoperation

To start the mission, execute:

python3 mission_swarm.py -s

Here is an example of the simulated execution of the mission with a swarm of drones:

To do a clean exit of tmux, execute the following command with the list of the used drones:

./stop.bash cf0 cf1

Real execution

In order to perform a real execution of this project, it is needed to have the crazyflie(s) configured and switched on in its initial position.

Before launching the components, remember to set the correct address in the file real_config/swarm_config_file.yaml, as indicated in Platform Launch. Leave only the entries for the drone(s) that will be used, even if it is only one.

It is also important to decide which state estimator to use. Currently, Aerostack2 supports two types of state estimators for the Crazyflie, this are:

  • Optitrack: which uses mocap plugin.

  • Optical Flow: which uses raw_odometry plugin.

Note

Before launching the components with mocap, it is also necessary to set the file real_config/mocap.yaml. This file will be used by the state estimator mocap plugin to get the ground truth pose coming from our motion capture system into the Aerostack2 common interface localization topics.

Warning

In order to use motion capture system localization, please clone the intermediate component inside Aerostack2 workspace with:

git clone https://github.com/aerostack2/mocap_optitrack

and build it alongside the other Aerostack2 components.

Single drone

In order to launch the components for a single drone with optical flow, do:

./launch_as2.bash -e raw_odometry -t

Before launching the components with mocap, it is also necessary to set the file real_config/mocap.yaml. This file will be used by the state estimator mocap plugin to get the ground truth pose coming from our motion capture system into the Aerostack2 common interface localization topics.

In order to launch the components for a single drone with mocap, do:

./launch_as2.bash -e mocap -t

To start the mission for a single drone, go to a new terminal line and execute:

python3 mission.py

Here is an example of the real execution of the mission with a single drone:

To do a clean exit of tmux, execute the following command:

./stop.bash cf0

Swarm drones

In order to launch the components for a swarm of 2 drones with optical flow, do:

./launch_as2.bash -m -e raw_odometry -t

In order to launch the components for a swarm of 2 drones with mocap, do:

./launch_as2.bash -m -e mocap -t

To start the mission for a swarm of 2 drones, go to a new terminal line and execute:

python3 mission_swarm.py

Here is an example of the execution of the real mission with a swarm of drones:

To do a clean exit of tmux, execute the following command with the list of the used drones:

./stop.bash cf0 cf1