# Vehicle Rollover Warning and Control Based on Attitude Detection and Fuzzy PID
## 2 Vehicle Dynamics Modeling  
### Vehicle Rollover Dynamics Model  
To design a vehicle anti-rollover control strategy, a vehicle rollover dynamics model needs to be established. Considering the control efficiency and control accuracy, the established dynamic model includes 3-DOF: longitudinal, transverse pendulum, and lateral motions. The established coordinate system is illustrated in Figure 1.  
According to D'Alembert's principle, the equation of force balance along the \(y\)-axis is as follows:  
\[(m-m_{s})\Big{(}\omega_{r}+\hat{\beta}\Big{)}v+m_{s}\Big{[}\Big{(}w_{r}+\hat{ \beta}\Big{)}v-h\dot{p}\Big{]}=-\big{(}F_{y1}+F_{y2}\big{)}, \tag{1}\]  
And can be simplified as  
\[\Big{(}\omega_{r}+\hat{\beta}\Big{)}mv-m_{s}h\dot{p}=-\big{(}F_{y1}+F_{y2} \big{)}, \tag{2}\]  
where \(m\) denotes the overall vehicle mass, kg; \(m_{s}\) denotes the spring mass, kg; \(\beta\) indicates the lateral deflection angle; \(\omega_{r}\) refers to the angular velocity of the transverse sway; \(h\) indicates the difference between the heights of the center of mass on the spring and the center of lateral camber of the vehicle; \(p\) indicates the lateral camber velocity; and \(F_{y1}=2k_{f}\delta_{1}\) and \(F_{y2}=2k_{r}\delta_{2}\) represent the lateral forces of the front and rear wheels. \(k_{f}\) and \(k_{r}\) denote the lateral deflection stiffness of the front and rear wheels, N/rad; \(\delta_{1}\) denotes the effective side deflection angle of the front wheels (including the side deflection angle of the front tires and the elastic deformation of the front suspension and steering system); \(\delta_{2}\) denotes the effective lateral deflection angle of the rear wheels (including the lateral deflection angle of the rear tires and the elastic deformation of the rear suspension). Moment balance equation along the \(z\)-axis:  
\[I_{z}\dot{\omega}_{r}+I_{xz}\dot{p}=-aF_{y1}+bF_{y2}, \tag{3}\]  
where \(I_{z}\) represents the rotational inertia of the \(z\)-axis of the vehicle, kg\(\cdot\)m\({}^{2}\); \(I_{xz}\) indicates the inertia product of the mass on the spring around the x and z axes, kg\(\cdot\)m\({}^{2}\); \(a\) and \(b\) denote the distances from the center of gravity of the vehicle to the front and rear axes, m.  
Moment balance equation along the \(x\)-axis:  
\[I_{x}\dot{p}-m_{s}h\Big{[}\Big{(}\omega_{r}+\hat{\beta}\Big{)}v-hp\Big{]}+I_{ xz}\dot{\omega}_{r}=-\Big{(}D_{f}+D_{r}\Big{)}p-\big{(}C_{\phi 1}+C_{\phi 2}-m_{s}hg \big{)}\phi \tag{4}\]  
where \(I_{x}\) represents the rotational inertia of the mass on the spring about the \(x\)-axis, kg\(\cdot\)m\({}^{2}\); \(v\) denotes the vehicle speed; \(D_{f}\) and \(D_{r}\) denote the front and rear suspension lateral camber damping; \(\phi\) symbolizes the body roll angle; \(C_{\varphi 1}\) and \(C_{\varphi 2}\) denote the front and rear lateral camber rigidity. According to the relationship between the front-wheel angle and lateral force,  
\[F_{y1}=k_{f}\delta_{1} \tag{5}\]  
Figure 1: Generalized coordinates of automobile movement. (**a**) Vertical view; (**b**) Rear view. \[F_{y2}=k_{r}\delta_{2} \tag{6}\]  
According to the corner geometry,  
\[\delta_{1}=\beta+\frac{a}{v}\omega_{r}-E_{f}\phi-\delta \tag{7}\]  
\[\delta_{2}=\beta-\frac{b}{v}\omega_{r}-E_{r}\phi \tag{8}\]  
where \(\delta\) denotes the nominal front-wheel deflection angle (excluding the elastic deformation of the suspension and steering system and the front-wheel deflection angle corresponding to the steering wheel). Substituting into Equations (1)-(3) yields:  
\[\left\{ \begin{aligned} & I_{z}\overset{\bullet}{\omega_{r}}+I_{xz} \overset{\bullet}{p}=N_{\omega_{r}}\omega_{r}+N_{\beta}\beta+N_{\varphi}\varphi +N_{\delta}\delta,\\ & mv(\omega_{r}+\beta)-m_{s}h\overset{\bullet}{p}=Y_{\omega_{r}},\omega_{r}+Y_{\beta}\beta+Y_{\varphi}\varphi+Y_{\delta}\delta,\\ & I_{x}\overset{\bullet}{p}-m_{s}hv\left(\omega_{r}+\overset{ \bullet}{\beta}\right)+I_{xz}\overset{\bullet}{\omega_{r}}=L_{p}p+L_{\varphi }\varphi,\end{aligned} \right.