DWM1000 DS-TWR method calculate distance method?

Firmware/software/electronics/mechanics
Post Reply
justinleeyang
Expert
Posts: 186
Joined: Mon Dec 28, 2015 5:07 am

DWM1000 DS-TWR method calculate distance method?

Post by justinleeyang »

Hi,

Reference your github lps-node-firmware, print the distance value is negative number, for example, -105mm,-136mm. we see that you measure the distance with the DS-TWR method follow as:
Tag send poll -> Anchor receive poll, then answer -> Tag reveive answer, then send final -> Anchor reveive final, then send report(include pressure and anchor timestamp information) -> Tag receive report, then calculate the distance.
I see the algorithm:

Code: Select all

tprop_ctn = ((tround1*tround2) - (treply1*treply2)) / (tround1 + tround2 + treply1 + treply2);
two issue:
(1)I don't konw how to get the formula.
(2)From the dw1000-user-manual, we find the formula,
wwww.png
But we should more easily understand the 12.3.3 Using symmetric reply times formula:
vvvv.png
vvvv.png (4.91 KiB) Viewed 8627 times
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: DWM1000 DS-TWR method calculate distance method?

Post by arnaud »

Hi,

(1): The formula in the code is from the decawave documentation you are copying. We did not re-prove it but it works :-).

(2): The second formula, as you noted, is using symmetric reply time. This is accurate only if the reply time is the same in the tag and the anchor. This adds a hard requirement and if this requirement is not fulfilled (ie. if the reply times are not equal) the accuracy will suffer. The first formula, that we are using, is more accurate and only assumes that the clock drift between anchor and node is contant for the ranging time.

I guess your main concern is the negative readings. This is most likely coming from the antenna delay compensation: https://github.com/bitcraze/lps-node-fi ... #L108-L109. The speed of the radio signal in the antenna is slower than the speed of light and so it has to be compensated for. If you are seing negative measurement it means that I have over-estimated this correction.
justinleeyang
Expert
Posts: 186
Joined: Mon Dec 28, 2015 5:07 am

Re: DWM1000 DS-TWR method calculate distance method?

Post by justinleeyang »

Hi,arnaud:

Thank you for your reply!

another question, I find every dwm1000 module maybe the antenna delay is different. if we set the same delay, the measure error will more high.
can we dynamicly correct the every module?
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: DWM1000 DS-TWR method calculate distance method?

Post by arnaud »

Hi,

The decawave documentation suggest that measuring and correcting the delay for each board individually will give better result yes. Though I did not test and I am not sure of the effect on the position estimate (by having redundancy on the measurement and anchor placed around the tag we should make it for some of the error).

I have eared of the idea of running a Kallman filter to estimate the delays in real time. If possible it would be a very nice solution to get this extra accuracy without having to calibrate every anchors.

By the way, Kristoffer here at the office really wanted to prove the decawave formula and so he did. If you assume that the clock of one of the node is off by alpha and the other by beta, the key was to find the time of flight in a "virtual" clock that would be the mean value between alpha and beta, here is it:
ranging_formula.jpg
So for example if both clock are off by 10ppm, the measurement will be off up to 10ppm independent of the time it took to make the measurement. a couple of 10s of ppm is very good when it comes to distance measurement :-) (off course there is other factor but at least we get rid of the clock drift difference between nodes which was a major error source with the other formula).
justinleeyang
Expert
Posts: 186
Joined: Mon Dec 28, 2015 5:07 am

Re: DWM1000 DS-TWR method calculate distance method?

Post by justinleeyang »

Hi,

Wow, Thanks! I appreciate it!
But why Alpha plus Beta = 2 ?
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: DWM1000 DS-TWR method calculate distance method?

Post by arnaud »

But why Alpha plus Beta = 2 ?
This was the trick to get the same formula as decawave :).

We take alpha and beta the factor by which each node clock is drifting. Then we define 1, a perfect clock factor, as being the mean value of alpha and beta (third equation of the system). This leads to alpha+beta=2.
Post Reply