## 3 Orientation Controller Design
### Description of the Remaining Nonlinearities  
The remaining elements in the orientation-control-loop block diagram shown in Figure 4 are now described. The red steering box represents a mathematical model describing the steering servo and mechanism. First, the servo motor receives a discretized signal by the microcontroller's values. The actuating signal consists of a pulse with a length of between one and two milliseconds and is repeated every twenty milliseconds. The microcontroller rasterizes this signal to a total of 256 steps. Accordingly, the signal is quantized in a 3.9 \(\upmu\)s grid. The quantizer, which also works as a limiter, is responsible for this in the signal flow diagram. The control signal from the servo motor consists of the desired steering angle, which is transformed into the PWM signal via the experimentally found stateless relationship.  
The transfer function \(G_{5}(s)\), which describes the steering dynamics, and the steering play have already been explained. Steering is followed by the single-track model, which is intended to mathematically describe the robot's behavior as a simple vehicle. In principle, it consists of the function that describes the relationship between the steering angle \(\delta\) and the change in orientation \(\frac{d\phi}{dt}\). Finally, the orientation change \(\frac{d\phi}{dt}\) is integrated, considering the initial conditions to obtain the absolute orientation.  
The robot orientation is measured using the magnetometer. It measures the Earth's magnetic field and uses this to calculate the robot's angle relative to the Earth's magnetic north pole. Currently, only the X and Y channels are evaluated using the magnetometer. They are arranged orthogonally to each other and lie in the plane. Therefore, the X channel measures the cosine, and the Y channel measures the sine of the orientation angle \(\phi\). The magnetometer does have automatic angle determination with drift and tilt compensation, but this only works if the magnetometer is still. Therefore, the raw measured values of the magnetic field strengths are evaluated. Each measuring channel has an offset error. In addition, the sensitivities of both channels are slightly different. The offset amp symbols represent this. The offset errors can be eliminated with suitable calibration, and the sensitivities can be adjusted. The orientation is again calculated via the arctangent 2 function and finally quantized based on digital technology. Unfortunately, when determining the orientation of the Earth's magnetic field, one has to consider that it is very weak and easily disturbed by other magnetic fields. These include permanent magnets and electromagnets.  
Furthermore, ferrous objects strongly deform the course of the magnetic field. In the corridor of the university building, the measured angle changes reproducibly at the same point by up to 20\({}^{\circ}\) on a straight line. Of course, this makes the magnetometer measurement very inaccurate. Added to this are the remanence effects of the sensors, whose offset adjustments can only eliminate. It must also be mentioned that there is currently no way to record the steering angle of the front wheels directly, as there is no steering angle sensor. The steering angle can, therefore, only be estimated using the magnetometer readings.