Setup of the Crazyflie 2.x (Cyber-physical Asset)

First clone the following GitHub repository, which provides sort of a cyber-physical representation of the Crazyflie 2.x drone. Execute the following command in the terminal:

$ mkdir -p ~/uniagent_ws/ && cd ~/uniagent_ws/
$ git clone https://github.com/UniAgent-CyberPhysicalAssets/cps.asset.crazyflie

Specifically, this resource enables integration, simulation, and control of Crazyflie 2.x in both physical and virtual environments.

It is a prerequisite for all subsequent steps in this tutorial, including:

  • Using the Gazebo simulation environment for Crazyflie drones
  • Controlling and monitoring Crazyflies via RESTful web endpoints and WebSockets
  • Launching the cfclient tool to configure Crazyflie hardware
  • Extending the simulation with custom Gazebo plugins
  • And more...

USB Setup

Note: To control not only a virtualized Crazyflie drone but also a real Crazyflie, you need to make some USB devices such as the Crazyradio PA (the long range open USB radio dongle) available in the Docker containers.

  • Use the lsusb command to get a list of all USB devices connected to your system. Each line in the lsusb output represents a USB device with a Bus number and Device number.
  • Use udevadm to get detailed information about the device, which includes the associated /dev entry. Below replace 001 with the Bus number and 009 with the Device number from the lsusb output. Specifically, use the output of DEVNAME.
  • Get device major number via ls -lausing information from DEVNAME
  • Example:
$ lsusb
$ sudo udevadm info --query=all --name=/dev/bus/usb/001/009
$ ls -la /dev/bus/usb/001/009
crw-rw-r-- 1 root plugdev 189, 8 Aug  8 22:38 /dev/bus/usb/001/009

(!) With this information, note down the following Docker rule for later: (!)

--device-cgroup-rule='c 189:* rmw' -v /run/udev:/run/udev:ro -v /dev:/dev

You need to probably adjust the major device number or the path if you have a different device or operating system.

In the following pages, you have to add this rule when starting the Docker container.

Note: Instead, you can also use the universal but insecure option: --privileged -v /dev/bus/usb:/dev/bus/usb.

System Hardware Requirements

The setup described in this tutorial does not work for arm64 platforms since not for all ROS2 packages, an arm64 binary is available.

For example, the package ros-humble-gazebo-no-physics is required, which has however no arm64 binary (see here: http://packages.ros.org/ros2/ubuntu/dists/jammy/main/binary-arm64/Packages).

Convention

Terminal commands are prefixed with either $ or #. The former means that the command is executed in the host system (your computer). The latter means that the command is executed in the Docker container.

This should be executed inside the Docker container:

# lsusb

This should be executed in the host system:

$ lsusb

If nothing is prefixed, this indicates output from the previous command.

Previous Next