tdoa data of Crazyflie

Discussions about quadcopters/multi-rotors
Post Reply
Posts: 3
Joined: Wed Aug 15, 2018 4:48 pm

tdoa data of Crazyflie

Post by dyang » Fri Nov 02, 2018 6:26 pm

I want to fetch the distance of crazyflie to each loco anchor. Under the log configures, I saw there is an tdoa set and under tdoa there are some data like d0-1,d1-2, I was wondering what that data stands for.
QQ截图20181102132521.png (6.21 KiB) Viewed 693 times

Posts: 87
Joined: Tue Jun 30, 2015 7:47 am

Re: tdoa data of Crazyflie

Post by kristoffer » Fri Nov 09, 2018 10:10 am

The TDoA log data is a bit messy, sorry about that. It is unfortunately not possible to get a measurement of the distance from the CF to an anchor in TDoA, what you can get is the difference in distance to two anchors (see
You can calculate the estimated distance by using the estimated postiion (in log vars stateEstimate.x, y and z) and the known anchor position.

It is probably a good idea to describe the tdoa logging data anyway.
There are two sets of logging data, one for TDoA2 and one for TDoA3. I will try to outline the behaviour but the best source for details is the source code :-)

Source code: ... Tag.c#L502

The log data available:
  • tdoa.d0-1: The difference in distance to anchor 0 VS anchor 1, in meters. A positive value means that you are closer to A0 than A1
  • tdoa.d1-2: For A1 VS A2 and so on
  • tdoa.cc0: Clock correction of A0 VS clock in the CF
  • tdoa.cc1: Clock correction for A1 and so on
  • tdoa.dist0-1: The Time Of Flight between anchor 0 and 1, measured by A1.
  • tdoa.dist1-2: The Time Of Flight between anchor 1 and 2, measured by A2 and so on
The value is in ticks of the clock in the anchor. To convert it to distance (meters), multiply by the speed of light and divide by the clock freq. dist = tof * 299792458 / (499.2e6 * 128)
For example: in our office system the TOF between A0 and A1 is around 33840 ticks, which translates to 158.77 meters.
TOF is the time from transmission to reception and it includes the time it takes to propagate through antennas and other delays. The sum of these delays is 154.6 meters why the actual distance between A0 and A1 is 158.77 - 154.6 = 4.17 m

Since TDoA2 is time slotted and anchors are transmitting in sequence, the data we get in the system is always (except when loosing packets) between A0 to A1, A1 to A2 and so on, hence the logging variables.

Source code: ... Tag.c#L334

The same data is available for TDoA3 but since we do not know anything about the order we receive packets or which anchors that are available, the system has been generalized.

There are two parameters that are used to tell the CF which anchors to log data for.
  • tdoa3.logId: the id of the primary anchor
  • tdoa3.logOthrId: the id of the secondary anchor
The log data available:
  • tdoa3.tdoa: The difference in distance to the primary and secondary anchors
  • the clock correction for the primary anchor
  • tdoa3.tof: the TOF between the primary and secondary anchors
This makes it possible to get the TOF between anchor 17 and 92 for instance

Post Reply