# Mass Estimation-Based Path Tracking Control for Autonomous Commercial Vehicles
## 3 Path-Tracking Controller
### Robust Mass Estimation for Commercial Vehicles
#### 3.1.2 Robust Mass Estimation Algorithm  
By correcting the estimated results with real-time measurement data, the longitudinal dynamics model of the vehicle can be transformed into the form of least squares. Specifically, an approximation method is employed, utilizing the estimate from time \(\mathrm{k}-1\) to predict the output at time \(\mathrm{k}\), while assessing the error of the output in the process.  
Within the framework of the vehicle's longitudinal dynamics model, the application of least squares in the mass estimation process can be articulated as follows:  
\[\left\{\begin{matrix}y=(T_{qt}i_{0}i_{x}\eta)/\tau-0.5C_{d}A_{\theta}V_{x}^{2} \\ \varphi=a_{x}+gf\\ \theta=m\end{matrix}\right. \tag{12}\]  
where \(y\) is the output quantity, \(\varphi\) is the measurable data, \(\theta\) is the parameter to be observed, and \(a_{x}\) represents the value measured by the longitudinal acceleration sensor.  
\[a_{x}=\dot{V}_{x}+g\alpha \tag{13}\]  
Considering that the least squares method may lead to data saturation in the data processing stage, to mitigate the adverse effects of data saturation and improve estimation accuracy, a forgetting factor is utilized. To diminish the impact of sensor noise on the estimation results and bolster the robustness of the algorithm, M-estimation is combined with the least squares method that includes a forgetting factor. M-estimation suppresses the influence of outliers and noise by weighting the residuals, thus improving the stability and accuracy of parameter estimation [18].  
The objective function can be defined as follows:  
\[f(\theta)=\rho(\gamma) \tag{14}\]  
\[\gamma=\left(y(\kappa)-\varphi^{T}(\kappa)\theta(\kappa-1)\right) \tag{15}\]  
Here, the loss function is defined as follows:  
\[\rho(\gamma)=\left\{\begin{matrix}\gamma^{2}/2&|\gamma|\leq h\\ h|\gamma|-\gamma^{2}/2&|\gamma|>h\end{matrix}\right. \tag{16}\]  
Figure 4: Vehicle motion force diagram.  
where \(h\) is an adjustable parameter. Differentiating the performance function gives the following:  
\[\frac{\partial f(\theta)}{\partial\theta}=\frac{d\rho(\gamma)}{d\gamma}\cdot\frac {\partial\gamma}{\partial\theta}=0 \tag{17}\]  
\[\psi=\frac{d\rho(\gamma)}{d\gamma} \tag{18}\]  
\[w=\frac{\psi}{\gamma} \tag{19}\]  
where \(\psi\) is the influence factor, and \(w\) is the weight value.  
\[w=\begin{cases}1&|\gamma|<h\\ \frac{h}{|\gamma|}&|\gamma|>h\end{cases} \tag{20}\]  
The application of the least squares method considering the forgetting factor and joint M-estimation in the mass estimation process can be articulated as follows [19]:  
\[\begin{pmatrix}\dot{\theta}(\kappa)=\dot{\theta}(\kappa-1)+K(\kappa)w\big{[}y( \kappa)-\varphi^{T}(\kappa)\dot{\theta}(\kappa-1)\big{]}\\ K(\kappa)=\frac{P(\kappa-1)\varphi(\kappa)}{\lambda+\varphi^{T}(\kappa)P( \kappa-1)\varphi(\kappa)}\\ P(\kappa)=\frac{1}{\lambda}\big{[}I-K(\kappa)w\varphi^{T}(\kappa)\big{]}P( \kappa-1)\end{pmatrix} \tag{21}\]  
\(K\) is the gain matrix, \(P\) is the covariance matrix, and \(\lambda\) is the forgetting factor.