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.
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 the Crazyflie 2.X.
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.
Before setting up the system you need to update the firmware and configure the the nodes.
For the latest LPS node firmware go here and download the “lps-node-firmware.dfu” file.
- 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.
- Click browse and choose the LPS node firmware
- Now update the node.
- When the update is done press reset.
Disconnect the node from the USB and repeat the same procedure for all the nodes before configuring them.
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.
- Connect the first anchor to USB (without pressing any button)
- Select an appropriate ID
- Choose the “Anchor (TWR)” mode
- Click Apply to write the settings to the anchor
- Repeat the procedure for all anchors
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.
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.
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.
The anchor can be powered in three different ways.
- 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.
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.
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.X in the center of the flying area.
- Open the CF client and connect to the Crazyflie 2.X
- If not already done, configure the Crazyflie 2.X in 2Mbit radio mode. This reduces interference with the UWB radio. If the configuration is changed a restart of the Crazyflie 2.X is required.
Choose the LPS tab.
You may have to check it in the menu View->Tabs->Loco Positioning Tab to make it visible.
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.X 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.
To start configuring the anchor position you need to click on the “Configure positions” button.
A pop-up window will appear. Click the button “Get from anchors” to get the list of anchors and fill up the positions with the values currently stored in the anchors.
Enter the positions (coordinates) of the anchors in your system. Note: measurements in meters.
When you enter a new value, the box turns red to indicate that it differs from the current value stored in the anchor.
- 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, which indiates that the new position has been written to the anchor and red back to the client. The read back process may take up to 5 seconds, please be patient. If no change has occurred after 5 to 10 seconds, the write did probably not work for all anchors, try to write again by clicking the “Write to anchors” button.
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
- 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
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.
In the crazyflie status section tick the TWR radio button.
This will enable the “TDoA2” button in the anchor status section.
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.X is no longer receiving TWR data from the anchors.
For details on system mode switching and troubleshooting, please see the wiki
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.
If not all anchor boxes go green, please see the wiki for touble shooting.