# Avoiding Obstacles via Missile Real-Time Inference by Reinforcement Learning
## 2 Missile Dynamics and Environment Modeling
### Missile Seeker Modeling
#### 2.4.1 Seeker for Scenario A  
For seekers for scenario A, we modeled the obstacle detector with a simple algorithm using the geometry shown in Figure 5, where lines \(\overline{B_{0}B_{1}}\), \(\overline{B_{0}B_{2}}\), \(\overline{B_{0}B_{3}}\), \(\overline{B_{0}B_{4}}\), and \(\overline{B_{0}B_{5}}\) represent the beam for distance acquisition. \begin{table}
\begin{tabular}{c c c c} \hline \(\mathbf{\Lambda_{M_{i}}\ [m]}\) & \(x_{M_{i}}\ [m]\) & \(y_{M_{i}}\ [m]\) & \(\sigma_{M_{i}}\) \\ \hline \([0,400]\) & \([-3000,3000]\) & \([-5000,5000]\) & \([5\times 10^{5},10^{6}]\) \\ \hline \end{tabular}
\end{table} 
Table 4: Parameters of mountainous environment. Figure 4: Three-dimensional visualization of terrain environment. In Table 5, \(\overline{B}\) is the maximum sensing distance, which is the length of a 2D obstacle detector segment line and \(\zeta\) is the angle displacement from the center beam to the most outer beam. Each tip \(B_{i}\) is defined as Equations (15) and (16):  
\[n_{m}\in\left\{n\middle|\frac{n_{beam}}{2}<\frac{n_{beam}}{2}+1,\ n\in\mathbb{Z}\ \right\} \tag{15}\]  
\[B_{i}=C_{b}^{n}\cdot C\left(z,\frac{2\zeta(n_{m}-\iota)}{n_{beam}-1}\right) \cdot\binom{10^{4}}{0} \tag{16}\]  
where \(n_{beam}\) is the quantity of beams which is an odd number. Each beam can be modeled as an equation of line. The equation of a line having two dots \((x_{1},y_{1})\) and \((x_{2},y_{2})\) on the line is as follows:  
\[y-y_{1}=\left(\frac{y_{2}-y_{1}}{x_{2}-x_{1}}\right)(x-x_{1})=m(x-x_{1}) \tag{17}\]  
Furthermore, this equation can be used for modeling the line of obstacle rectangles. Suppose an obstacle rectangle \(d\) with line segments \(\overline{v_{1}^{d}v_{2}^{d}}\), \(\overline{v_{2}^{d}v_{3}^{d}}\), \(\overline{v_{3}^{d}v_{4}^{d}}\), and \(\overline{v_{4}^{d}v_{1}^{d}}\). Then, the intersection with a line extending from segment \(\overline{v_{k}^{d}v_{l}^{d}}\) with slope \(m_{v}^{d}\) and a beam line extended from segment \(\overline{B_{0}B_{i}}\) with slope \(m_{B}\) is as follows:  
\[p_{i-kl}^{d}= \begin{pmatrix}-m_{v}^{d}&1\\ -m_{B}&1\end{pmatrix} ^{-1} \begin{pmatrix}-v_{ky}^{d}-m_{v}^{d}v_{kx}^{d}\\ -B_{iy}-m_{B}B_{ix}\end{pmatrix}  \tag{18}\]  
Thus, the set of the whole intersection of beam line extended from segment \(\overline{B_{0}B_{i}}\) with all lines extended from line segments of all obstacles are as follows:  
\[I=\bigcup_{d=1}^{n_{O}}\left(\bigcup_{\{k,l\}\subset\{1,2,3,4\}}p_{i-kl}^{d}\right) \tag{19}\]  
Figure 5: Obstacle detector model. \begin{table}
\begin{tabular}{c c} \hline \(\overline{B}\) **[m]** & \(\xi\) **[rad]** \\ \hline
10,000 & \(\pi/6\) \\ \hline \end{tabular}
\end{table} 
Table 5: Initial value for the beam formation. The \(i\)th order of the pair is lined up by ascending order for the value of \(\bar{\theta}\) at first, then by ascending order for the value of \(\bar{\psi}\). \[\Phi=\bigcup\limits_{ \begin{subarray}{c}\bar{\psi}\in\{-\bar{\psi}_{B_{o}}-\bar{ \psi}_{B_{o}}/2,0,\bar{\psi}_{B_{o}}/2,\bar{\psi}_{B}\}\\ \bar{\theta}\in\{-\bar{\theta}_{B_{o}},\bar{\theta}_{B_{o}}\}\end{subarray} } \left(\bar{\psi},\bar{\theta}\right) \tag{24}\]  
Then, the direction vector of the \(i^{\text{th}}\) beam on the body frame and that on the inertial frame are as follows:  
\[\hat{B}^{b}=C_{\bar{\rho}_{i}}^{b}\cdot\left(1\quad 0\quad 0\right)^{T} \tag{25}\]  
\[\hat{B}=C_{b}^{n}\cdot\hat{B}^{b} \tag{26}\]  
We have used the algebraic method to obtain the distance of the 2D obstacle environment. However, this is not a good method to obtain distances to obstacles of the environment of scenario B. The obstacles of scenario B are formulated with non-linear complicated formula Equation (14), so the computation is not simple, unlike the planar scenario. Thus, here we obtain the distance to the terrain reflection \(D\) by the Algorithm 1 in a numerical way.