# Parameterization and Design of Telepresence Robot to Avoid Obstacles
## 3 System Design and Implementation  
The focus moves in a linear function of the target position between the robot's orientation at the start of the trajectory and orientation. The following values given in Table 1 are of particular importance:  
\[OriScale=\frac{TargetOri-StartOri}{TargetPos} \tag{1}\]  
where this is an angle that must be in the interval \([-\gamma;\pi]\). It is, therefore, possible to use modulo \(2\pi\) arithmetic.  
The simulated orientation finally calculates to:  
\[\theta_{\phi_{(t)}}=StartOri+OriScale\text{-}\phi_{(t)}. \tag{2}\]  
As already mentioned, the simulated position and orientation values serve as setpoints for the position and orientation controller, where \(\phi_{(t)}\) represents the target position, which is the integration of the target speed. The position controller is implemented as a proportional-integral-derivative (PID) controller with anti-wind-up feedback. On the other hand, the orientation controller controls based on the distance covered, so a proportional-integral (PI) controller with a variable time base is selected here.  
In addition to pure position and orientation control, there is obstacle detection and avoidance. It is superimposed on the two controllers and intervenes in the event of an impending collision with an obstacle. The two controllers are frozen because the robot must correct its course after avoiding an obstacle and stops first.  
The above-described state machine for avoiding obstacles is shown in Figure 2. If the front sensors detect an obstacle too close, the trajectory run can no longer be continued. Therefore, the robot first stops as fast as the speed controller allows. Then the robot slowly drives backwards for 6 s with the steering turned to the maximum. The steering direction depends on which sensor detected the obstacle. In case the left front sensor detects the obstacle, the wheels are turned to the left; otherwise, the wheels are turned to the right. If one of the rear sensors detects an obstacle, the robot remains standing until the obstacle disappears. For a fixed obstacle, the robot will no longer drive backwards.  
\begin{table}
\begin{tabular}{l l} \hline \hline
**Values** & **Meaning** \\ \hline _StartOri_ & Robot orientation at the start of the trajectory \\ \hline _TargetOri_ & Robot orientation trajectory target \\ \hline _TargetPos_ & Arc length of the moving trajectory \\ \hline _OriScale_ & Scaling the orientation difference between the start and end concerning the arc length of the trajectory \\ \hline \hline \end{tabular}
\end{table}
Table 1: Important parameters of calculation.  
If an obstacle rushes by, reverse travel is continued after the obstacle has disappeared. It must be remembered that the robot only forgets nearby obstacles after a second. After the time has elapsed, the robot slowly drives straight ahead unless a nearby obstacle is detected by at least one of the front sensors. Otherwise, the robot remains standing, just like when reversing. After 6 s, it is checked whether at least one of the front sensors detects a nearby obstacle. If so, the evasive maneuver described begins again from the beginning. Otherwise, the robot stops and reports to the mini-computer that it has successfully avoided an obstacle. It must then supply new target data, regulation of position and orientation, obstacle detection and avoidance.