# Avoiding Obstacles via Missile Real-Time Inference by Reinforcement Learning
## 2 Missile Dynamics and Environment Modeling
### Environment Modeling  
#### 2.3.1 Environment Modeling for Scenario A  
The environment for scenario A contains obstacles as shown in Figure 2. The missile is launched from the coordinate origin and obstacles are formulated inside sector B between sector A and sector C. Sector A is an arc with a radius of 1000 m and Sector B is the area beyond sector A surrounded by an arc with a radius equal to the distance between the missile and the target. Sector C is an open space beyond the target. Table 1 shows the numerical intervals for the parameters related to the target position and missile speed. In Table 1, \(\left|R_{T_{0}}\right|\) is the initial distance between the missile and the target, \(L_{0}\) is the missile initial look angle to the target, \(\Phi_{0}\) is the initial line of sight angle to the target, and \(V_{m}\) is the speed of the missile, respectively. The numerical values for the parameters are randomly selected within these numerical intervals. Obstacles are modeled as rectangles. Ships are modeled as one rectangle and islands are modeled as multiple rectangles. The numerical intervals of various parameters for the rectangular geometry are given in Table 2.  
In Table 2, \(R_{Ob}\) is the distance between the coordinate origin and the center of an obstacle, \(\phi_{Ob}\) represents heading toward the center of an obstacle from the coordinate origin, \(\Gamma\) (height/width) is the aspect ratio of a rectangle, \(l\) is the length of the main line (line parallel to the x axis when the yaw angle of the rectangle \(\kappa\) is zero), and \(n_{O}\) represents the number of all the rectangles in the environment, respectively. The target is also modeled as a rectangle, and the parameters are as shown in Table 3. \begin{table}
\begin{tabular}{c c c c} \hline \hline \(\left|R_{T_{0}}\right|\) **[m]** & \(L_{0}\) **[rad]** & \(\phi_{0}\) **[rad]** & \(V_{m}\) **[m/s]** \\ \hline \(\left[5000,10,000\right]\) & \(\left[\frac{-\pi}{2},\frac{\pi}{2}\right]\) & \(\left[0,2\pi\right]\) & \(\left[200,400\right]\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Target position and missile speed for scenario A. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline \(R_{Ob}\) **[m]** & \(\phi_{Ob}\) **[rad]** & \(\Gamma\) & \(I\) **[m]** & \(\kappa\) **[rad]** & \(n_{O}\) \\ \hline \(\left[10^{3},\left|R_{T_{0}}\right|\right]\) & \(\left[0,\pi\right]\) & \(\left[\frac{1}{3},3\right]\) & \(\left[60,400\right]\) & \(\left[0,\frac{\pi}{2}\right]\) & \(\left[0,60\right]\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: The rectangle parameters. Figure 2: Geometry of the planar environment. In Figure 3, \(P_{out}\) and \(P_{in}\) are a set of points outside and inside of obstacles, respectively. For any point in sector B, it needs to be determined whether it belongs to an obstacle or not. The determination algorithm starts from getting the vertices of an obstacle as follows:  
\[v_{c}= \begin{bmatrix}R_{Ob}\cos\phi_{Ob}\\ R_{Ob}\sin\phi_{Ob}\end{bmatrix}  \tag{9}\]  
\[C_{O}^{n}= \begin{bmatrix}\cos\kappa&-\sin\kappa\\ \sin\kappa&\cos\kappa\end{bmatrix}  \tag{10}\]  
\[M= \begin{bmatrix}v^{\prime}{}_{1}&v^{\prime}{}_{2}&v^{\prime}{}_{3}&v^{\prime }{}_{4}\end{bmatrix} \]  
\[=C_{O}^{n} \begin{bmatrix}\dfrac{l}{2}&-\dfrac{l}{2}&-\dfrac{l}{2}&\dfrac{l}{2 }\\ \dfrac{\Omega}{2}&\dfrac{\Omega}{2}&-\dfrac{\Omega}{2}&-\dfrac{\Omega}{2} \end{bmatrix}  \tag{11}\]  
\[M= \begin{bmatrix}v_{1}&v_{2}&v_{3}&v_{4}\end{bmatrix} =M^{\prime}+ \begin{bmatrix} v_{c}&v_{c}&v_{c}&v_{c}\end{bmatrix}  \tag{12}\]  
The column of matrix \(M^{\prime}\) consists of coordinates of vertices of a rectangular obstacle relative to its center \(v_{c}\). The column of matrix M, therefore, represents the coordinates of vertices of the obstacle. The method for determining whether an arbitrary point \(p_{a}\) belongs to \(P_{out}\) or \(P_{in}\) is as follows:  
\[