# Event-Based Path-Planning and Path-Following
## 3 Two-Level Control System
### Event-Based Path-Planning
#### 3.3.1 Discrete-Event System
\begin{table}
\begin{tabular}{c l l} \hline \hline
**Name** & **Description** & \\ \hline mS & Starting the mission \\ mPF & Following the reference path \\ mDOL & Detouring the selected obstacle from its left side \\ mDOR & Detouring the selected obstacle from its right side \\ mNRF & Navigation to the reference path \\ mSOL & Searching for an obstacle on the left \\ mSOR & Searching for an obstacle on the right \\ mMC & Mission completed \\ \hline \hline \end{tabular}
\end{table} 
Table 1: States of the discrete-event system (DES). \begin{table}
\begin{tabular}{c l l} \hline \hline
**Name** & **Triggering Condition** & **Description** \\ \hline eOAVC & \(I_{A}(\rho_{i}<\rho_{\text{rec}})\
eq\emptyset\) & An obstacle ahead is very close \\ eOAN & \(I_{A}(\rho_{i}<\rho_{n})\
eq\emptyset\) & An obstacle ahead is near \\ eNOLN & \(I_{L}(\rho_{i}<\rho_{f})=\emptyset\) & There are no obstacles nearby on the left \\ eNORN & \(I_{R}(\rho_{i}<\rho_{f})=\emptyset\) & There are no obstacles nearby on the right \\ eOLVC & \(I_{L}(R^{i}_{\text{max}}<R_{\text{min}})\
eq\emptyset\) & An obstacle on the left is very close \\ eOLN & \(I_{L}(R^{i}_{\text{max}}<R_{\text{min}}+\Delta R)\
eq\emptyset\) & An obstacle on the left is near \\ eOLF & \(I_{L}(R^{i}_{\text{max}}<R_{\text{min}}+\Delta R)=\emptyset\) & There are no obstacles on the left that are nearby \\ eOLKPN & \(I_{L}(R^{i}_{\text{max}}<R_{\text{min}}+\Delta R\)\) & An obstacle to the left of the KP direction is near \\  & \(a_{i}\leq a_{K})=\emptyset\) & An obstacle on the right is very close \\ eORVC & \(I_{R}(R^{i}_{\text{max}}<R_{\text{min}})\
eq\emptyset\) & An obstacle on the right is near \\ eOLN & \(I_{R}(R^{i}_{\text{max}}<R_{\text{min}}+\Delta R)\
eq\emptyset\) & There are no obstacles on the right that are nearby \\ eORF & \(I_{R}(R^{i}_{\text{max}}<R_{\text{min}}+\Delta R\) & An obstacle to the right of the KP direction is near \\ eORKPN & \(\left|\gamma_{j_{i}}\right|>\tau/2\) & The current WP of the RP is located behind the AUV \\ eWPL & \(\gamma_{j_{i}}\leq 0\) & The current WP is located to the left of the AUV \\ eWPR & \(\gamma_{j_{i}}>0\) & The current WP is located to the right of the AUV \\ eWWPBN & \(\sum_{j=j_{i}}^{j_{i}+n_{u}}\gamma_{j}\leq 0\) & The weighted WP relative bearing angle is negative \\ eWPPN & \(\phi_{j_{i}}<=0\) & Angle to the WP direction vector is negative \\ eWPDP & \(\phi_{j_{i}}>0\) & Angle to the WP direction vector is positive \\ eRRPL & \(t_{pm}>t_{mp}\) & The AUV is returning to \(\mathcal{P}_{ref}\) after the left detouring \\ eRRPR & \(t_{pm}<t_{mp}\) & The AUV is returning to \(\mathcal{P}_{ref}\) after the right detouring \\ eRPSN & \(\rho^{RP}<\rho_{n}^{RP}\) & The reference path segment is near in the heading direction \\ eEP & & The VT has reached the end of the current path \\ eES & & The VT has reached the end of the current segment \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Events of the DES. The AUV behavior strategy that is provided by the DES can be expressed, as follows. * Try not to get to a place where it is impossible to get out using standard obstacle avoidance algorithms. * Do not change once chosen obstacle avoidance direction until the AUV returns to the reference path (left or right-hand rule). * Rebuild the path only if it is vital. In the DES states that are associated with obstacle avoidance (mDOL, mSOR, mDOR, and mSOL), monitoring atomic events eRRPL and eRRPR (see Table 3) prevents the AUV from prematurely returning to the reference path, which may happen when the obstacle has a U-shape.