## 3 Design of Vehicle State Observer
### Vehicle System Equation and Measurement Equation  
For the SCKF algorithm, it needs to be designed based on the discretized vehicle dynamics equation. The corresponding system state equations and measurement equations with additive noise are as follows:  
\[\begin{array}{l}x_{k+1}=f(x_{k},u_{k})+q_{k}\\ y_{k+1}=h(x_{k},u_{k})+r_{k}\\ q_{k}\sim N(0,Q_{k}),r_{k}\sim N(0,R_{k})\end{array} \tag{13}\]  
The state equation function and the observation equation function are denoted by \(f(\cdot)\) and \(h(\cdot)\), respectively, and the state noise \(q_{k}\) and measurement noise \(r_{k}\) are defined as Gaussian white noise with a mean value of 0. The covariance matrices \(Q_{k}\) and \(R_{k}\) calculations are as follows:  
\[\begin{array}{l}E(q_{k}q_{j}^{T})=Q_{k}\Delta_{k-j}\\ E(r_{k}r_{j}^{T})=R_{k}\Delta_{k-j}\end{array} \tag{14}\]  
where the \(\Delta_{k-j}\) is the Kronecker delta function, when \(k=j\Delta=1\), and when \(k\
eq j\Delta=0\). Generally, as a simplification, \(Q_{k}\) is set as a diagonal matrix [25].  
The inertial measurement information, as well as the angular velocity of the in-wheel motors and the angle information of the active steering system, are available directly from the sensors in distributed-drive electric vehicles. The gyroscope and accelerometer in the IMU can directly measure the three-axis acceleration information and yaw rate, and the sensors in Carsim can provide the corresponding measurement information in this simulation. As a result, system inputs include steering wheel angle and four-wheel angular velocity, while system observations vector include vehicle longitudinal and lateral acceleration and yaw rate.  
Vehicle system equation state variables are  
\[x_{k}=\left(V_{x},V_{y},\dot{\psi},a_{x},a_{y},M_{z}\right)^{\mathrm{T}} \tag{15}\]  
where the yaw rate is used as the estimated state in order to make full use of the measurement information.  
The system observation vector is  
\[y_{k}=\left(a_{x},a_{y},\dot{\psi}\right)^{\mathrm{T}} \tag{16}\]  
The system input is  
\[u_{k}=\left(\delta,\omega_{ij}\right)^{\mathrm{T}} \tag{17}\]  
Among them, the state equation needs to be discretized. This article uses the first-order Euler method.  
The calculation process is as follows:  
\[x_{k+1}=f(x_{k},u_{k})+q_{k}=\left[\begin{array}{c}V_{x,k}\\ V_{y,k}\\ \dot{\psi}_{k}\\ 0\\ 0\\ 0\end{array}\right]+\left[\begin{array}{c}a_{x,k-1}+V_{y,k-1}\dot{\psi}_{k-1} \\ a_{y,k-1}-V_{x,k-1}\dot{\psi}_{k-1}\\ M_{2,k-1}/I_{zz}\\ 0\\ 0\\ 0\end{array}\right]\cdot T+\left[\begin{array}{c}0\\ 0\\ 0\\ a_{y,k}\\ M_{z,k}\end{array}\right]+q_{k} \tag{18}\]  
The system measurement equation is calculated as follows:  
\[y_{k+1}=h(x_{k},u_{k})+r_{k}=\left[\begin{array}{cccccc}0&0&1&0&0&0\\ 0&0&1&0&0\\ 0&0&0&0&1&0\end{array}\right]\cdot\left[\begin{array}{c}V_{x,k}\\ V_{y,k}\\ \dot{\psi}_{k}\\ a_{x,k}\\ a_{y,k}\\ M_{z,k}\end{array}\right]+r_{k} \tag{19}\]  
where \(T\) is the sampling time.  
According to Formulas (13)-(19), the IMM-SCKF vehicle state observer can be designed, and the flow of the algorithm is shown in Figure 3. The measured signals are obtained from the vehicle's own sensors, and the tire forces are calculated by the brush tire model. The input interaction is output by three SCKF sub-filters at the previous moment, and the model probabilities are updated in real time, and the final output is fused to estimate the state results. The SCKF sub-filter algorithm design is shown in Section 3.2.  
Figure 3: IMM-SCKF flow chart.