# Vehicle-in-the-Loop in Global Coordinates for Advanced Driver Assistance System
## 2 Vehicle in the Loop
### Virtual Environment  
The virtual environment module is the configuration of elements for VIL testing. For example, the advanced emergency brake (AEB) and adaptive cruise control (ACC) controllers relate to surrounding vehicles and pedestrians. For the lane keeping-assist system (LKAS) controllers, the road lines are closely related. In addition, high-level autonomous vehicles are subject to additional elements such as traffic lights, signs and buildings. For optimal classification, we divide these objects into time-invariant (TI) and time-varying (TV) objects. Time-varying objects are further divided into time-varying-pose (TVP) and time-varying-attribute (TVA), depending on what information changes. Table 1 shows each object type and the stored data. Below are examples of each object:  
* TI Object: buildings, signs, roads (lines);
* TVP: vehicles, bicycles, pedestrians;
* TVA: traffic lights. All types of objects have object attribute and pose data. Attribute data have the type, nodes of shape, and additional information of the object. It can be configured differently depending on the characteristics of each object. The pose data contain position and orientation information such as x, y, and yaw. Additionally, z, pitch, and roll can be included, but in this paper, the virtual environment is designed based on the 2D plane. The variables in Tables 2-5 are superscripted with object type and subscripted with variable order. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Type** & **Data** \\ \hline Attribute & \(\text{Building}\Big{(}nx_{1}^{B},ny_{1}^{B}\Big{)}\Big{(}nx_{2}^{B},ny_{2}^{B} \Big{)},\ldots,\Big{(}nx_{k}^{B},ny_{k}^{B}\Big{)}\) \\ Pose & \(x_{0}^{2},y_{0}^{2},\psi_{0}^{B}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Example of a building as the time-invariant object. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Type** & **Data** \\ \hline Attribute & \(\text{Winite-Dot-Line}\Big{(}nx_{1}^{L},ny_{1}^{L},\phi_{1}^{L},\zeta_{1}^{L},D_{ 1}^{L}\Big{)},\ldots,\Big{(}nx_{k}^{L},ny_{k}^{L},\phi_{k}^{L},C_{k}^{L},D_{k}^{ L}\Big{)}\) \\ Pose & \(x_{0}^{2},y_{0}^{2},\psi_{0}^{L}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Example of a vehicle as the time-varying pose object. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Object** & **Time Invariant Data** & **Time Varying Data** \\ \hline T.I. Object & Attribute, Pose & - \\ T.V. Pose-Object & Attribute & Pose \\ T.V. Attribute-Object & Pose & Attribute \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Data of object type. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Type** & **Data** \\ \hline Attribute & \(\text{Winite-Dot-Line}\Big{(}nx_{1}^{L},ny_{1}^{L},\phi_{1}^{L},\zeta_{1}^{L},D_{ 1}^{L}\Big{)},\ldots,\Big{(}nx_{k}^{L},ny_{k}^{L},\phi_{k}^{L},C_{k}^{L},D_{k}^{ L}\Big{)}\) \\ Pose & \(x_{0}^{2},y_{0}^{2},\psi_{0}^{L}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Example of a road line as the time-invariant object. Table 2 indicates that this object is a building. It also has sets of node distances from the object center and the pose (position and orientation) of the object. The shape nodes, where k (\(x_{k}^{B},y_{k}^{B}\)) of the building, can be represented in the following general equation. The object shape node (\(x_{k}\),\(y_{k}\)) can be obtained by using (1), where the center position and the yaw angle of the object are \(x_{0}\), \(y_{0}\) and \(\psi_{0}\), and the set of node distance is (\(nx_{k}\),\(ny_{k}\)), as shown in Figure 3.  
\[\left[ \begin{array}{c}x_{k}\\ y_{k}\end{array} \right]=\left[ \begin{array}{c}x_{0}\\ y_{0}\end{array} \right]+\left[ \begin{array}{cc}cos(-\psi_{0})&-sin(-\psi_{0}) \\ sin(-\psi_{0})&cos(-\psi_{0})\end{array} \right]\left[ \begin{array}{c}nx_{k}\\ ny_{k}\end{array} \right] \tag{1}\]  
The road line object in Table 3 contains not only line style and node distances but also the angles (\(\theta_{k}^{L}\)) from the original angle, curvature (\(C_{k}^{L}\)) and curvature derivative (\(D_{k}^{L}\)) of each point k of line.