# MPC and PSO Based Control Methodology for Path Tracking of 4 WS4 WD Vehicles
## 3 Control Methodology
### Boundary Definition
#### 3.3.2 Local Boundaries  
To realize real-time optimization, the computing time obtaining optimal values for variables \([F_{Sl},\delta]\) needs to be constrained within the sample time of controller \(T_{s}\). According to the properties of each actuator, the maximum variations of \([F_{Sl},\delta]\) within \(T_{s}\) can be obtained. In this work, to improve the computing efficiency, the local boundaries are also determined by the states of \(s\).  
According to \(a_{r}\) in Equation (1), when \(s_{l}<0\), the forces \(F_{Sli}\) need to be increased, thereby dragging \(s_{l}\) in Equation (54) towards the surface \(s_{l}=0\). Similarly, when \(s_{l}>0\), the forces \(F_{Sli}\) need to be decreased. Therefore, the local boundaries of \(F_{Sli}\) can be written as  
\[\mathfrak{B}^{P}_{F_{Sli}}=\begin{cases}F_{Sli}(t)\leq F_{Sli}(t+T_{s})\leq F_ {Sli}(t)+\Delta F_{d\max},&s_{l}<0,\\ F_{Sli}(t)-\Delta F_{d\max}\leq F_{Sli}(t+T_{s})\leq F_{Sli}(t),&s_{l}\geq 0, \end{cases} \tag{63}\]  
where \(\Delta F_{d\max}\) is the maximum change of \(F_{Sli}\) that can be achieved within \(T_{s}\). At the time \(t+T_{s}\), \(F_{Sli}(t+T_{s})\) are the possible optimal solutions.  
For the steering angles \(\delta_{f}\) and \(\delta_{r}\) in \(\mathbf{v}_{obj}\), they affect the vehicle lateral and angular motions in a coupled way. To solve this problem, an allocating method is specified that the vehicle lateral error determines searching direction of \(\delta_{f}\), while \(\delta_{r}\) is related to vehicle angular error. When \(s_{r}<0\), \(\delta_{f}\) needs to be increased to drive \(s_{r}\) back to the surface \(s_{r}=0\), and vice versa. Thus, the local boundary of \(\delta_{f}\) is summarized as,  
\[\mathfrak{B}^{P}_{\delta_{f}}=\begin{cases}\delta_{f}(t)\leq\delta_{f}(t+T_{s })\leq\delta_{f}(t)+\Delta\delta_{\max},&s_{r}<0,\\ \delta_{f}(t)-\Delta\delta_{\max}\leq\delta_{f}(t+T_{s})\leq\delta_{f}(t),&s_ {r}\geq 0,\end{cases} \tag{64}\]  
where \(\Delta\delta_{\max}\) is the maximum change of steering angle that can be achieved within \(T_{s}\). At the time \(t+T_{s}\), the possible optimal solution of front steering angle is \(\delta_{f}(t+T_{s})\).  
Similarly, based on \(s_{r}\), the local boundary of \(\delta_{r}\) is defined as  
\[\mathfrak{B}^{P}_{\delta_{r}}=\begin{cases}\delta_{r}(t)-\Delta\delta_{\max} \leq\delta_{r}(t+T_{s})\leq\delta_{r}(t),&s_{a}<0,\\ \delta_{r}(t)\leq\delta_{r}(t+T_{s})\leq\delta_{r}(t)+\Delta\delta_{\max},&s_ {a}\geq 0.\end{cases} \tag{65}\]  
For the PSO in particular, its particle velocity boundaries define the range of speed that particles can achieve to search for the optimal solution. To improve search performance in PSO, the absolute maximum particle velocity is normally set as a certain percentage of particle position range [28]. According to Equations (63)-(65), the particle velocity boundaries can be obtained as  
\[\mathfrak{B}^{V}_{F_{Sli}} =\sigma_{F}\left[-\Delta F_{d\max}\quad\Delta F_{d\max},\right] \tag{66}\] \[\mathfrak{B}^{V}_{\delta_{f}} =\sigma_{\delta_{f}}\left[-\Delta\delta_{\max}\quad\Delta\delta_ {\max},\right]\] \[\mathfrak{B}^{V}_{\delta_{r}} =\sigma_{\delta_{r}}\left[-\Delta\delta_{\max}\quad\Delta\delta_ {\max}\right]\]  
where \(\sigma_{F}\), \(\sigma_{\delta_{f}}\) and \(\sigma_{\delta_{r}}\) are the particle velocity coefficients for \(F_{Sli}\), \(\delta_{f}\) and \(\delta_{r}\), respectively.