A Real-Time UWB Location and Tracking System Based on TWR-TDOA Estimation and a Simplified MPGA Layout Optimization

is article designs and implements a 3D moving target positioning and tracking system by using ultrawideband (UWB) technology. e result of the two-way ranging by the time dierence of arrival (TWR-TDOA) positioning algorithm is adopted to result in a new resolution that is to resolve the hyperbolic equations. e proposed algorithm is applied to outdoor and indoor scenarios. To minimize the eect of the sensor layout, this article proposes a simplied multi-population genetic algorithm (MPGA) to obtain the optimum distribution of anchors, which can rapidly reduce the number of search iterations. To resolve the low stability of the TDOA algorithm in outdoor and indoor scenarios, the Kalman lter algorithm is utilized to improve the stability and positioning accuracy of this system and a good simulation eect is achieved. e test results show that the system’s positioning error is far less than that of using other methods. e whole system has a feature of high precision, high stability, low complexity, and low cost.


Introduction
With the development of communication technology, more and more systems are designed for wireless sensor network node location. e most popular techniques are Bluetooth, ZigBee, radio-frequency identi cation, and an ultra-wideband (UWB) wireless position [1,2]. Among them, UWB technology is a promising ranging method that uses an extremely narrow pulse to transmit data with a wide spectrum range and fast communication speed. A UWB wireless position and tracking communication system has the advantages of low complexity, low power consumption, and high positioning accuracy against multipath interference. It can be applied in tunnel vehicle positioning, underground personnel positioning, and indoor positioning. It also has the potential to provide the position and tracking of lunar/Mars rovers and astronauts, where satellite navigation systems (such as Beidou or GPS) are not available [2].
For the location algorithms, there are traditional methods and hybrid algorithms. Received signal strength (RSS), angle of arrival (AOA), a di erence of arrival (DOA), and time di erence of arrival (TDOA) are four classical methods to realize the location. In recent years, a series of novel hybrid algorithms have been proposed to improve the system precision based on these four basic algorithms with new mathematical models or advanced solutions [3][4][5]. TDOA-UWB technology is widely developed as a hybrid positioning theory, which has superior localization performance compared with other approaches. e accuracy of most traditional TDOA-related algorithms based on the least square theory in a practical test is between 10 and 30 cm [6,7]. Whistle, a novel TDOA localization without time synchronization is proposed by Xu et al. [8], which achieves high accuracy for 2D and 3D cases in acoustic source location framework, but this method has imperfections in energy e ciency and scalability. A UWB localization with a new A-TDOA method is designed in [9], while its precision is not accurate enough and only suitable for 2D cases. ese algorithms have bottlenecks in power consumption, precision, and transmission delay.
Some hybrid approaches were proposed to improve the system properties. In [10], a closed-form hybrid TDOA and AOA measurement with two observation stations in 3D space is proposed, which has high accuracy and low CRB. However, this method is only demonstrated in theoretical analysis without practical tests. A combined TDOA/TOF measurement is proposed by Mazraani et al. [11], which can achieve high accuracy and reduce power consumption, while this technique requires an accurate synchronization between anchors and tags. Based on TDOA equations, the Asymmetry Double-Sided Two-Way Ranging (ADS-TWR) algorithm and Chan-assisted Extended Kalman Filter in a 3D indoor positioning system with five anchors are used in Reference [12], which can achieve fast and high accurate localization.
Recently, deep learning algorithms were widely reported to solve the location problems [13][14][15], such as convolutional neural networks (CNN), K-nearest neighbor (KNN) algorithms, and long short-term memory (LSTM), which bring heavy computational burdens. ese new frameworks further improve the positioning accuracy, in theory, however, due to the algorithms' complexities, the system has high requirements on the hardware platform in an actual scene. e anchor layout is another important factor in the UWB location system. Most of the previous studies are implemented in 2D plane layout positioning. Due to the complexity of indoor and outdoor scenes, 3D positioning is more practical. ere are some studies on the displacement of the number of nodes in 2D/3D scenes, which focus on positioning networks [16,17]; however, to the best of our knowledge, the minimal anchors' layout is less studied. Considering the power consumption and the system cost, the optimum layout for fewer nodes needs to be discussed.
Aiming at high positioning accuracy and favorable stability, this article proposes a new solution based on twoway ranging (TWR) TDOA and a simplified multi-population genetic algorithm (MPGA) to obtain the optimum anchor layout. Effective experiments on indoor and outdoor scenes with specific hardware systems are provided. e followings are the main contributions of this article.
(1) e distance measured by the TWR algorithm is used to calculate the distance difference between the target and the two base stations, then the hyperbolic equation is established by using the distance differences. We proposed a new method for solving TDOA equations that is easy to implement on our platform.
(2) A 3D UWB position model and platform are built to test the proposed algorithm.
(3) An optimum anchor layout is calculated by a simplified 3D MPGA. (4) Kalman filtering is adopted to solve the instability of the TDOA algorithm in outdoor and indoor scenes.
is article is organized as follows. e proposed 3D UWB model and TWR-TDOA algorithm are given in Section 2; Section 3 analyzes the existing error in the model, proposes the simplified MPGA layout algorithm, and adopts the Kalman filter to improve location precision; Section 4 outlines the hardware platform and the experimental measurement scenario settings, including the scenario tests. Section 5 gives the results and discussion. Finally, Section 6 summarizes the article and discusses the future directions.

System Model and Theoretical
Location Method e 3D UWB model is sketched in Figure 1. One tag is measured and four UWB anchors are used to reduce the system complexity and system consumption. e advantage of the system model is that the spatial information of the target can be obtained with fewer anchors [12]. To obtain the target location, firstly, the asymmetric double-sided two-way ranging algorithm is used to calculate the distance difference between the target and the two base stations, which has low requirements for system synchronization. Secondly, according to the measurement distance, the TDOA algorithm is adopted, and a new resolution for hyperbolic equations is proposed to obtain high location accuracy.

Double-Sided Two-Way Ranging with ree Messages.
For the hardware platform, the mainstream UWB device is DW1000, which uses two-way ranging without synchronization. e traditional algorithms can be easily transplanted into this platform. According to the user manual of DW1000, the ADS-TWR algorithm with three messages is used to measure the distance. is algorithm simplifies the DS-TWR from four messages to three messages by using the reply of the first roundtrip measurement as the initiator of the second roundtrip measurement [10], which means lower power consumption. e transmission process between the tag and anchors is schematically shown in Figure 2.
As shown in Figure 2, the tag is named Device A and the anchor is named Device B. Suppose the flight of time is T prop . After the sensor receives signals, the delay time is T reply , which is generated by transmission processing and other reasons. e roundtrip communication time between the anchor and tag is totally T round . e full process of these three messages communication is described as follows: (a) device A sends a packet to device B, and the transmission time is T prop ; (b) device B records the time while receiving this packet; (c) device B answers in response to receiving packet after a fixed delay time T reply ; (d) device A records the moment when receiving the message from Device B.
It is easy to calculate the roundtrip time T round : Here, the time of flight (TOF) as ΔToF is given by In asymmetrical double-sided two-way ranging, it is not necessary that the reply time of the two devices be synchronous, which means reducing the clock requirements of the system. Under the same information transmission, ADS-TWR can save message flow, which means saving battery power and space-time.
e clock frequency errors can be controlled at the picosecond level when the quality of the crystal oscillator is not high. e most important error affecting accuracy depends on the following equation: where the actual frequency of device A is k a times the expected frequency, and the actual frequency of device B is k b times the expected frequency. k a and k b are close to 1 in the application. e TWR data are exported for positioning processing. Take the 100 m UWB communication range for an example, the TOF is around 300 ns, whereas the error time is about 6 ps, and the corresponding range error is 2 mm.

TDOA Algorithm.
According to the system model in Figure 1, suppose the coordinate of the target tag is T(x, y, z), the number of UWB anchors is M, where there is one primary sensor S 0 and (M − 1) secondary sensors S i , their coordinates are (x i , y i , z i ), and i � 0, 1, . . . , M − 1. Suppose the time of arrival to each station is t i (i � 0, 1, 2, . . . , M − 1). e time difference between each secondary and primary sensor is written as ΔToF i , (i � 1, 2, . . . , M − 1), which is determined by e distance differences can also be directly written as the Euclidean distance from the target to the secondary station minus the distance from the target to the primary station, which is given by where D i � T − S i2 , i � 1, 2, 3 and r 0 � T − S 02 . en, we have subtracting r 2 0 at both sides, we have where d i � S i2 , i � 1, 2, 3 and d 0 � S 02 . We obtain the following equation: ere are M equations in equation (8), and we rewrite it as a matrix form, where x, y, z are unknown and Let AX � B, then According to the linear properties of linear equations, the solution of AX � B is the summation of r 0 times the solution of AX � C and the solution of AX � D. When M � 3, A is a square matrix, according to the Cramer criterion, the solution is x ij � |A j |/|A|, where A j is the determinant obtained by replacing the j th column element in a constant term. e solution is obtained as follows: where a i is the solution of AX � C, and b i is the solution of AX � D.
In equation (11), r 0 is an unknown parameter. We calculate it from the following method: using the definition of r 0 , we get a bivariate quadratic equation about r 0 , as shown in equation (12): where We can get the roots of this one variable quadratic equation: According to this root, the TDOA algorithm for the 3D situation has three different position results: ambiguity, Mobile Information Systems precision, and loss. We need to handle these three cases differently.
(1) r 0 has two roots (one of which is a false solution).
From the two roots, two location positions can be obtained, which means that location ambiguity needs an increased anchor. In this algorithm, we take the real part of the conjugate complex as the root

Deviation Error Analysis and Improved Algorithms
e core of the TDOA algorithm is associated with the difference between the primary anchor and the secondary anchor. First, the derivation of the difference is expressed as Making use of equation (16), one can get a tag position error vector: Based on this equation, the accuracy of the tag position is correlative with the sensor distribution and the measurement error. In the following part, the accuracy of the TDOA algorithm will be improved in both aspects.

Optimized Distribution Based on a Simplified MPGA.
e different sensor placement strategies influence the geometric dilution of precision (GDOP) of the target positioning. e GDOP can be expressed as [18] GDOP � ������� trace(P), where e variance of the location error is σ 2 s , and the variance of the measurement error is σ 2 ri (i � 1, 2, . . . , M). When the GDOP of the located target is the smallest, the distribution can reach the best condition. is article adopts the MPGA to find the best anchor layout whose GDOP of the space is nearly optimal.
In this part, AVER GDOP is treated as the average GDOP of one plane whose height is h.
e genetic algorithm searches for the best result by producing subsequent generations from a random population with genetic operators. Compared with the genetic algorithm, MPGA uses more populations to produce individual fitness as a multi-population crossover [19]. Whole space-wide searching brings a huge amount of computation, whereas one horizontal plane searching can greatly reduce computing and has similar precision. Data statistics via MATLAB simulation show that the amount of simplified calculation is reduced by 70% compared with the traditional search algorithms. In this part, this simplified MPGA method is adopted to calculate the optimal layout. e detailed process of this simplified MPGA for optimized distribution is shown in Algorithm 1, where X 2×12 represents the range matrix of the given space, h is the height of the measured plane, MAXGEN limits maximum iteration times, and N has the information on the population size. In addition, the probability rate of the crossover is P c and the probability rate of the mutation is P m .
At the beginning of each experiment, the algorithm can be used to ensure the minimum value of the average GDOP in the measured range. In this MPGA algorithm, the population size N is set as 10 and the maximum iteration time MAXGEN is set as 5. e crossover rate P c is one value between 0.7 and 0.9. e mutation probability is a random value between 0.001 and 0.05. Considering the convenience of placement and calculation, the anchors are set on either side of the scene and one anchor is fixed in the condition of the algorithm. e following experiment is designed to test the efficiency of the optimized distribution based on simplified MPGA.  Table 1 gives the GDOP of random positions at the height of 80 cm and compares the results with simplified MPGA and unoptimized distribution separately.

Mobile Information Systems
Here we can see that, if anchors are set at the positions located by the MPGA, the GDOP can be reduced largely.
is means the optimized distribution can decrease the deviation of measured data. us, this proposed MPGA can e ectively decrease the sensor distribution error caused by the system.

Kalman Filter.
e TDOA is unstable in the positioning process, resulting in a measurement error. To resolve this problem, we use the Kalman lter to improve the stability and precision of positioning. Kalman ltering can achieve the best tracking performance when dealing with a target that has a measurement equation and motion equation that are linear and a process noise that obeys Gaussian distribution [20]. When there is no solution in the TDOA algorithm, for the target position and motion state at the previous time, the constant velocity (CV) model is used to ll in the missing position. e CV model is given as e state equation is given by equation (20): X(k) is the state vector, which is an N-dimensional column vector. Here, N 9; F(k) is called the state transition matrix, W(k) is the process noise, and its covariance matrix is Q(k), which is an N × N matrix in this system. Equation

H(k) is the measurement matrix and V(k)
is the measurement noise. e idea of the lling method is to estimate the missing position by using the state transition matrix and measurement matrix, i.e., the last measured value correction process is removed while using the Kalman lter. e initial test state of the system can be obtained by using the two-point di erence method for initialization: e covariance matrix of the initial test state error is as follows: After initialization, the Kalman lter can start working from the time k 2. e standard deviation of the measured range data is calculated by e data is collected from the four base stations, and the moving model is the CV. e TDOA data are further processed by the Kalman lter. Figure 3 shows the estimations of the position of Chan-EKF [12], TWR-TDOA, and TWR-TDOA-KF algorithm when the tag moves with a speed of 0.2 m/s under the 3D coordinates. e algorithm and simulation environment are implemented with MAT-LAB. e simulator implements the process of positioning in the condition of one tag and four anchors. e tag moves on the straight line ((0,0,0) m to (4,4,4) m). Four anchors adopt the proposed MPGA optimal layout. e test records measurement results 20 times. e root means square error (RMSE) is employed in Figure 4 to measure the accuracy of position in di erent conditions of noise standard deviation. e RMSE can be calculated by the following equation: where (x, y, z) represents the actual position of the tag and (x k , y k , z k ) represents the estimated location of the tag.

Mobile Information Systems
It can be concluded that the TWR-TDOA-KF algorithm has better performance than the TWR-TDOA algorithm and the Chan-EKF. In addition, the optimized algorithms have better performance than the unoptimized algorithms. More accurately, for three different noise standard deviations, the average RMSE of the optimized TWR-TDOA-KF algorithm is lower than the Chan-EKF by 1.67 cm, lower than the TWR-TDOA-EKF by 1.03 cm. And the average RMSE of the TWR-TDOA-KF is lower than TWR-TDOA by 1.51 cm.

Hardware Platform and
Measurement Scenario e system measurement model is shown in Figure 5. e hardware part is composed of a single-chip microcomputer and a UWB communication module. In our system, only the primary anchor is connected to the upper PC through a USB data cable, and the secondary anchors are wireless communication. ADS-TWR ranging and wireless data transmission are applied between the tag and the anchors through the UWB communication module. After measuring the distance, the secondary anchors transmit the data to the anchor, and then the primary anchor transmits the data to the upper computer through a USB to calculate the target position. Here, we use the optimum anchors' distribution based on the proposed simplified MPGA algorithm. For the internal hardware module structure of the tag and anchors, we adopt the DWM1000 system. Time error is on the nanosecond level and the typical update rate is 3.5 Hz. is system has a feature of low cost, high ranging accuracy, high positioning accuracy, and fast ranging speed, and the serial port of hardware is very robust. Compared with the traditional ranging mode, the power consumption is much lower [21].

An Outdoor Scenario.
e layout of our outdoor experiment scenario is shown in Figure 6(a), and it is implemented in cropland. Anchor 1 is connected to the PC as the primary device, and anchors 2, 3, and 4 are secondary devices. In this experiment, h � 80 , Genmax � 10, and X 2×12 � Input: X 2×12 (the range matrix of the given space), h (the height of the measured plane), MAXGEN (maximum iteration times), N (the population size), P c (the crossover rate), P m (the mutation probability) Output: Ax (the anchor coordinates) (1) generation � 0; (2) Initialize the populations and generate plenty of random coordinates Ax in each population according to X 2×12 ; (3) Evaluate the fitness values via equation (19) and all chromosomes are ranked according to the fitness values; (4) while generation < MAXGEN (5) for i←1 to N (6) Calculate the fitness of individuals in population[i] according to X 2×12 ; (7) Select the better chromosomes as parents that have the more fitness values; (8) Cross the chosen parents to produce new offspring at a probability of Pc; (9) Mutate the new offspring at a probability of P m ; (10) Calculate the fitness of the individual in the offspring; (11) Reinserts offspring in the population[i]; (12) end (13) for i←1 to N (14) if i � N (15) Replace the worst chromosome in population [1] with the best one in population[N]; (16) else (17) Replace the worst chromosome in population[i + 1] with the best one in population(i); (18) end (19) end (20) Select the best individual in each population as the elite population; (21) Select all the converted chromosomes to find the minimum value and to reassemble the chromosomes; (22) If the new minimum value is less than the old one (23) generation � generation + 1; (24) Save the new minimum value and update Ax according to the new chromosomes; (25) end (26) end ALGORITHM 1: e distribution of anchors is optimized via simplified MPGA. In this section, the experimenter debugs the positioning system from the midpoint between anchor 3 and anchor 4 to the midpoint of anchor 1 and anchor 2 by holding the tag at a constant velocity of 0.8 m/s. We use the Link PG system to get the mobile data and then process these data by our proposed method. e results are shown in Figure 6(b). e true trajectory of the target's motion is illustrated with the blue line at the top. e positioning result is depicted with the red dots. e result processed with the Kalman lter is plotted with a yellow line, which is the nal location trajectory. It shows that the Kalman lter put the scattered anchor point trace into a smooth tracking curve, and the anchor point trace deviating from the real trajectory is corrected to a certain extent.

Indoor Scenario.
e GPS signals cannot penetrate buildings and are not able to work indoors. In this part, we designed an indoor position experiment. e setup is shown in Figure 7(a), which is a room with a length of 640 cm, a width of 430 cm, and a height of 374 cm. e moving target tracks the blue rectangular on the desk, which has a height of 80 cm. Anchor 1 is the primary sensor and the others are the secondary sensors.
After running the MPGA, anchor 1 is set as (0,0,0) and the other anchors are set as (500, 0,370), (500,400,0), (0,400,370), respectively. In this indoor experiment, by using the proposed algorithm, the 3D comparison between the positioning results and the real trajectory is shown in Figure 7(b). It should be mentioned that the electromagnetic interference from GPS and WiFi may a ect the measurement accuracy.

Results and Analysis
For indoor and outdoor environments, e ective measurement experiments are carried out. e RMSE between the actual position and the estimated location is evaluated. e RMSE of the outdoor scene is shown in Figure 8(a), and the error result for the indoor scene is calculated, as shown in Figure 8(b). e average RMSE of the position error for the outdoor environment is 9.8 cm, and the average position error is about 11.21 cm for the indoor scene. e indoor error is  larger than that in the outdoor environment, which may be caused by adjacent frequency electromagnetic interferences.
Combining the outdoor and indoor scenarios, the wholesystem RMSE error for 3D moving targets is around 10 cm. Comparison based on localization accuracy and the implemented localization approach between the proposed technique and other reported algorithms is listed in Table 2. e technique proposed in this article has the best accuracy performance when the new TWR-TDOA solution and layout optimization are applied, and the advantage is that it can be adapted to di erent environments.

Conclusion and Discussion
e system presented in this article successfully demonstrated the target positioning and tracking process for a moving target in 3D UWB indoor and outdoor scenes. e idea of the system is to use ranging to realize positioning. After obtaining the distance between the target and the base station, the proposed TDOA algorithm is used for the positioning solution. We also discuss which factors a ect the theory's accuracy. An optimum layout with low complexity based on the 3D MPGA is used to reduce the error in positioning accuracy. Single horizontal plane searching can greatly reduce computing and has similar precision to whole space searching. e hardware of the proposed system uses a UWB communication to realize the data transmission between the measured target and the base station and then realizes the distance measurement. is is an important step to getting the original data. Indoor and outdoor experiments are provided. If only the new TWR-TDOA solution is adopted, it has poor stability. Kalman lter algorithm is used to solve the problems related to fuzzy and missing subjects of TDOA positioning in the indoor and outdoor experiments, which has better location results. Our proposed system has better precision than mainstream algorithms. Due to the limited experimental conditions, the error test of the system is not very accurate. If the stepping motor is used to simulate and analyze the moving target in actual scenes, the system error can be further reduced. In this design, the Kalman lter is selected to lter the TDOA positioning results when tracking the target. In fact, this method has the problem of lter divergence, that is, when the target motion state does not meet the lter setting, the Kalman lter results will deviate and accumulate gradually.
is problem can be improved by some speci c algorithms for tracking maneuvering targets, such as the Singer algorithm, Interactive Multi-Model algorithm, and so on.
Data Availability e MatLab and python code used to support the ndings of this study are available from the corresponding author upon request.