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.
Make sure that you have the following available:
- The latest version of the Crazyflie client
The first thing to do is to make sure the firmware in the Crazyflie and Lighthouse deck is up to date.
For mounting the Lighthouse deck on a Crazyflie check out the Getting started with expansion decks tutorial.
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.
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.
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.
Choose the Lighthouse Positioning tab.
You may have to check it in the menu View->Tabs->Lighthouse Positioning Tab to make it visible.
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 or 2) in Change Channel and click the Set Channel button.
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.
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 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 0.5 meters higher than the flight area of the Crazyflie due to the placement of the sensors on the Lighthouse 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.
This will explain how to get calibration and geometry data and setup up your Crazyflie to fly in the Lighthouse positioning system.
Place the Crazyflie with the Lighthouse 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.
Open the CF client and connect to the Crazyflie 2.X.
If not already done, configure the Crazyflie 2.X in 2Mbit radio mode.
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.
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.
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’. You will see then the estimated geometry of the base stations.
If the geometry makes sense, press ‘Write to Crazyflie’, or else move your Crazyflie and press ‘Estimate Geometry’ again.
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.
Click the Take off button to start flying and use the other controls to move around.