UWB RealTime Location Engine Source Code - Price: $15,000 USD

The location engine is a server-side program written in C++17. It can be run directly as a command line program or installed as a Windows service.

After a few modifications, it should be able to run on Linux. From the beginning of the design, we considered writing it to run across platforms. When the basic functions were first completed, we compiled a Linux version and ran it on Ubuntu. Later, as functions increased, almost no users had the need to run Linux, so the Linux version was no longer maintained.

The data processing of the location engine is roughly divided into three parts: receiving location data packets, coordinate calculation, and application program interface.

Receive location data packet

Use UDP to realize automatic discovery of the location engine. The anchor in the LAN will automatically establish a TCP connection with the location engine. The anchor will send the UWB location data packet sent by the received tag to the location engine. After the location engine receives the location data packet, it will put it into the message queue of the corresponding area. The location engine maintains a message queue matrix for each location area.

Coordinate calculation

Get the data packet from the message queue to calculate the coordinates. For multiple regions, the quality of the coordinate values ​​in different regions is evaluated, and the one with better quality is selected for output.

There are at least two algorithms for coordinate calculation. At the beginning of the project, we wrote an algorithm based on the algorithm described in a paper by a professor, but later found that the calculation result error was relatively large; later we studied two algorithms on our own: bisection method/least squares. Our final version uses the least squares method to calculate coordinates.


Provides various application program interfaces. There are binary packets/text/json/serial ports and so on.

Some concepts are also used in the location engine: location area/location anchor/tag, etc., and corresponding classes are established.

The location engine uses sqlite3 to save configuration. 

In addition, we have been careful about memory leaks from the beginning of the design. As a server-side program, our goal is to have as little downtime as possible, so it's important to make sure there are no memory leaks. On the one hand, we try to avoid it as much as possible in design, on the other hand, we use some methods to detect memory usage. As far as I know, no memory leaks have been found.

We ensure that you can compile this program normally using Visual Studio 2019 or Visual Studio 2022.



The articles on this site are all original and the copyright belongs to Zhang Xiaolong.

Anyone can reprint, but the source and author information must be indicated.