Wireless positioning method for transmission pipe gallery inspection robot based on the TDOA algorithm

A wireless sensor network for positioning an inspection robot is developed for a transmission pipe gallery environment. The time difference of the arrival algorithm optimized by the least squares method is utilized to realize the wireless positioning function of the robot in the inspection process. The developed system adopts a spiral configuration to install the sensor nodes at equal intervals on the sidewall of the transmission pipe gallery, and only 10 sensor nodes closest to the wireless signal transmission source are activated for each measurement, which avoids the poor long-distance measurement effect of the sensor, ensures sufficient accuracy, and reduces calculation costs. A wireless positioning simulation test was conducted in an experimental transmission corridor environment. The error of the simulation results is equivalent to the measurement error of a single sensor, and the error is not accumulated in the calculation of the algorithm, indicating that the algorithm has achieved good results.


Introduction
With the development of automation technologies, many simple repetitive detection tasks are gradually being replaced by machines, particularly the inspection of long-distance cables in tunnels [1][2] .For such large-scale and/ or long-distance automated inspection tasks, it is important to know the real-time position of the inspection robot.In open outdoor environments, GPS positioning or other means can be employed directly to track the robot's location; however, these methods are ineffective in indoor, tunnel, or other closed environments.
Real-time positioning of inspection robots in a transmission pipe gallery environment must be realized using sensor nodes and wireless networks deployed inside the environment.The development of wireless sensor network technologies and the improvement of data processing capabilities allow wireless positioning technology to be applied to the real-time positioning of inspection robots effectively.A wireless sensor network positioning system includes an arrangement of wireless sensor nodes, communication between the wireless signal source and the wireless sensor nodes, and data calculation in the wireless sensor networks.
Common wireless positioning algorithms include those based on the received signal strength indicator (RSSI), the angle of arrival (AOA), the time of arrival (TOA), and the time difference of arrival (TDOA) [3][4][5][6] .For relatively closed environments (e.g., transmission pipe gallery), electromagnetic and acoustic wave signals introduce strongly reflected interference; thus, the RSSI and AOA algorithms are ineffective.Additionally, the TOA algorithm requires a highly synchronized clock between the wireless signal transmission source and the wireless sensor node.
The TDOA algorithm is based on the time difference of the signal received by each wireless sensor node to locate the coordinates of the wireless signal transmission source, which is more suitable for wireless positioning in the transmission pipe gallery environment.However, most existing localization algorithms place a certain number of wireless sensor nodes in the target environment, and they summarize the measurement data of these wireless sensor nodes.For large environments, it is difficult to ensure both measurement accuracy and calculation complexity.
Herein, the general formula of the TDOA algorithm to calculate the positioning coordinates is derived.On this basis, the two methods of 'solving equations' and 'least square method' are used to simulate and compare the accuracy of the simulation results.Finally, a wireless positioning method for a transmission pipe gallery inspection robot is proposed, which effectively controls the error of the calculation results at a level close to the measurement error of a single wireless sensor node.

Principles
The conventional TOA algorithm uses the time required for the wireless signal source to send a signal to a given wireless sensor node to calculate the distance between the two.Then, the position of the signal is determined using the geometric relationship according to the distance (Fig. 1(a)); however, the absolute time is generally difficult to measure.The TDOA algorithm is based on the time difference between the signals sent by the wireless signal transmission source and each wireless sensor node.Based on this, a hyperbola with the wireless measurement node as the focus and the distance difference as the long axis is constructed.The intersection of the hyperbola is then taken as the location of the wireless signal transmission source (Fig. 1(b)) [7][8] .

Algorithm deduction
According to the basic principle of the TDOA algorithm, the coordinates of the wireless signal transmission source (referred to as the tag) and the wireless sensor nodes (referred to as anchors) are set as  ⃗ = (, , ) and  ⃗ = ( ,  ,  ) , respectively.Then, the distance  between each anchor and tag is expressed as follows.
= | ⃗ −  ⃗| (1) Thus, the distance difference  , from the tag to anchor i and anchor 1 is expressed as follows.
In Equation ( 7),  ⃗ ,  ,  , and  are the coordinates of the anchors, and  , is obtained by measurement; thus, this equation can be considered as a linear equation  =  , where  = (, , ,  ) is the independent variable vector.It should be noted that  contains four unknown variables; thus, four equations are required to determine a unique solution.The relevant data  ⃗ of anchor 1 is brought into the equation set, and both sides of the equation are 0; thus, the equation is meaningless.Therefore, data from a total of five anchors are required to determine the coordinates of the tag.

Algorithm simulation
In order to test the effect of the algorithm, this paper first sets up a simple environment to do a preliminary simulation test, the specific operation is as follows.A 5 m × 5 m × 5 m space is set and five wireless sensor nodes (i.e., anchors) are placed at coordinates (0,0,0) , (0,0,5) , (0,5,5) , (5,5,5) , and (5,0,5) , respectively, to form a simple wireless sensor network.A python program was developed to randomly generate the coordinates of the tag, simulate the distance difference between the tag and each anchor, and add a measurement error to obey the normal distribution (0, 0.01 ).According to the 3σ principle, the measurement error of the distance can be considered to be ±0.03.The linear equations are established according to Equation (7), and then the values of  ,  , and  (i.e., the coordinates of the target tag) are obtained.
The above simulation was repeated 100 times to obtain the corresponding tag coordinate vector  ⃗ , and then the deviation error between the simulation results and the actual coordinates was calculated as follows.
=  ⃗ −  ⃗ (8) A scatter plot of the deviation values of 100 simulations is shown in Fig. 2, where points with  ≤ 0.1 are shown in green, points with 0.1 <  ≤ 0.2 are shown in blue, and points with  > 0.2 are shown in red.As seen in Fig. 2, the deviation  ≤ 0.1 (i.e., 10 ) accounts for 46% of the simulation results; however, more than 30% of the deviation is large ( > 0.2).
3. Least squares method to solve TDOA 3.1.Least squares method In the previous section, the method and calculation formula of the TDOA algorithm were analyzed, and the effect of the TDOA algorithm was evaluated in a simulation.However, large deviations were observed in the simulation results.This is due to the measurement error of (0,0.01 ), which was added to the distance measurement simulation.This error continues to accumulate in the subsequent calculation process, thereby resulting in a large deviation in the final calculation results.
The least squares method is a mathematical optimization technique that seeks the best function matching of data by minimizing the sum of squares of errors, as shown in Fig. 3. Through the method, unknown data can be easily obtained, and the square sum of the error between the obtained data and the actual data is minimized [10] .Fig. 3 Data observation points and fitting lines [11] .
The least squares method can also be employed to solve linear equations.Unlike traditional solution equations, the least squares method does not need to limit the number of equations.Thus, more equations can be used to solve the target problem, and redundant data can be utilized to reduce the errors.Additionally, the least squares method can reduce the impact of accidental large deviations on the calculation results.

Simulation test
Here, the simulation test method described in Section 2.3 was followed to evaluate the TDOA algorithm optimized by the least squares method.However, in this simulation, the number of anchors in the wireless sensor network were increased to seven, and two new anchor coordinates were (2.5,2.5,0) and (2.5,5,2.5) .The simulation was repeated 100 times; the corresponding deviation scatter plot is shown in Fig. 4. Fig. 4 The deviation of the results is solved by the least square method.
In the results obtained using the least squares method, the deviation satisfies  ≤ 0.2, (i.e., 20 cm) in most cases, where  ≤ 0.1 accounts for about 90%, and there are no instances of  > 0.5 (Fig. 4).
The simulation results obtained with 10 anchors are shown in Fig. 5.The deviation satisfies  ≤ 0.1 above 90%.And only 2% of the measurement results have an error of more than 0.2 , but all within 0.3  (because the measurement error of a single sensor is less than ±0.3 ).
Fig. 5 The deviation of the results is solved by the least square method with 10 anchor points.
By comparing the results shown in Fig. 2, Fig. 4, and Fig. 5, we observe that after adding several anchors, the effect of using the least squares method to solve the TDOA algorithm is significantly better than using the simple solution equations.Additionally, it is seen that the effect gets better as the number of anchors increase.

Algorithm comparison
Here, the least squares method to solve the equations with 10 anchors is compared with the same data simulation.The results are shown in Fig. 6, where the blue scatter (ols) represents the deviation between the coordinates simulated by the least squares method and the actual coordinates, and the orange scatter (slv) represents the deviation between the coordinates simulated by the solution equations and the actual coordinates.The results of the least squares method are more stable.To compare the effects of the two solutions more intuitively, the case where the better 'ols' effect in the above diagram (with a smaller error value) is recorded as 1, otherwise recorded as -1, and the corresponding histogram is shown in Fig. 7.As shown, in most cases, the results of the least squares method are better than the solution of the equations.Combined with the results shown in Fig. 6, we observe that in several cases where the solution equations are better, the results of the least squares method are only a little worse than the solution equations.According to this setting, the length of the transmission pipe gallery environment is large, which must be considered when building a wireless sensor network.Thus, when the wireless sensor nodes (i.e., the anchors) is placed, equally spacing several anchors along the long axis should be considered.For this evaluation, a certain number of anchors were placed in the spiral arrangement shown in Fig. 9 (a).It is noted that the spacing between two anchors along the long axis of the transmission pipe gallery was set to 1 m.In addition, on the cross section, all anchors were placed on four points shown in Fig. 9

Simulation in transmission pipe gallery environment
In Section 4.1, wireless sensor nodes were positioned in the transmission pipe gallery environment.Due to the characteristics of the transmission pipe gallery environment, regardless of where the wireless signal transmission source (i.e., the tag) is located, there will always be a large number of anchors that are distant from the tag, which means the measurement error will be large.
Here, we assume that the static error of the single wireless sensor node ranging is  = 3 .In addition, the dynamic error () increases with the increasing distance and does not exceed 7 cm; thus, it can be assumed that () obeys Equation (9).The image of this function is shown in Fig. 10.The total measurement error  of the wireless sensor node is the sum of the static error and dynamic error.Here,  is obtained as follows.
=  + () (10) Thus, the total measurement error is less than 10 cm.Under the assumption that the total measurement error obeys the normal distribution, according to the 3σ principle, the normal distribution is expressed as follows.
Considering that the tag is completing the inspection work in the transmission pipe gallery, its movement speed will inevitably be limited.Thus, according to the position of the tag at the previous moment, the measurement data of several anchors near the tag can be selected to calculate the positioning coordinates, which avoids the excessive long-distance measurement error problem and unsatisfactory measurement effect.According to the analysis discussed in the previous section, 10 anchors were selected in this case.
Most transmission pipes that must be inspected are arranged in a straight line; thus, the moving trajectory of the tag will also be a straight line.In this simulation, the tag begins from a random position at  = 0 and moves in a straight line at 0.05   ⁄ .It is assumed that the tag sends a signal every 1 s to measure the distance difference and calculate the positioning coordinates.
This simulation was divided into two cases: (1) "use all wireless sensor nodes" and (2) "select the nearest 10 wireless sensor nodes."The simulation results are shown in Fig. 11 and Fig. 12 for these two cases, respectively.As can be seen, for the first case (using all wireless sensor nodes), the number of times the positioning result error was greater than 10 cm accounts for a large proportion (58%), and approximately 20% of the errors exceeded 20 cm.For the second case (selecting the nearest 10 wireless sensor nodes), most of the errors (98%) were less than 20 cm, and approximately 85% of all errors were less than 10 cm.Thus, after selecting the nearest 10 wireless sensor nodes, the large error problem in long-distance measurement was avoided effectively, and the positioning accuracy was improved greatly.It should be noted that the deviation of the positioning results obtained in the initial and end sections was significantly higher than that of the middle section because the tag was located at the edge of the whole system.And the anchors used for calculation were essentially distributed on the same side of the tag and the distance is far, which would lead to the increase of the measurement error of the sensor, thus making a great impact on the final calculation results of the algorithm.

Conclusion
This paper compares the effects of using two methods (solving equations and least squares methods) to solve the TDOA algorithm through simulation.It is found that when optimized by the least squares method, the TDOA algorithm exhibited a significant improvement in positioning accuracy.Herein, a wireless sensor network to detect robot localization was established for a transmission pipe gallery environment.The wireless sensor network adopts a spiral configuration, and each measurement calculation only activated some wireless sensor nodes.The optimized TDOA algorithm was employed to simulate a test environment.The positioning error of the simulation results was similar to the measurement error of a single sensor, which indicates that this method is effective.

Fig. 2
Fig. 2 Deviation scatter plot of the TDOA algorithm simulation results.

Fig. 6
Fig. 6 Deviation scatter plot of solving equations and least squares method.

Fig. 7
Fig. 7 Comparison between solving equations and least squares method.

4 .
Algorithm application in transmission pipe gallery environment 4.1.Environment settings Figure 8 (a) shows the basic form of a transmission pipe gallery environment.Here the top and side walls of the transmission pipe gallery are a complete arc, the bottom is a plane, and the overall shape can be seen as a flat cylinder.The total length of the gallery is 100 , and the top and side walls form part of a circle with a radius of  = 5 .The cross-sectional shape and size of the gallery environment are shown in Fig. 8 (b).(a) Physical image.(b) Cross section diagram.Fig. 8 Reference image of transmission pipe gallery.
(b) in turn.(a) Spiral wireless sensor node layout.(b) Schematic diagram of cross section points.Fig. 9 Schematic diagram of spiral layout.

Fig. 11
Fig. 11 Simulation results using all wireless sensor nodes.

Fig. 12
Fig. 12 Simulation results using the nearest 10 wireless sensor nodes.