## Wrong tof in TDOA2

All discussions related to the Loco Positioning system
seventeenz
Beginner
Posts: 1
Joined: Mon Feb 05, 2018 10:46 am

### Wrong tof in TDOA2

Hi everyone,
I was trying to calculate the distance between Anchors in TDOA2. And I printed the "tof_Ar_to_An_in_cl_An" in UART so I got the value of tof as follows:(distance = Tof * C / tsfreq)
Tof (ctn): 33077 distance:155.189477
Tof (ctn): 33077 distance:155.189477
Tof (ctn): 33073 distance:155.170710
Tof (ctn): 33074 distance:155.175402
Tof (ctn): 33068 distance:155.147251
...(The true distance is 88cm)

The distances didn't make sense.But the right TDOA value(DistanceDiff) can be calculated using tof as above.I am wondering how it works and how can I get the right distance in Anchors.

Thanks!

arnaud
Bitcraze
Posts: 1888
Joined: Tue Feb 06, 2007 12:36 pm

### Re: Wrong tof in TDOA2

Hi,

This distance includes the antenna delay, this is why it is so big.

When calculating TDoA with the anchor-to-anchor distance, we are not caring about the distance but what we want is the time it takes for a packet from one anchor to another, and this time is the flight time plus antenna delay. This is why it works fine. The current TDoA implementation assumes the antenna delay is the same for all nodes and tags.

With TWR, the Crazyflie is compensating for antenna delay. It represents about 154 meters: https://github.com/bitcraze/crazyflie-f ... deck.c#L86.

To get the right distance you need to apply an antenna delay compensation (ie. substraction).