## 2 Robot Control System
### Large-Scale Surface Orthogonal Motion Planning
#### 2.3.4 Positioning of the Mobile Platform  
The mobile platform must be positioned in such a way that the surface orthogonal planned path of the end effector lies in a workspace region with high reachability. The method used to determine the characteristics of the manipulator's workspace is described in [29]. The size of the chosen suitable area of the manipulator workspace directly affects the segmentation of the workpiece in local subsegments. The workpiece segmentation consists of the following steps:  
1. Create the scanning grid accordingly to the workpiece size (see Figure 9a);
2. Project the scanning grid onto the surface of the workpiece (see Figure 9b);
3. Reflect the projected points alongside the surface normal (see Figure 9c); and
4. Cluster the reflected points into processable local scan areas (see Figure 9d). The reflected points represent positions of the manipulator's end-effector. The aim of the workpiece segmentation is to find a set of neighbored projected points, whereby the corresponding reflected points are inside the defined workspace of the manipulator. Therefore, a list of position tuples \(\Lambda_{PR}\) is created, whereby each tuple consists of a projected point and the corresponding reflected point. By continuously expanding in the domain of the projected points and checking the reachability of the correspo  
Figure 9: Process of workpiece segmentation. (**a**) Scanning grid; (**b**) projection onto surface; (**c**) reflection alongside surface normal; (**d**) clustering into local scan areas. the tuples of list \(\Lambda_{PR}\) are clustered into suitable local scan areas. The implemented method is described in detail in Algorithm 3. ```
1:function segmentWorkpiece(CADModel \(\Psi\), Workspace \(Y\), Distance \(d\), ClusterList \(\Lambda_{PR}\))
2: create sampling grid \(S\) accordingly to 3D bounding box size of \(\Psi\)
3: project grid points \(s_{i}\in S\) onto surface of \(\Psi\)
4: reflect projected points alongside the corresponding surface normal to distance \(d\) from surface of \(\Psi\)
5: create a list \(L_{PR}\) with corresponding pairs of projected and reflected points
6: ascendingly order \(L_{PR}\) based on Euclidean distance between projected point and workpiece frame \(I\)
7:while\(L_{PR}\) not empty do
8: initialize empty cluster \(C_{PR}\)
9: add position pair at first position of \(L_{PR}\) to \(C_{PR}\) and remove pair from \(L_{PR}\)
10: initialize filter dimensions
11: set current search direction to \(I_{x}\)-direction
12: while not all search directions are exhausted do
13: extend filter in search direction
14: if filter dimension is beyond the bounding box of \(\Psi\)then
15: mark current search direction as exhausted
16: reset filter dimensions
17: end if
18: find all position pairs \(L_{i}\) in \(L_{PR}\) where the reflected point is inside filter bounds
19: calculate bounding box dimension \(B\) of all reflected points \(\epsilon\)\(L_{i}\)
20: if\(B\subseteq Y\)then
21: add \(L_{i}\) to \(C_{PR}\) and delete \(L_{i}\) from \(L_{PR}\)
22: else
23: reset filter dimension
24: mark search direction as exhausted
25: end if
26: switch search direction
27: end while
28: add \(C_{PR}\) to \(\Lambda_{PR}\)
29: end while
30: end function
```  
**Algorithm 3** Segmentation of the workpiece into subsegments  
The mobile platform is positioned in such a way that the center of the calculated scan area \(l_{i}=\left(x_{I},y_{I}\right)^{T}\) is located at the center of the system's reachable workspace \(r_{i}=\left(x_{R},y_{R}\right)^{T}\). Therefore, the centers \(c_{i}\) are translated alongside the x-axes of the workpiece coordinate system \(I\). Depending on the approach direction of the mobile platform, the translation is performed in \(x^{+}\)- or \(x^{-}\)-direction. The shifted positions \(l_{i}^{s}\) are converted into 2D poses \(L_{i}=\left(x_{I},y_{I},\theta_{I}\right)^{T}\) by adding an orientation accordingly to the translation direction.