## 3 System Design and Implementation
### Trajectory Planning (Clockwise)  
When planning the trajectory, a distinction must first be made as to whether the start and finish circles are traversed in the same or opposite directions. First, the case where the circles are traversed in the same direction is considered. The geometric conditions for clockwise trajectory planning are shown in Figure 2. Clockwise means that the circles are traversed clockwise. However, shorter trajectories may arise due to a counterclockwise rotation. The controller must determine this on a case-by-case basis. The circle's radius \(r\) is specified before the calculation. Normally, a radius is selected that is slightly larger than the minimum radius that can be driven, so that the orientation control still has some reserve to compensate for disturbances. Figure 2: Sketch of the trajectory (clockwise). In the following considerations, the x-axis is defined as the reference axis. This means that the angle of this axis is 0\({}^{\circ}\). However, it should be noted that this does not correspond to the software implementation, as the reference axis is the y-axis because it points north. However, it can be calculated back and forth between these reference systems by simply adding or subtracting 90\({}^{\circ}\). First, the start and end points, the orientations at these points, and the drivable circle radius \(r\) are known. The centers of the start and finish circles must first be determined. The orientations \(\varphi\) describe the tangential direction of the associated circle in the associated points. Each of these points lies on the corresponding circle. The normal direction of the circle can now be determined from the tangential direction by rotating the tangent by 90\({}^{\circ}\). The conditions are derived here at the starting point \(S\). The tangent direction at this point is as follows:  
\[\overrightarrow{T_{S}}=(\cos\!\phi_{S}\quad\text{sin}\phi_{S}) \tag{1}\]  
To maintain the normal, the tangent is rotated 90\({}^{\circ}\) in the mathematically positive sense (counterclockwise). This is a 2D rotation matrix \(R(\varphi)\). \[R_{(\varphi)}= \begin{pmatrix}\cos\!\phi&-\text{sin}\phi\\ \text{sin}\phi&\cos\!\phi\end{pmatrix}  \tag{2}\]  
Results for a rotation angle of \(\varphi=90^{\circ}\):  
\[R_{(90^{\circ})}= \begin{pmatrix}0&-1\\ 1&0\end{pmatrix}  \tag{3}\]  
Applying this matrix to the tangent at the starting point, we obtain the normal  
\[\overrightarrow{N_{S}}=\overrightarrow{T_{S}}\cdot R_{(90^{\circ})}=(\cos\! \phi_{S}\quad\text{sin}\phi_{S})\cdot \begin{pmatrix}0&-1\\ 1&0\end{pmatrix} =(-\text{sin}\phi_{S}\quad\text{cos}\phi_{S}) \tag{4}\]  
The normal \(N_{s}\) has the length 1, i.e., it is already normalized. Now, the circle will go through to the right, which corresponds to a mathematically negative direction, so the circle's center point \(M_{1}\) of the reset circuit is in exactly the opposite direction of a normal vector \(N_{s}\) at a distance of radius \(r\) from the starting point, and \(S\) is calculated. Accordingly, the circle center point \(M_{1}\) of the reset circuit is as follows:  
\[\overrightarrow{M_{1}}=\overrightarrow{S}-r\cdot\overrightarrow{N_{S}}=(S_ {x}\quad S_{y})+r\cdot(\text{sin}\phi_{S}\quad-\text{cos}\phi_{S}) \tag{5}\]  
All of these considerations apply by analogy to the target circle. There is the center of the circle at a right turn to \(M_{2}\):  
\[\overrightarrow{M_{2}}=\overrightarrow{Z}-r\cdot\overrightarrow{N_{Z}}=(Z_ {x}\quad Z_{y})+r\cdot(\text{sin}\phi_{Z}\quad-\text{cos}\phi_{Z}) \tag{6}\]  
Now, the connection vector between the two circle center points \(M_{1}\) and \(M_{2}\) is required.