Skip to content

2. Preparation

Andrian Huang edited this page Sep 16, 2021 · 1 revision

Here are the steps to perform to prepare for flying the ESP-drone using this stack:

  1. Preparing the room (environment) the drones will fly in
  2. Creating an ArUco map file
  3. Calibrating the drones' cameras

Note for DIP students: steps 1 and 2 might have already been done for you. Please consult to us to verify this.

Preparing the Room (Environment)

Enough number of ArUco markers need to be pasted evenly across the room/environment the drones will fly in (remember that pose estimation only works if at least 2 ArUco markers are visible by the drone's camera). This step creates an ArUco map, where multiple markers form a unique reference system.

Example (obtained from here):
aruco_map_example

There are several dictionaries (variants) of ArUco markers available. We recommend using the ARUCO_MIP_36h12 library available for download here.

If you would like to combine 2 sheets of paper into a bigger ArUco marker, we have provided 20 split ARUCO_MIP_36h12 markers here. You can print these in A4 and combine them into (almost) A3 size.

Important notes!

  • Each ArUco marker has its own numerical ID, 0 to 249 in the case of ARUCO_MIP_36h12. Make sure to keep track of which marker has which ID when you print them. Each marker has its ID faintly written on the bottom left corner.
  • Do not use multiple markers with the same ID for the same room/environment.
  • All markers must be of the same size.
  • Try to paste all the markers upright.

Creating an ArUco Map File

An ArUco map file is required to be able to estimate the drones' pose. This file describes the ID and position of every ArUco marker in the environment we have prepared in the previous step.

To create the map file, we use a marker mapper program, which takes in pictures or video capturing the ArUco markers in the room and outputs a file describing the map. We do not have to use the drone's camera for creating the map file.

We recommend using the ArUco MarkerMapper app (only available for Android) as the phone has built-in camera and the app is quite easy to use. Alternatively, the program is also available for Linux and Windows here. Refer to the official webpage for guide on how to use the Linux/Windows program.

The app/program will output a YML file as the map. Copy this file to espdrone-aruco-ros/espdrone_aruco_bringup/config/environment/aruco_maps.

Calibrating the Drone's Camera

Since we rely on vision markers for localization, it is important to calibrate the camera of the drone (especially for wide-angle lenses). Perform the following steps for each drone (camera). You only need to do this once for each drone, unless the camera was replaced.

  1. Prepare a camera calibration checkerboard, such as this one (make sure to print it on an A4 paper with 100% scale, no zooming for this PDF). Then, turn on the ESP-drone and make sure that the drone and your computer are connected to the same Wifi network.
  2. Launch the following launch file for camera calibration, specifying the IP address of the drone and the checkerboard size and square size (in meters). For example:
    roslaunch espdrone_aruco_bringup espdrone_cam_calib.launch drone_ip_addr:=192.168.0.112 checkerboard:=7x9 square_size:=0.02
    A calibration window showing the camera feed from the drone should then appear. A warning on the terminal saying "Camera calibration file not specified" is normal.
  3. Try to get all bars on the calibration window to show green and be long enough, then click "Calibrate". The calculation can take some time. It is okay to switch the drone off.
  4. After the calibration is complete, click "Save" on the calibration window. The full path to the saved calibration data is /tmp/calibrationdata.tar.gz. After the terminal reports that the calibration data has been saved, you may shut down the ROS (Ctrl + C on the terminal).
  5. Unzip the saved file, then copy and rename the calibration file to the espdrone_aruco_bringup folder. Replace <new_file_name> below with a sensible name, so you can identify which drone the camera is attached to.
    # Unzip the calibration data...
    cd /tmp
    tar -xvf calibrationdata.tar.gz
    
    # Copy the file to 'espdrone_aruco_bringup' and rename it...
    cd /catkin_ws/src/espdrone-aruco-ros/espdrone_aruco_bringup/config/espdrone/camera_calib/
    cp /tmp/ost.yaml ./<new_file_name>.yaml

Clone this wiki locally