How does DWM1000 calculate tag location

Hello guys

I wonder know that how does DWM1000 calculate tag location(x,y value)?
I find these code but it doesn’t make any sense to explain the principle

DWM1000 does not calculate “tag location”. DWM1000 is a module which has DW1000 radio. The DW1000 radio can timestamp TX and RX events.

SW/Application controlling the radio, may be bale to workout the range (time-of-flight) between two devices based on their TX/RX timestamps and turnaround times - depending what the application is designed to do.

SW/Application may then use the ranges between number of fixed (in space) devices to work out the location of e.g. a moving device.

Your question does not make sense.

The actual tag location calculation would take place in the GetLocation() function that is called at the end of the code you posted.

If you know the location of 3 anchors and the ranges to those anchors it is simply a mathematical exercise to calculate your location using trilatoration.

If you have 4 ranges then you have a few options: 4 different locations using the 4 possible sets of 3 ranges and take the mean/median one. Pick the 3 anchors with the best geometric diversity (which will in theory give the best result) or use a method like least squares which allows you to find a solution using all the data that minimizes the errors.

Thank you for reply. Maybe i didn’t describe the question clearly. My question is that when we get several distance between tag and different anchors, how does the code calculate the coordination of tag location using GetLocation() function

many thanks for reply. i wonder know more about how does GetLocation() function work, could you tell me more details about it? like how does the code calculate the coordination of tag location

I’m not sure exactly how the decawave implementation does it, I don’t use theirs. I over determine location using up to 8 anchors and ranges and throw all the results into a least squares optimization algorithm to solve for location using an open source library for the actual calculations.
But google trilatoration and you’ll find lots of examples on how to do this, it’s a standard mathematical problem.


The way TREK calculates location is described in the TREK DecarangeRTLS source code guide, which is available when one downloads the TREK package from our website.

Also note that TREK protocol is limited in what it does and it cannot be changed easily. E.g. tags range to 4 anchors, this is fixed. All anchor addresses are fixed and so adding more nodes needs a good bit of redesign. And I think this is what Andy has done as he has 8 anchors up and running.

And as Andy states there are various trilateration examples on the website, like,, and search google for more