User Tools

Site Tools


This is an old revision of the document!

TDoA 3 set up

NOTE The TDoA3 mode is experimental. The protocol and implementation might change but is fairly stable.

Compile and flash

To try it out you will have to do the following:

The Crazyflie

  • Get the latest source code for the firmware from Make sure the git submodules are updated
  • Compile for TDoA3 and force the TDoA mode with make “EXTRA_CFLAGS=-DLPS_TDOA_USE_V3 -DLPS_TDOA_ENABLE”
  • Flash the Crazyflie with make cload script.

The LPS Nodes

  • Get the latests source code for the firmware from Make sure the git submodules are updated
  • Compile
  • Flash the nodes using make dfu
  • Configure the Nodes as anchors, and set the mode to TDoA 3
  • Anchor positions can be set using the python client (0 - 7) but if you have more anchors you will have toools/lpp/

Setting anchor positions

Anchor positions can be set by the python client but it only supports ids 0-7. If you want to use more anchors there is a tool that can be used.

The tool uses a Crazyflie as a bridge to transmit UWB messages to the anchors. When it is started it transmits positions for all anchors over and over,

The tool is somewhat hackish and could use some updates, for instance the Crazyflie radio address is hardcoded in the script. Be prepared to modify the script…

  • Create a file with your anchor positions, see tools/lpp/positions_example.yaml
  • Start the Crazyflie
  • Pipe the position file into the tool cat my_position_file.yaml | python3 tools/lpp/
  • Move the Crazyflie close to all anchors to transfer the positions


If an anchor is configured to act as a sniffer, it can be used to listen to the UWB messages in the system. To set an anchor to sniffer mode, connect via USB.

Basic sniffing

Connect the sniffer via USB and check in /dev which port that it uses. Use this as the first argument The second argument is the output format, use yaml example: python3 tools/sniffer/ /dev/tty.usbmodem1421 yaml

TDoA 3 parsing

Pipe the yaml into the TDoA 3 decoder to see TDoA 3 data unpacked

example: python3 tools/sniffer/ /dev/tty.usbmodem1421 yaml | python3 tools/sniffer/

This will show all data that the sniffer receives. To limit the output it is possible to filter which anchors to show. Add one or more ids at the end to only show data from only these anchors.

example: python3 tools/sniffer/ /dev/tty.usbmodem1421 yaml | python3 tools/sniffer/ 2 3

Time of flight and anchor to anchor distance

By piping the TDoA 3 data into the TOF tool, the measured anchor to anchor distances will be displayed. By adding the 'm' argument the output will be in meters instead of UWB clock ticks.

example: python3 tools/sniffer/ /dev/tty.usbmodem1421 yaml | python3 tools/sniffer/ | python3 tools/sniffer/ m

2D positioning

TDoA 3 supports 2D positioning as well. In this mode all anchors can be placed in the same plane. The tag (LPS deck) is expected to move in the XY-plane at a fixed Z.

Recompile the Crazyflie firmware using the LPS_2D_POSITION_HEIGHT compile flag set to the desired Z. For instance make “EXTRA_CFLAGS=-DLPS_TDOA_USE_V3 -DLPS_TDOA_ENABLE -DLPS_2D_POSITION_HEIGHT=1.2” if the tag will be located at 1.2 meters height.

Longer range and lower bitrate

In this mode the UWB bitrate is lower and the data of messages can be read at a longer distance. The packet rate will be reduced though.

Recompile both Crazyflie and anchors with the LPS_LONGER_RANGE compile flag.


Longer preamble

It is possible to use a longer preamble, this will also reduce packet rate. There is no compile flag for this setting, it requires some code modifications in the Crazyflie and the anchors. The preamble is used by the anchor radios to detect messages and a longer preamble increase the probability and thus the useful distance. Note that the radios might detect the preamble but fail at reading the data of the packet (see lower bitrate above). The “SFD” LED on the anchor indicates if a preamble has been detected by the radio.

The Crazyflie

  • Find the src/deck/drivers/src/locodeck.c file
  • Locate the call to dwEnableMode()
  • Change the second argument to MODE_LONGDATA_MID_ACCURACY
  • Compile and flash

The LPS Nodes

  • Find the src/uwb.c file
  • Locate the call to dwEnableMode()
  • Change the second argument to MODE_LONGDATA_MID_ACCURACY
  • Find the src/uwb_tdoa_anchor3.c file
  • Locate the line where PREAMBLE_LENGTH_S is defined
  • Change it to 1024 bits: #define PREAMBLE_LENGTH_S ( 1024 * 1017.63e-9 )
  • Compile and flash
doc/lps/toda3.1529045626.txt.gz · Last modified: 2018-06-15 08:53 by kristoffer