# Robust Localization of the Mobile Robot Driven by Lidar Measurement and Matching for Ongoing Scene
## 3 Localization of Mobile Robot in Ongoing Scene
### Localization of Artificial Landmarks and Generated Buildings Based on Adaptive Weights
#### 3.2.2 Robust Localization Based on Adaptive Weights  
Firstly, at the initial working location of the scene, the generated building does not exist and the mobile robot can locate itself accurately by recognizing artificial landmarks. Then, with the increasing of ongoing buildings, the next working location can be obtained from the last location by ICP method based on ongoing features only or all features of the scene. At the same time, the artificial landmarks can be blocked by the generated buildings gradually, which causes the mobile robot failure to locate. To solve this problem, the paper determines the initial position of mobile robot by extracting intensity information of artificial landmarks, and then uses the generated features to match between the corresponding working locations. For improving the robust localization of mobile robot, three weighted factors are set to represent noise errors of the lidar, observation errors of artificial landmarks and the matching errors of generated features between two adjacent locations, separately. Then, a hybrid localization method that based on combined weighting factors is established to improve the adaptability to dynamic scene and robustness of localization. The localization in the paper is only achieved by matching of point clouds that scanned by Lidar, and does not include information of other sensors such as odometry and inertial measurement unit, which reduces the complexity and asynchrony of multi-sensor fusion to a certain extent. The robust localization algorithm refers to the pseudo code of Algorithm 1. ```
1:Initialize the key parameters \(W_{f,s}\), \(W_{f,l}\), \(W_{f,m}\), \(I_{x,y}\)
2:for the position \(pi\) in \((p1,p2,\cdots,p6)\)do
3:\(W_{f,s}(W_{f,l}+W_{f,m})=1\)
4:\(P_{li}\leftarrow[x_{li},y_{li}]\)
5:\(P_{mi}\leftarrow(0,0)\)
6:\(I_{ht}\leftarrow\) intensity threshold of point cloud \((x_{i},y_{i})\), \((I_{ht}=200)\)
7:while point cloud \((x_{i},y_{i})\) in horizontal scanline (\(z\gets 0\)) of Lidar do
8: Calculate the distance \(d_{\min}(m_{pi,i},m_{p(i+1),j})\) by k nearest neighbors
9:\(V_{s,m}\leftarrow\frac{1}{k}\sum_{j=1}^{k}d_{\min}(m_{pi,i},m_{p(i+1),j})\)
10:if\(I_{x_{i},y_{i}}>I_{ht}\)
11:\(V_{s,l}\leftarrow\frac{1}{n}\sum_{i=1}^{n}\left(x_{li}-\overline{x_{l}}\right) \left(y_{li}-\overline{y_{l}}\right)\)
12:endif
13:endwhile
14:\(W_{f,s}W_{f,l}\gets V_{s,m}/(V_{s,l}+V_{s,m})\)
15:\(W_{f,s}W_{f,m}\gets V_{s,l}/(V_{s,l}+V_{s,m})\)
16:\(E(R_{i},t_{i})=\underset{\text{Re}\in\mathcal{O}(2),t\in\mathbbm{R}^{2}}{ \arg\min}\frac{1}{k}\sum_{i=1}^{k}\|P_{i}-(R_{i}S_{i}+t_{i})\|^{2}\)
17:\(P_{i}\gets RP_{i-1}+t+E(R,t)\)
18:\(\Gamma_{pl}=W_{f,s}(W_{f,l}P_{li}+W_{f,mi}P_{mi})\)
19:endfor
20:return\(\Gamma\)
```  
**Algorithm 1** Robust localization of mobile robot based on adaptive weighting factors  
Due to the noise of the ongoing scene, three weighting factors \(W_{f,s}\), \(W_{f,l}\), \(W_{f,m}\) are considered to compensate the localization accuracy of mobile robot. In this paper, a target function for localization based on multiple weighting constraints is established. The specific formula is as follows:  
\[\left\{ \begin{array}{l}\Gamma=W_{f,s}(W_{f,l}P_{l}+W_{f,m}P_{m})\\ W_{f,s}(W_{f,l}+W_{f,m})=1\\ \left\langle W_{f,s},W_{f,l},W_{f,m}\right\rangle\in[0,1]\end{array} \right. \tag{22}\]  
where the parameter \(\Gamma\) represents the localization value of mobile robot based on adaptive combination weights. \(P_{l}\) represents the measured localization value based on the reflectors. \(P_{m}\) represents the matching value based on ongoing buildings, and three weighted factors \(\left\langle W_{f,s},W_{f,l},W_{f,m}\right\rangle\) are the distribution of [0,1]. Since the noise of Lidar has a close correlation to the measurement of reflectors and matching of the buildings, the paper sets a total weighting factor to compensate for the errors caused by the noise. The corresponding weighting equation is as follows:\[W_{f,s}(s,l,m)=\left\{