## 2 Orientation and Localization Equations
### Selecting the Right Solution
With the constraints defined above, another fact follows from the proof. It is needed for the consideration of the ambiguities in Section 3. Corollary 1: _The sign of \(V_{y}\) of the sensor response \(\bar{V}\) with respect to the global frame \(\{G\}\) depends only on the half plane \(z>0\) or \(z<0\) in which the sensor is located._  
Consequently, both solutions are always in the same half plane. By Theorem 2, one lies in \(y<0\) and the other in \(y>0\). An example is given in Figure 7, which shows the solutions as bold dots. Since both points must be in areas with the same direction of the magnetic field lines to satisfy Equation (12), one is outside the circle and one is inside. Of the two remaining sensor positions that match \(\bar{V}\), one must still be excluded. By considering only a single sensor, it is impossible to determine the correct one. However, in the following, multiple sensors are considered instead, which provide much more information through which a whole set of correct sensor positions can be selected. The idea is as follows. On the one hand, the user-defined positions \(\vec{p}_{i0}\) of \(N\) sensors form an original polygon in the \(yz\)-plane of the UAV frame \(L_{u}\). It has a fixed geometric structure \(S_{u}\) like a fingerprint. On the other hand, the two positions \(\vec{p}_{i1,2}\) computed for each sensor can now be combined into \(2^{N}\) polygons in the global frame \(\{G\}\). Finally, the one that matches the structure \(S_{u}\) is selected. Therefore, before comparison, each polygon must be transformed back to \(L_{u}\) using Equation (4). However, this is not possible since the UAV position \(\vec{p}_{D}\) must already be known for this. One way around this problem is to choose a different reference point. For example, all polygons are shifted so that their upper left corner appears in the origin of \(\{G\}\) before comparison. What is important here is that the original polygon is first transformed to \(\{G\}\). Its new geometric structure \(S_{G}\) can be computed using the known UAV orientation and \(\vec{p}_{i0}\) via Equation (4) with \(\vec{p}_{D}=\vec{0}\). Then, its upper left corner is moved to the origin. The other polygons obtained from the sensor measurements are already representations with respect to \(\{G\}\), so their upper left corner only needs to be shifted to the origin. The shift is allowed since it does not affect the polygon geometry. Finally, the comparison can be done using the least- squares estimation. Here, the deviation of the corresponding polygon nodes is squared and added up. The  
Figure 7: Two remaining positions of a sensor. polygon with the smallest sum best fits \(S_{G}\) and is selected. From each of its nodes, the UAV position \(\vec{p}_{D}\) can then finally be computed using Equation (4). It is recommended to place the sensors in the \(yz\)-plane of \(L_{u}\) so that they span an area as large as possible. This allows for better polygon detection, since during the aerial manipulation, the roll and pitch angle of the UAV will typically have a rather small misalignment with respect to the global frame \(\{G\}\). The polygon detection method proposed here was successfully tested. The implementation details and test results are presented in Section 4.