A mobile localization method based on a robust extend Kalman filter and improved M-estimation in Internet of things

As the key technology for Internet of things, wireless sensor networks have received more attentions in recent years. Mobile localization is one of the significant topics in wireless sensor networks. In wireless sensor network, non-line-of-sight propagation is a common phenomenon leading to the growing non-line-of-sight error. It is a fatal impact for the localization accuracy of the mobile target. In this article, a novel method based on the nearest neighbor variable estimation is proposed to mitigate the non-line-of-sight error. First, the linear regression model of the extended Kalman filter is used to obtain the residual of the distance measurement value. After that, the residual analysis is used to complete the identification of the measurement value state. Then, by analyzing the statistical characteristics of the non-line-of-sight residual, the nearest neighbor variable estimation is proposed to estimate the probability density function of residual. Finally, the improved M-estimation is proposed to locate the mobile robot. Experiment results prove that the accuracy and robustness of the proposed algorithm are better than other methods in the mixed line-of-sight/non-line-of-sight environment. The proposed algorithm effectively inhibits the non-line-of-sight error.


Introduction
With the continuous development of sensor technology, wireless communication technology, and network technology, Internet of things (IoT) plays a vital role in many application 1-3 such as building intelligence, 4 fire rescue, and environmental monitoring. As one of the critical supporting technologies of the IoTs, wireless sensor network (WSN) has attracted the attention of researchers in recent years. The location information is one of the most important technologies for the application of WSNs. The data without location information are meaningless. 5 The accuracy of location affects the performance of the whole network. Therefore, the localization of the node is one of the key technologies of WSN. According to the fact whether the distance and angle information are needed for localization calculation, the localization of the WSNs can be divided into a range-based localization algorithm 6 and a range-free localization algorithm. 7 According to the different measurement method, the localization of the WSNs can be divided into received signal strength indicator (RSSI), 8 time difference of arrival (TDOA), 9 angle of arrival (AOA), 10 and time of arrival (TOA). 11,12 The rangebased localization algorithm can achieve high localization accuracy with a lot of calculation and communication energy consumption. Therefore, it is not suitable for low-cost and low-power applications. The rangefree localization algorithm uses the connectivity of the network to calculate the location of the node, which is not affected by the ranging error.
At present, the research on WSN localization technology assumes that the nodes are usually deployed in an ideal environment. The propagation signal between the mobile node and the anchor node is usually line-ofsight (LOS). However, the environment is usually complicated in practical applications and there are many obstacles. The propagation signal is easy to reflect and diffract. The communication between nodes is usually non-line-of-sight (NLOS) which leads to a large localization error. 13 The sophisticated environment will reduce the localization accuracy rapidly. Therefore, the research of NLOS error has great significance to the mobile target localization in WSNs.
Different environment needs different requirement of the localization accuracy in for WSNs. 14,15 More precise localization accuracy is demanded in some specific applications to complete the effective data collection. Researchers usually regarded that the indoor localization of WSN is in an ideal environment, 16 which mainly reflected in (1) the parameters of the measurement error are fixed. The impact of the measurement error caused by the dynamic environment is not considered. The inaccurate parameter estimation will significantly affect the localization performance. 17 (2) It is usually assumed that the propagation state is LOS or the state is known. The frequent switching of the node propagation state is not considered. In the dynamic indoor environment, the signal propagation state is usually changing in real time. The fixed propagation state will reduce the localization accuracy. 18 However, the indoor environment is more complex and dynamic due to the influence of people or obstacles. The model and parameters of the measurement error will change with time. Motivated that the NLOS propagation of signal decreases the accuracy of localization, we proposed a novel NLOS localization algorithm based on the improved M-estimation and extended Kalman filter (EKF) for the mobile target localization in complex indoor environment. The proposed algorithm effectively reduces the NLOS error and improves the localization accuracy. The main contribution of this article is listed as follows: 1. We utilize a data processing method of highfrequency ranging, which can effectively distinguish the LOS measurement values and NLOS measurement values. 2. The proposed algorithm adaptively adjusts the parameters to reduce the adverse effect which is caused by the larger residual value in the localization results. 3. We propose a nearest variable neighbor estimation algorithm which can be used in different noise environments without the NLOS error model.
The rest of the article is organized as follows: In section ''Related work,'' we introduce the background and related work. In section ''The architecture of the proposed algorithm,'' the architecture of the proposed algorithm is described. Section ''Proposed method'' represents the proposed algorithm in detail. In section ''Simulation results,'' we describe the simulation results and performance analysis. The conclusion is given in section ''Conclusion.''

Related work
The localization of the mobile target has gradually attracted the attention of researchers in a practical application such as fire rescue and health surveillance. Acoustic energy attenuation model and infrared detection are usually used for mobile target localization. Nowak 19 proposed the distributed density estimation and clustering expectation maximization algorithm, but this method is only suitable for the multiple Gaussian models. Sheng and Hu 20 suggested the maximum likelihood (ML) estimation method for multiple sources and accomplished the centralized target localization. For multi-target tracking in WSN, Sheng and Hu 21 proposed the distributed particle filter, which solved the problem of excessive network energy consumption in target tracking and localization. Godsill and Vermaak 22 proposed a variable rate particle filter, which improved tracking results using a new system model. Clark et al. 23 introduced the moving Rayleigh hybrid filtering, which has an excellent tracking effect for the moving target.
Parametric methods and non-parametric methods are two main methods to solve the NLOS errors. The measurement environment of the parametric methods is known as prior knowledge to correct the NLOS error. Mazuelas et al. 24 propose to use the prior knowledge that the NLOS error distribution and the parameters are known. They calculate the measured value with the NLOS error to achieve the correction of the NLOS measurement value. Chen 25 proposed to use interactive multi-model to filter the mixed LOS/ NLOS measurement value, and then the classical location algorithm can be used to locate the target. However, the algorithm is limitless for the NLOS parameters are needed as prior information. The proposed method does not require prior information and it is independent of the measurement values. The superiority of the non-parametric method is that it does not require the prior information of the estimation model and NLOS measurements. A Bayesian approximation adaptive Kalman filter 26 is developed in LOS/NLOS environments, where the prior knowledge of NLOS is unknown. They estimate the mean and the measurement noise to mitigate the influence of NLOS error. Liao and Chen 27 proposed a mixed Kalman filter and H-infinity filter (HF) algorithm to reduce the NLOS error.
Many researchers proposed the NLOS localization methods in recent years. Yang et al. 28 proposed a new NLOS recognition algorithm based on the feature selection strategy which can select the optimal subset of input features automatically and improve the accuracy of classification. Then, they used a high precision and low complexity localization algorithm based on the input vector machine. The input vector machine algorithm is sparse and has few import vectors. Tomic and Beko 29 proposed a localization algorithm based on the bisection, which does not need the statistics of NLOS measurements and the prior knowledge of LOS measurements. Cheng et al. 30 classify the NLOS measurements into two categories by Fuccy-C-Means to tackle complicated NLOS errors. And they use the mixed filter algorithms which did not need the prior information. The mixed filter can mitigate NLOS error effectively. Cui et al. 31 suggested using a Gaussian mixture model (GMM), interacting multiple models, and EKF to locate the mobile node in the NLOS environment. They cope with the changing transmission channels with three conditions. The GMM-based algorithm could obtain an accurate estimation. In the literature, 32,33 the mixed filter is proposed to mitigate the NLOS error.

The architecture of the proposed algorithm
The methods for improving the localization accuracy of the network mainly fall into two categories: the NLOS identification 34 algorithm and the NLOS mitigating algorithm. 35,36 The NLOS identification algorithm mainly identifies whether the distance measurement value obtained is LOS or NLOS. If the LOS measurements are more than three, the NLOS measurements will be discarded and some classical localization algorithms will be used for localization calculation. The NLOS mitigating algorithms usually mitigate the NLOS distance value and use the NLOS distance measurement value to calculate the location. The NLOS mitigating algorithm has a strong inhibition effect on NLOS error and gets a better localization effect. In this article, we identify the NLOS measurements of the mobile target using the residual analysis. Then, we mitigate the NLOS error using the improved M-estimation algorithm based on nearest neighbor variables for localization. The proposed algorithm is described as follows: 1. Processing the measurement value. We assume that the anchor node could obtain multiple measurement values and the ranging frequency is higher than the localization frequency. Therefore, we average the measurement values. 2. Generating the residuals. We obtain the average distance measurement value of each anchor node. And then the residuals are generated by extend Kalman filter. 3. Selecting a reliable measurement value. The residual generated in step 2 is processed by the improved extend Kalman filter algorithm. It is considered that it is more reliable to generate the average measurement value with a small residual. The most reliable distance measurement values are regarded as LOS measurements. 4. Calculating the location. We use the distance vector generated in step 3 as the current distance measurement vector. Then, we utilize an improved M-estimation algorithm based on nearest neighbor variables to complete the current location calculation. Finally, we obtain a state estimation vector r.

System model
We calculate the location of the mobile robot by N anchor nodes in the monitoring area in the WSN. The location coordinates of anchor nodes are expressed as AN n = ½x n , y n T , n = 1, 2, :::, N . The location of the mobile robot at time k is ½x(k), y(k) T , k = 1, 2, :::, k. The anchor nodes transmit the signal and the mobile robot receives the signal. The distance measurement value can be obtained by multiplying the signal arrival time and the signal propagation speed. At time k, the distance between the mobile robot and the nth anchor node is d n (k) = ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ½x(k) À x n 2 + ½y(k) À y n 2 q , n = 1, 2, :::, N , In LOS environment, the measured distance between the nth anchor node and the mobile robot can be modeled as d n m (k) = d n (k) + e noise , n = 1, 2, :: where e noise ; N (0, s 2 n ) is the measured noise error with variance s n .
In NLOS environment, the measured distance between the nth anchor node and the mobile robot can be modeled as where e NLOS is NLOS propagation error. The e NLOS obey uniform, exponential, and Gaussian distribution in different environments.

Improved extend Kalman filter
We obtain the optimal measured value of the measured value and historical data using the linear minimum variance when we track the trajectory of the mobile robot. 37 However, most of the models are nonlinear in practical application. Therefore, we usually use the Kalman filter algorithm to linearize the model. In this article, we use the EKF 38 algorithm to locate the mobile robot. The nonlinear model is approximately linearized using the Taylor series expansion. Then, the particle filter algorithm is used to solve the localization problem.
The mobile robot moves at a variable speed in the monitoring area which deploys N anchor nodes. The mobile robot is measured by N anchor nodes for localization.
According to the characteristics of high-frequency base station localization, each anchor node can obtain j measurement value in each location process. 39 The average distance vector between the mobile robot and the anchor node at time k is where j is the number of ranging measurements that the anchor node can complete in one positioning process. d n m (k) is the nth distance measurement vector which is obtained by anchor node at the present moment.
The state equation of the system is where r k is the state vector of the mobile robot, § kÀ1 is the process noise of the system, the matrix P is the onestep state transition matrix, and Q is the noise input matrix. The matrices P and Q are described as follows where Dk is the period of the localization and H 2 is the identity matrix. The measurement equation of the system is where observation noise includes N residuals which are caused by measurement noise error and NLOS error at time k g(r k ) = ½g 1 (r k ), g 2 (r k ):: where g(r k ) is the Euclidean distance between the nth anchor node and the mobile robot. We selected r 0 as the initial vector and linearized the nonlinear equation. The approximate value can be obtained using the first-order Taylor series expansion where J k is the Jacobian matrix. Then, we linearize the measurement equation The equations of time update is The equations of measurement update is where G k is the Kalman gain at time k.
In order to obtain the distance residual, we linearize the models as follows The residual vector d k is shown as follows C k can be obtained by Cholesky decomposition of the covariance matrix. Both sides of equation (17) multiply C À1 k , equation (17) can be written aŝ The state vectorr k can be obtained 40 The posterior covariance of the state vectorr k can be approximately given by equation (16).

Improved nearest neighbor variable estimation localization algorithm
A linear model can be obtained from equation (3 where F k is the relation matrix after linearization at time k; d k = ½d 1 k , d 2 k , . . . d n k T ; c k is the random variable caused by the measurement noise error and the NLOS error, c k = ½c 1 k (k), c 2 k , . . . c N k T , the random variable is independent and identically distributed. At time k, the measurement vector of the nth anchor node is d n k = ½F k r k n + e n nlos (k). r k can be obtained by the ML estimation algorithm 41,42 r MLE = arg min where d p k is the measurement value of the nth anchor node at time k; f (Á) is the probability density function of the noise. The differential calculation is carried out on equation (23) and the differential result is given zero value where h = À f 0 =f is the location evaluation function. The optimal solution cannot be obtained if the density function f is not known as a prior condition. The ML algorithm is equivalent to the least squares estimation algorithm in a LOS environment. However, the estimation algorithm based on this evaluation function is usually sensitive to NLOS errors. The ML estimation algorithm has superior localization performance in the LOS environment. However, this algorithm is sensitive to NLOS error. It is difficult to obtain satisfactory localization results using the ML algorithm in the mixed LOS/NLOS environment.
The M-estimation 43 algorithm can mitigate the adverse effect of the NLOS error in localization. The À log f (Á) in equation (23) is replaced by a penalty function t(Á) in the M-estimation algorithm. And the influence function is defined as u(c) = t 0 (c). We use the influence function to replace the localization evaluation function in equation (24) where s E is the standard deviation of measurement noise error and c is the cutting factor of input data. When there is abnormal value, the influence function in equation (25) can restrain the abnormal value to limit the adverse effect of the localization result. However, the localization performance of the M-estimation algorithm mainly depends on the matching degree between the influence function and the real noise model. The reasonable selection of the influence function and the cutting factor depends on the prior knowledge, otherwise it will affect the localization effect. Therefore, the M-estimation algorithm has great limitations. We propose an improved M-estimation algorithm based on nearest neighbor variables to overcome these limitations. In this algorithm, the robust density estimation is used to approximate the density function f _ (Á) in equation (24), which can mitigate the NLOS error and overcome the limitation of the M-estimation algorithm.
The penalty function t(Á) can adapt to different signal noise models. Therefore, the mobile localization algorithm based on the penalty function may be applicable to different noise environments without assuming that the NLOS error model is known. Then, t(Á) will be replaced by À log f (Á). f _ (Á) is the estimated noise density function. The algorithm flow is shown as follows: Step 1. Initialization: We set the iteration n = 0 and calculater 0 by equation (21).
Step 3. Estimate density function and evaluation Step 4. Update the result:r n + 1 =r n + e(W T W) À1 Step 5. Check the convergence: If ther n + 1 À k r n k\g, calculation is end. Otherwise, n = n + 1, return to step 2.
The ML estimation algorithm is only used to generate the initial solution of the state vector in step 1 and the noise residual in step 2. The residual is used in step 3 to estimate the evaluation function. In step 4, Newton-Raphson is used to calculate the iteration, and n represents the number of iterations. If the result obtained in step 5 is convergence, the algorithm stops the operation.
The residual generated by the NLOS values is easy to generate a heavy tailed for the probability density function f _ (Á). The heavy tailed has a negative impact on the localization results. NLOS residual can be effectively highlighted in the high-frequency distance measurement. Therefore, we can improve the localization accuracy by mitigating the corresponding h _ (c _ ) and the parameters should be selected reasonably. We propose an estimation algorithm based on the nearest neighbor variables algorithm to estimate the evaluation function. In contrast, one of the advantages of the nearest neighbor variable estimation is that its parameters are easy to obtain. The density function and evaluation function in step 3 can be obtained by the nearest neighbor variable estimation which can ensure the localization accuracy in the mixed LOS/NLOS environment. The improved nearest neighbor variables estimation algorithm is defined as follows where (c m ) N m = 1 represents a group of sample points, N is the sample size, b is the global bandwidth, and d m, q is the local bandwidth. The reasonable selection of global bandwidth b is critical to get better localization results. A method to obtain reasonable b is as follows where Z is the quartile spacing and N is the sample size.

Simulation results
In this section, we evaluate the performance of the improved M-estimation based on the nearest neighbor variables and extend Kalman filter (IMNNV-EKF) algorithm through simulation. Figure 1 shows that 10 anchor nodes and obstacles are randomly deployed in the 150 3 150 m 2 area. The mobile robot moves at a variable speed in the monitor area. HF algorithm and EKF algorithm are compared with the IMNNV-EKF algorithm. The simulation results of the proposed algorithm are verified through MATLAB R2010a. The default parameter values in the simulation are shown in Table 1.
The performance of the algorithms is evaluated by the root mean square error (RMSE) and cumulative distribution function (CDF) wherer v k is the state estimation of the mobile node at time k and v is the times of Monte Carlo runs. Figure 2 shows that the RMSE of the three algorithms. The localization errors of the EKF algorithm and the HF algorithm are relatively large, which indicates that the EKF algorithm and the HF algorithm are sensitive to NLOS error. Although the localization accuracy of the EKF algorithm has been improved, the overall localization accuracy is still weak. Compared with the HF algorithm and the EKF algorithm, the proposed algorithm has higher localization accuracy. It can be seen that the proposed algorithm has excellent stability among the three positioning algorithms.
The CDF of the localization errors for the three algorithms is shown in Figure 3. When the CDF of the proposed algorithm is close to 1, the corresponding  localization error is 4 m. In comparison, the HF algorithm and the EKF algorithm are 7.3 and 7.2 m, respectively. The localization error of the proposed algorithm is 50% within 3 m, while the HF algorithm and EKF algorithm are 50% within 5 and 4.8 m, respectively. It can be seen that the proposed algorithm has the highest localization accuracy in the three localization algorithms. The proposed algorithm has a strong inhibition effect on NLOS error in mobile target localization. We analyze the localization performance of each algorithm when the NLOS error obeys Gaussian distribution, exponential distribution, and uniform distribution, respectively. 44

NLOS error obeys Gaussian distribution
When NLOS error obeys the Gaussian distribution, the relationship between the mean of NLOS error and RMSE for three algorithms is shown in Figure 4. With the increase in NLOS error, the localization errors of the EKF algorithm and HF algorithm are increasing. When the mean value of NLOS error is small, the measured value of NLOS produces a small residual value which is not easy to be discarded. The localization error of the proposed algorithm is larger caused by the residual. So, the localization error of the proposed algorithm increases with the increase in the mean value of error. When the mean value of NLOS error increases to a certain extent, the measurement value of NLOS has a large residual. Therefore, the NLOS error is easier to be identified and discarded and the localization error of the proposed algorithm gradually decreases. The localization accuracy of the proposed algorithm is the highest in the three algorithms. Figure 5 shows the relationship between the measurement noise standard deviation and RMSE. It can be seen that the localization errors of the three algorithms increase with the increase in the standard deviation of measurement noise. The HF algorithm has a significant localization error and its localization performance is greatly affected by NLOS error. The HF algorithm is sensitive to the Gaussian NLOS error. The localization accuracy of the EKF algorithm and the proposed algorithm tends to be stable. The proposed algorithm always has the highest localization accuracy. With the increase in the standard deviation of NLOS error, the localization accuracy of EKF algorithm is closed to the proposed algorithm, but the localization   accuracy of the proposed algorithm is always higher than that the EKF algorithm.

NLOS error obeys exponential distribution
The localization accuracy of the three algorithms decreases with the increase in the mean of NLOS error in Figure 6. The HF algorithm is sensitive to exponential distribution and has the worst localization performance. The RMSE of the proposed algorithm is much lower than the EKF algorithm and HF algorithm, which shows the strong robustness of the proposed algorithm. Compared with the EKF algorithm and HF algorithm, the proposed algorithm has the highest localization accuracy ( Figure 6). Figure 7 shows the relationship between NLOS error standard deviation and RMSE. It can be seen that with the increase in the standard deviation of the measurement noise, the localization error of each algorithm also increases. The localization effect of the three algorithms is relatively stable and less affected by the standard deviation of measurement noise. The localization accuracy of the proposed algorithm is always better than the other two algorithms. It has a strong inhibition effect on the NLOS error of the Exponential distribution.

NLOS error obeys uniform distribution
When the NLOS error obeys uniform distribution, we analyze the performance of each algorithm.    shows the relationship between the maximum deviation coefficient U-max and the RMSE for three algorithms. It can be seen when the U-max = 7, the localization accuracy of the proposed algorithm is 33% and 45% higher than that of the EKF algorithm and HF algorithm, respectively. It can be seen that with the increase in U-max, the localization accuracy of the EKF algorithm and HF algorithm decreases obviously. The localization error of the proposed algorithm increases with the increase in the U-max in the early stage. But with the increase in U-max, the localization error of the proposed algorithm changes to be steady. The localization accuracy of the proposed algorithm is better than other algorithms all the time. Figure 9 shows the relationship between the standard deviation of measurement noise and the RMSE. When the standard deviation of measurement noise is small, the localization accuracy of the EKF algorithm and HF algorithm is similar. The proposed algorithm is obviously higher than the other two algorithms. With the increase in the standard deviation of measurement noise, the localization accuracy of HF algorithm decreases obviously, the localization accuracy of the EKF algorithm changes more smoothly. The localization accuracy of the proposed algorithm decreases and gradually approaches to the localization accuracy of the EKF algorithm. But the proposed algorithm always has the highest localization accuracy.

Conclusion
In this article, a mobile robot localization algorithm is proposed. The linear regression model of the EKF algorithm is used to generate the residual of the measurement value. Then, the residual selection mechanism is used to filter the residual value. By analyzing the statistical characteristics of the NLOS residual, an estimation algorithm based on the nearest neighbor variable estimation is proposed to estimate the probability density function of residual. Finally a mobile node location algorithm based on improved Mestimation is proposed. Comparing with the HF algorithm and EKF algorithm, the IMNNV-EKF algorithm outperforms other algorithms in localization accuracy and stability. Simulation results show that the IMNNV-EKF algorithm mitigates the NLOS error effectively when the NLOS error obeys three distributions. For future work, we will take into account the model of multiple signals in NLOS environment. We will build the system model based on the mixed RSS/ TOA/TDOA which is similar as the actual environment to reduce the error in the transmission from RSS/TOA/ TDOA. More actual experiment in different environment is considered to verify the proposed algorithm.

Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.