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.
Prerequisites - hardware
Make sure that you have the following available:
Prerequisites - software
- The latest version of the Crazyflie client
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
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]
[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.
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.
Power one of the Base stations with its powerblock and connect it with a micro-usb cable to the computer.
Open up the base station configuration tool in the Crazyflie client by clicking the Set BS Channel button.
Scan for the base station and check the current channel. If the base station is never used, this value is probably 0.
Put the wanted channel (1 to 4) in Change Channel and click the Set Channel button. Each basestation should have a unique ID.
Wait until you see the ‘success!’ message before disconnecting and repeating the steps for the other base station.
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.
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
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.
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.
Estimate the geometry
Once you have received the calibration data, it is time to estimate where the base stations a located
Open up the base station geometry management dialog by pressing ‘Manage Geometry’
In the dialog, press ‘Estimate Geometry’ (not ‘Manage geometry simple’). Please follow the wizard’s instructions for estimating the geometry.
If the geometry makes sense, press ‘Write to Crazyflie’, or else move your Crazyflie and press ‘Estimate Geometry’ again.
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.
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.
Take off and fly
Click the Take off button to start flying and use the other controls to move around.
- With the base stations V2.0, it is possible to fly more than 4 base stations however changes to the Crazyflie’s firmware would need to be made. Please go to the instructions to configure the firmware to accept more than 4 Lighthouse base stations.
- Check out the cfclient lighthouse tab user guide for more explanation of each of the buttons.
- The system theory documentation presents the indepth theory of the lighthouse positioning system and more advanced guides