Getting started with the Lighthouse system

Introduction

The Lighthouse positioning system uses the SteamVR Base stations of Valve Inc. and the Lighthouse deck on the Crazyflie. With this system, the Crazyflie can estimate its own X, Y and Z in a global coordinate system.

This tutorial is also available as a video.

Two base station, one crazyflie

Prerequisites - hardware

Make sure that you have the following available:

Prerequisites - software

Preparing the Crazyflie

The first thing to do is to make sure the firmware in the Crazyflie and Lighthouse deck is up to date.

Mount the Lighthouse deck

For mounting the Lighthouse positioning deck  on a Crazyflie check out the Getting started with expansion decks tutorial.

Update firmware in the Crazyflie and Lighthouse deck

Note1: The firmware of the Lighthouse deck is updated together with the Crazyflie firmware when flashed from the client, the deck must be mounted when flashing.

Note2: The flashing procedure in the client has changed lately, if you are used to the old procedure please check out the documentation.

Please follow the the firmware upgrade instructions.

Preparing the base stations

Before setting up the system you need to configure the channel (aka mode) of the base stations. The procedure is different between V1 and V2 base stations.

Make sure you have permission to write to serial ports

In Linux, for non-root users, there is no read/write permission for serial devices by default. So if you are on a Linux system you will have to make sure that your user has the correct access rights. This can be done by adding your user to the dialout group and restarting. Adding a user to a group in Linux is done using the usermod command, which require root permissions:

$ sudo usermod -aG dialout [username]

Replace [username] above with your own username and after running the command restart your computer and you will then have the correct access to write to serial ports on Linux.

Open the Crazyflie Client and click the Lighthouse Tab

Choose the Lighthouse Positioning tab.

You may have to check it in the menu View->Tabs->Lighthouse Positioning Tab to make it visible.

open the Crazyflie client

Configure the base stations channel (mode)

V2 base stations are configured from the Crazyflie client and the channel of the two base stations must be set to 1 and 2.

connect to base station
  1. Power one of the Base stations with its powerblock and connect it with a micro-usb cable to the computer.

  2. Open up the base station configuration tool in the Crazyflie client by clicking the Set BS Channel button.

  3. Scan for the base station and check the current channel. If the base station is never used, this value is probably 0.

  4. Put the wanted channel (1 to 4) in Change Channel and click the Set Channel button. Each basestation should have a unique ID.

  5. Wait until you see the ‘success!’ message before disconnecting and repeating the steps for the other base station.

open the base station config dialog

On V1 base stations you change the mode with the small button on the back of the base station. The modes should be changed to ‘A’ and ‘b’ if you are using a sync cable and ‘b’ and ‘c’ without a sync cable.

Set up the base stations in the flight area

After the base station’s channels are correctly set, you can mount them in your flight area by a wall mount or a camera-stand. The maximum flight area for two base stations is about 4 x 4 x 2.0, but long as the Crazyflie is not further away than 6 meters from at least one base station, it should work out. Note that the lighthouse sensors are mounted on the top of the Lighthouse positioning deck  and that the base stations must be above the Crazyflie to be received.

Make sure that you have the following conditions in your flight area:

  • The base stations should be about at least 40 centimeters higher than the flight area of the Crazyflie due to the placement of the sensors on the Lighthouse positioning deck .
  • Make sure that there are no mirrors or big large reflective items in the area.
  • Make sure that you do not have direct sunlight.
maximum flying height

Preparing the System

This will explain how to get calibration and geometry data and setup up your Crazyflie to fly in the Lighthouse positioning system.

Indicate the origin of your coordinate system

Place the Crazyflie with the Lighthouse positioning deck  on the ground of where you want the origin to be of your global coordinate system. Check out The Coordinate System of the Crazyflie 2.X.

Connect to the Crazyflie with the Client

Open the CF client and connect to the Crazyflie 2.X.

If not already done, configure the Crazyflie 2.X in 2Mbit radio mode.

open the crazyflie client

Select system type

The Crazyflie needs to know what type of base stations that are used to be able to decode the light sweeps correctly.

Click the Change system type button and select the appropriate type for your system. The system type is stored in the Crazyflie and will be used the next time the Crazyflie is started.

Wait for calibration of the base stations

Make sure that the Crazyflie is receiving the sweep angels of both base stations and has received the calibration data.

For the calibration data you might need to wait for 20 seconds.

base station status

Estimate the geometry

Once you have received the calibration data, it is time to estimate where the base stations a located

  1. Open up the base station geometry management dialog by pressing ‘Manage Geometry’

  2. In the dialog, press ‘Estimate Geometry’ (not ‘Manage geometry simple’). Please follow the wizard’s instructions for estimating the geometry.

  3. If the geometry makes sense, press ‘Write to Crazyflie’, or else move your Crazyflie and press ‘Estimate Geometry’ again.

base station status

Here is also a video going through the geometry estimation procedure in case you got lost or didn’t get a good result:

Check the positioning

The Lighthouse deck’s LED should now be full green and you should be able to see the visualizations of the base stations with their channels and the Crazyflie itself as a blue dot.

Sanity check the position estimation by moving the Crazyflie around in your hand.

base station status

Test flight

Now that the system is set up, let’s do a short test flight!

Switch to the Flight control tab

Click the Flight control tab in the Crazyflie client

Find the controls

In the bottom right corner you will find buttons for simple command based flight.

Command based flight controls

Take off and fly

Click the Take off button to start flying and use the other controls to move around.

Next