## 2 Localization Algorithm based on Spring Model (LASM)
### Patches for the basic localization algorithm (LASM(P))
#### 2.3.2 Patch B for bad nodes  
In order to obtain higher localization accuracy for lunar rover, the bad nodes which can't be well localized need to be found out. A trust value is set for each of these sensor nodes. If the trust value of one node is 1, it means that the estimated position can be well trusted. When using sensor nodes' position information for lunar rover's localization and navigation on the moon, it can just use the information of nodes with higher trusts to the best of our abilities. In this way, the accuracy of lunar rover's localization and navigation can be increased. Here, \"not well localized\" means that:1. The node cannot be localized;  
2. The node is localized at needless points. **Theorem 1**. In a two dimensional system, if a particle is connected with at least 3 unaligned particles who know their positions, this particle can be localized. ('Unaligned' means that these particles are not in a line)  
Proof. If two particles are connected, the distance between these two particles can be obtained. When there are three nodes \(j\), \(k\), \(l\), which know their positions and the distances (between these nodes and the un-located node \(i\)), triangulation algorithm [18] can be used as follows:  
\[ \begin{cases}\sqrt{\left(x_{i}-x_{j}\right)^{2}+\left(y_{i}-y_{j}\right)^{2} }=r_{ij0}\\ \sqrt{\left(x_{i}-x_{k}\right)^{2}+\left(y_{i}-y_{k}\right)^{2}}=r_{ik0}\\ \sqrt{\left(x_{i}-x_{l}\right)^{2}+\left(y_{i}-y_{l}\right)^{2}}=r_{il0}\\ \end{cases}  \tag{17}\]  
Therefore, the coordinates \(\left(x_{i},y_{i}\right)\) of the particle \(i\) can be calculated. In some specific situations, a particle can also be localized even if there are only two particles connected with it, which is shown in Figure 3. Particle \(a\) is just connected with particle \(b\) and \(c\). This particle can be localized at two positions (position \(a\) and \(d\)). However, if this particle were located at position \(d\), it would have obtained connections with particles \(e,f\). In face, it does not have connections with \(e,f\). Therefore, this particle can just be localized at position \(a\). However, we don't pay much attention on these situations, because we need a fast and simple algorithm to find out these nodes for the lunar rover's localization and navigation on the moon, not a precise algorithm. Two methods are used to solve this problem. The relatively complex algorithm is used to find out the nodes which can't be localized as follows:  
First, 3 particles which are connected with each other are chosen and put in a set. Using these 3 particles, a relative coordinate system can be established. Figure 3: An specific example where node a can also be localized. Secondly, if there are particles which are connected with at least 3 particles in that set, these particles can also be localized. And we also put them into that set. The amount of particles in that set will increase. In addition, if there are at least 3 anchor nodes in this set, all particles in this set can have absolute coordinates by coordinate transformation. Finally, the particles which can't be put in the set may not be able to be localized to a great extent (These node may also be localized in some specific situations as described before). This algorithm is a little complex, and do not take the information of LASM(B) into consideration. Therefore, a new algorithm can be used to find out the nodes which can't be well localized. The main idea of this algorithm is as follows:  
Step 1, for each particle, if it is at needless point, the trust of this particle is set to be 0.5; if it only has one or two neighbor particles, the trust of this particle is set to be 0. The trusts of other particles are set to be 1. Step 2, for each particle, if its trust is not equal to 1, cut off all the springs connected with it. Therefore, it will not be the neighbor particles of others. And then tells its former neighbors to delete itself from the neighbors' neighbor list. Step 3, repeat steps 1&2, until no particles need to change their trust.