# Design of a Predictive RBF Compensation Fuzzy PID Controller for 3D Laser Scanning System
## 4 Design of RFPID and PRFPID
### PRFID Controller Description  
Predictive control with good predictive ability should consider the influence of uncertainty and perform real-time optimization during the process operation. From the analysis in the previous section, the RFPID controller does not guarantee acceptable convergence error and the anti-interference ability is weak. Based on the RFPID controller, this section combines the algorithmic idea of predictive control to compensate for the system steady-state error and enhance its robustness. As shown in Figure 8, the predictive controller is added to modify the RFPID controller. The output of the prediction controller is calculated to compensate the output of the overall controller in real time. Ignoring the fitting error \(\varepsilon\) of the RBF neural network, the discrete state space expression of the closed-loop control system is  
\[\left\{ \begin{array}{l}\mathbf{x}(k+1)=\mathbf{A}_{\text{p}}\mathbf{x}(k)+\mathbf{b}_{\text{ p}}u_{3}(k)\\ y(k)=\mathbf{c}_{\text{p}}^{\text{T}}\mathbf{x}(k)\\ \\ \mathbf{x}=\left[\begin{array}{c}\int e\text{d}t\\ e\\ \dot{e}\end{array}\right]\mathbf{A}_{\text{P}}=\left[\begin{array}{ccc}1&t_{\text{s }}&0\\ 0&1&t_{\text{s}}\\ -k_{\text{i}}t_{\text{s}}&-k_{\text{p}}t_{\text{s}}&1-k_{\text{d}}t_{\text{s} }\end{array}\right]\mathbf{b}_{\text{P}}=\left[\begin{array}{c}0\\ 0\\ t_{\text{s}}\end{array}\right]\mathbf{c}_{\text{P}}=\left[\begin{array}{c}0\\ 1\\ 0\end{array}\right]\end{array} \right. \tag{20}\]  
where \(u_{3}(k)\) is the output of predictive controller at time \(k,\mathbf{x}\) is the state variable of the closed-loop system, \(y\) is the output of the system, \(e\) is the output error, \(t_{\text{s}}\) is the sampling time, \(A_{\text{P}}\) is the system matrix, \(\mathbf{b}_{\text{P}}\) is the control matrix and \(\mathbf{c}_{\text{P}}\) is the output matrix. According to (20), the predicted step number is set to \(P\) and the control step number is set to \(M\). Thus, the model of the predictive controller is  
\[\left\{ \begin{array}{c}\mathbf{Y}(k)=\mathbf{F}_{\text{y}}\mathbf{x}(k)+\mathbf{G}_{\text{y}} \mathbf{U}_{3}(k)\\ \\ \mathbf{Y}(k)=\left[\begin{array}{c}y(k+1)\\ \vdots\\ y(k+P)\\ \end{array}\right]_{\text{P}\times 1},\mathbf{F}_{\text{y}}=\left[\begin{array}{c} \mathbf{c}_{\text{p}}^{\text{T}}\mathbf{A}_{\text{P}}\\ \vdots\\ \mathbf{c}_{\text{p}}^{\text{T}}\mathbf{A}_{\text{P}}^{\text{P}}\\ \end{array}\right]_{\text{P}\times 3}\\ \\ \mathbf{G}_{\text{y}}=\left[\begin{array}{ccc}\mathbf{c}_{\text{p}}^{\text{T}}\mathbf{b} _{\text{p}}&0&0\\ \vdots&\ddots&0\\ \mathbf{c}_{\text{p}}^{\text{T}}\mathbf{A}_{\text{P}}^{M-1}\mathbf{b}_{\text{p}}&\cdots& \mathbf{c}_{\text{p}}^{\text{T}}\mathbf{b}_{\text{p}}\\ \vdots&\ddots&\vdots\\ \mathbf{c}_{\text{p}}^{\text{T}}\mathbf{A}_{\text{P}}^{\text{P}-1}\mathbf{b}_{\text{p}}& \cdots&\sum\limits_{i=1}^{P-M+1}\mathbf{c}_{\text{p}}^{\text{T}}\mathbf{A}_{\text{P}}^ {i-1}\mathbf{b}_{\text{p}}\\ \end{array}\right]_{\text{P}\times M}\end{array} \right. \tag{21}\]  
where \(\mathbf{Y}\) is the predicted \(P\) output vector expression, \(\mathbf{F}_{\text{y}}\) is the coefficient matrix of the state variable and \(\mathbf{G}_{\text{y}}\) is the input coefficient matrix. According to the model of predictive control in (21), the \(M\) control quantity in the future moments can be obtained by minimizing the error of the controlled object in \(P\) times and suppressing the fluctuation of the control quantity. The optimized performance index equation is  
\[\min_{U_{3}(k)}J(k)=\left\|\mathbf{N}(k)-\mathbf{Y}(k)\right\|_{L}^{2}+\left\|\mathbf{U}_{3 }(k)\right\|_{O}^{2} \tag{22}\]  
where \(\mathbf{N}(k)=\left[n(k+1)\dots\ n(k+P)\right]\) is the output target value vector and \(\mathbf{L}\) and \(\mathbf{O}\) are the weighted matrices of the output and control quantity respectively. In predictive control algorithms, \(\mathbf{N}\) usually needs to specify a smooth curve that is close to the target value to improve the stability of the system.