Getting started with the Loco Positioning system

Introduction

The loco positioning system can be configured in two modes; Two Way Ranging (TWR) mode and in Time Difference of Arrival (TDoA) mode. The set up procedure is more straightforward in TWR mode and we recommend to use this mode also if you intend to use the system in TDoA mode as the switch to TDoA is easy to do after the setup. This guide describes the procedure using the TWR mode and at the end how to switch to TDoA mode.

In order to illustrate anchor placements we have documented two reference systems, one with 6 anchors and one with 8. The 6 anchor setup is mainly intended for TWR use while we recommend 8 anchors for the TDoA mode.

Update the Crazyflie to the latest loco positioning firmware

To be able to use the Loco positioning system you need to update the Crazyflie to the latest firmware. For more information on how to update the firmware, see the download latest firmware section in our Getting started with Crazyflie 2.0 tutorial.

You will also need the latest version of the Crazyflie client.

For mounting the Loco positioning deck check out the Getting started with expansion decks tutorial.

Preparing the anchors

Before setting up the system you need to update the firmware and configure the the nodes.

Download the LPS configuration tool

Download and run the LPS configuration tool .exe installer to install the LPS tools.

Clone the LPS configuration tool GIT repo and follow the readme instruction to run the tool.

Download the LPS node firmware

For the latest LPS node firmware go here and download the “lps-node-firmware.dfu” file.

Update the nodes

  • To update the node start by opening up the LPS configuration tool. Keep the DFU button on the node pressed while connecting to your computer via USB. This will start the node in DFU mode.
  • If you are using Windows, the node will not be recognized the first time. You need to follow the instruction to install its USB driver using Zadig. In DFU mode, the node will be displayed as “STM32 BOOTLOADER” in Zadig.
LPS configuration tool
  • Click browse and choose the LPS node firmware
LPS configuration tool
  • Now update the node.
LPS configuration tool
  • When the update is done press reset.
LPS configuration tool

Disconnect the node from the USB and repeat the same procedure for all the nodes before configuring them.

Configuring the nodes into anchors

Now it’s time to set the mode for the nodes turning them into anchors, and setting the individual ids for each anchor. The anchors should be numbered from 0 and upwards.

Tip: to make it easy to identify the anchors and to manage the system in the future, it might be a good idea to mark the anchors with their ids.

LPS configuration tool
  1. Connect the first anchor to USB (without pressing any button)
  2. Select an appropriate ID
  3. Choose the “Anchor (TWR)” mode
  4. Click Apply to write the settings to the anchor
  5. Repeat the procedure for all anchors

Place the anchors in the room

Anchor positions

To get a good result there are some rules of thumb for the placement of the anchors:

  • The anchors should be evenly distributed around the flying volume and at least 2m apart.
  • The anchors should have line of site with the flying volume.
  • The anchor antenna should be placed 15cm from any wall, ceiling or metal object to avoid interfering reflections. In our reference set-up we accomplish this by using these 3D printed stands. In the repository click “Raw” and then choose “save as” and save the file as a stl file.

In our 6 anchor reference setup we have placed 3 anchors above and 3 anchors below the flight area, shaped in inverse triangles.

reference system

In our 8 anchor reference setup we have placed the nodes in the corners of a box as the position estimation for TDoA works best within the convex hull. Note the order of the IDs.

reference system

If you have more than 8 anchors, we suggest you setup a system with 8 anchors first and then switch your system to TDoA3 to add more anchors to the system. See the tdoa3 setup page on the wiki for more information.

Powering the anchors

The anchor can be powered in three different ways.

Powering the anchors
  • Micro USB. Good for fixed and portable setups were a external battery or power adapter is used.
  • Barrel jack. Good for fixed and portable setup were power adapter is used.
  • Screw terminal. Good for fixed installation and for chaining. Cable size up to 0,5mm2.

They can be connected at the same time so the anchor can still be power from the screw terminal when connecting the micro USB cable to do an update or when changing the configuration. All power options can handle 5-12V and the supply should be able to provide at least 150mA of current.

Configure and verify the system

The following section will show a 8 anchor system but the procedure is very similar for a 6 anchor setup were anchor 6 & 7 will be grayed out.

Open the Crazyflie client

Now when everything is mounted and powered it is time to configure the system, this is done from the Crazyflie client. Communication between the client and the anchors is relayed through the Crazyflie and the LPS deck.

  • Place your Crazyflie 2.0 in the center of the flying area.
  • Open the CF client and connect to the Crazyflie 2.0
  • If not already done, configure the Crazyflie 2.0 in 2Mbit radio mode. This reduces interference with the UWB radio. If the configuration is changed a restart of the Crazyflie 2.0 is required.
open the crazyflie client

Click the LPS tab

Choose the LPS tab.

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

click the lps tab

Check anchor status

In the Anchor ranging status box, check that there are as many green boxes as there are anchors.

A red box indicates that the Crazyflie 2.0 can not communicate with that anchor and does not get any ranging data. If this is the case, verify the anchor is configured correctly, powered and in line of sight.

check the anchor status

Enter anchor positions

To start configuring the anchor position you need to click on the “Configure positions” button.

click configure positions

A pop-up window will appear. Click the button “Get from anchors” to get the list of anchors and fill up the positions.

click get from anchors
enter anchor positions

Write position to anchors

  • To save the new anchor positions in the anchors press the “Write to anchors” button
  • Verify that the anchor position boxes changes from red to green. If no change has occurred within 5 seconds try to write again
write position to anchors

Verify anchor positions

Verifying the anchor positions is good to rule out problems with the positioning later.

  • Switch the Graph Settings mode to “Anchor identification”
  • Move the Crazyflie close to one anchor
  • Verify that the correct anchor is indicated in the graph
  • Repeat the procedure for all anchors and correct any wrongly configured anchor addresses
Verify anchors position

Verify estimated position

  • Switch the Graph Settings mode back to “Position estimate”
  • Move the CF around and verify that the movement in the graphs correspond to the physical movement
Verify estimated position

Calibration finished

Congratulations, the Loco Positioning System is now calibrated!

Switching system mode to TDoA

If you intend to use the system in TDoA mode to fly more than one Crazyflie it is now time to change the system mode. There exist two version of the TDoA ranging protocol.

  • TDoA 2 works with 8 anchors.
  • TDoA 3 does not have any limitation in the number of anchors and so it can be used for bigger system, thought it will be more noisy for a system of 8 anchors.

Force the Crazyflie to use TWR mode

In the crazyflie status section tick the TWR radio button.

This will enable the “TDoA2” button in the anchor status section.

Force TWR mode

Switch anchors to TDoA mode

Press the “TDoA 2” button to switch the anchors to TDoA mode.

After a few seconds all anchor status boxes should turn red to indicate that the Crazyflie 2.0 is no longer receiving TWR data from the anchors.

Switch anchors to TDoA mode

For details on system mode switching and troubleshooting, please see the wiki

Switch the Crazyflie back to auto mode

As a last step, confirm the TDoA mode by ticking the Auto radio button in the Crazyflie status section and verify that the TDoA2 box turns green.

The anchor boxes should also turn green when the Crazyflie switches to TDoA mode and starts to receive data from the anchors.

Switch to auto mode

Next step

Now when you got the basic functionality of the system up and running you might want to try to fly using Loco Positioning.

To read the more techy documentation go to the Loco positioning wiki page.