Do not forget to source your ROS 2 workspace in each terminal you would like to use it

. install/local_setup.bash


If you work in a shared network (lab, classroom) or similar, you might want to avoid controlling other robots. This is in particular true for simulation. In this case, you can use

export ROS_DOMAIN_ID=<unique number between 0 and 101>

The first environment variable restricts ROS to your local machine. The second is useful if you have multiple user accounts on the same machine (e.g., a shared workstation computer). In such case, each user should use a unique domain ID.


All configuration files are in crazyflie/config.

  • crazyflies.yaml : setting up everything related to the robots.

  • server.yaml : setting up everything related to the server.

  • motion_capture.yaml : configs for the motion capture package.

  • teleop.yaml : configs for remote controls.


Each crazyflie should have an unique URI which can be changed in Bitcraze’s CFclient. They can also be enabled in case you don’t want the server to connect with it.

        enabled: true
        uri: radio://0/80/2M/E7E7E7E7E7
        initial_position: [0, 0, 0]
        type: cf21  # see robot_types

        enabled: false
        uri: radio://0/80/2M/E7E7E7E705
        initial_position: [0, -0.5, 0]
        type: cf21  # see robot_types

The yaml file also contains different robot_types, to indicate differences between each platform:

            enabled: true
            # only if enabled; see motion_capture.yaml
            marker: default_single_marker
            dynamics: default
        big_quad: false
            voltage_warning: 3.8  # V
            voltage_critical: 3.7 # V

            enabled: true
            # only if enabled; see motion_capture.yaml
            marker: mocap_deck
            dynamics: default
        big_quad: false
            voltage_warning: 3.8  # V
            voltage_critical: 3.7 # V

The yaml file also contain an ‘all’ field, in case you have parameters or logging that you want enabled for all the connected crazyflies.

        enabled: false
            frequency: 10 # Hz
        #  topic_name1:
        #    frequency: 10 # Hz
        #    vars: ["stateEstimateZ.x", "stateEstimateZ.y", "stateEstimateZ.z", "pm.vbat"]
        #  topic_name2:
        #    frequency: 1 # Hz
        #    vars: ["stabilizer.roll", "stabilizer.pitch", "stabilizer.yaw"]
            enHighLevel: 1
            estimator: 2 # 1: complementary, 2: kalman
            controller: 2 # 1: PID, 2: mellinger

The above also contains an example of the firmware_logging field, where default topics can be enabled or custom topics based on the existing log toc of the crazyflie. Moreover, it also contains the firmware_params field, where parameters can be set at startup. Also see the parameter list of the crazyflie for that.

Mind that you can also place the firmware_params and firmware_logging fields per crazyflie in ‘robots’ or the ‘robot_types’ field. The server node will upon initialization, first look at the params/logs from the individual crazyflie’s settings, then the robot_types, and then anything in ‘all’ which has lowest priority.


Any usage of the ROS API, including high-level Python scripts, can be visualized before execution. The initial position and number of robots is taken from the crazyflies.yaml configuration file. The simulation uses the firmware code as software-in-the-loop, and can optionally include the robot dynamics. The configuration of the simulation (physics simulator, controller, etc.) can be changed in server.yaml.


[terminal]$ ros2 launch crazyflie_examples script:=hello_world backend:=sim

which is a short-hand for the following two commands:

[terminal1]$ ros2 launch crazyflie backend:=sim
[terminal2]$ ros2 run crazyflie_examples hello_world --ros-args -p use_sim_time:=True

Physical Experiments

Teleoperation controller

We currently assume an XBox controller (the button mapping can be changed in teleop.yaml). It is possible to fly in different modes, including attitude-control and position-control (in which case any localization system can assist.)

ros2 launch crazyflie

Python scripts

In the first terminal run the server, in the second the desired script. You may run the script multiple times or different scripts while leaving the server running.

[terminal1]$ ros2 launch crazyflie
[terminal2]$ ros2 run crazyflie_examples hello_world

If you only want to run a single script once, you can also use:

[terminal]$ ros2 launch crazyflie_examples script:=hello_world

Swarm Management

The launch file will also start a swarm management tool that is a ROS node and web-based GUI. In the upper pane is the location of the drone visualized in a 3D window, similar to rviz. In the lower pane, the status as well as log messages are visible (tabbed per drone). In the future, we are planning to add support for rebooting and other actions.