## 3 VRDeepSafety Simulation Environment
### Mathematical Model of VRDeepSafety
#### 3.5.1 Vehicle Dynamics  
To accurately simulate AVs motion within the VRDeepSafety environment, we model the vehicle's state using a state vector, \(\mathbf{x}(t)\). This vector is crucial, as it provides all the necessary information for the simulation to accurately model the vehicle's motion and make predictions about future states. The state vector is defined as follows:  
\[\mathbf{x}(t)=\left[\begin{array}{cccc}x(t)&y(t)&\theta(t)&v(t)&a(t)\end{array} \right]^{\top}, \tag{2}\]  
where \(x(t)\) and \(y(t)\) represent the vehicle's position in a two-dimensional Cartesian plane (x-lateral, y-forward), \(\theta(t)\) denotes the vehicle's heading angle, \(v(t)\) represents the linear velocity, and \(a(t)\) represents the linear acceleration. This vector captures the dynamic state of the vehicle at a given time \(t\), which is essential for accurate simulations and predictions within VRDeepSafety.  
The vehicle's motion within the VRDeepSafety environment is governed by non-linear differential equations that describe its response to steering and acceleration inputs. These equations are defined as follows:  
\[\begin{array}{l}\dot{x}(t)=v(t)\cdot\cos(\theta(t))\\ \dot{y}(t)=v(t)\cdot\sin(\theta(t))\\ \dot{\theta}(t)=\frac{v(t)}{L}\cdot\tan(\phi(t))\\ \dot{v}(t)=\alpha(t)\\ \dot{v}(t)=u_{a}(t)\end{array} \tag{3}\]  
where L is the vehicle's wheelbase, \(\phi(t)\) is the steering angle, and \(u_{a}(t)\) is the acceleration control input. The equations \(\dot{x}(t)\) and \(\dot{y}(t)\) calculate the change in the vehicle's Cartesian position. The equation \(\dot{\theta}(t)\) describes the rate of change in the heading. The equation \(\dot{\theta}(t)\) describes the rate of change in the heading based on the steering angle, simulating vehicle turning. The equations \(\dot{v}(t)\) and \(\alpha(t)\) describe how the acceleration changes the velocity of the vehicle.  
The equation for \(\dot{\theta}(t)\) arises from Ackermann steering geometry, a kinematic model where the front wheels steer. This model ensures no wheel slippage when turning. The non-linear trigonometric functions, \(\cos(\theta(t))\) and \(\sin(\theta(t))\), show that small changes in steering or velocity greatly impact the vehicle's path, affecting control stability and path tracking. This kinematic model is used within VRDeepSafety to accurately represent how vehicles move and respond to steering inputs.  
Figure 2 illustrating Ackermann steering geometry. The vehicle's position \((x,y)\) is defined by its center of gravity (CG) in the \(X-Y\) coordinate system. The heading (\(\theta\)) is the angle between the longitudinal axis (blue arrow) and the X-axis. Ackermann steering ensures no tire slippage by having the inner (\(\phi_{i}\)) and outer (\(\phi_{0}\)) front wheels rotate around a common instantaneous center of rotation (ICR--purple dot), connected by red lines. The turning radius (R--solid red line) is the ICR-CG distance. The wheelbase (L--green double arrow) is the inter-axle distance. The dotted gray arc depicts the vehicle's path. This geometry is essential for accurate kinematic modeling in VRDeepSafety. We simplify the model using an average steering angle (\(\phi\)) as in Equation (3), where the heading rate \((\dot{\theta}(t))\)depends on speed \((v(t))\), wheelbase \((L)\), and steering angle \((\phi(t))\). This simplification enables efficient computation without losing core kinematic characteristics.