## 3 Proposed Method
### The Optimized Kalman Filter Based on IFOA(IFOA-KF)  
The tuning parameters, processing noise covariance \(Q\), and observation noise covariance \(R\) indicate the uncertainty of the prediction model and the correction model, respectively. Both the processing noise covariance and observation noise covariance are unknown and need to be tuned for better estimation performance. \(Q\) is notoriously difficult but it helps to inject uncertainty into the state equations and assist the filter to learn from the measurement. There are three different options for \(Q\) tuning: (1) scalar quantity; (2) diagonal matrix; and (3) full matrix. In this paper, since the processing noise is mainly contributed by acceleration [60], \(Q\) is optimized as a scalar quantity. Observation matrix \(H_{k}\) is a vector because the measured variable is the current pushing distance, thus, \(R\) is also a scalar quantity. As shown in Figure 4, the offline Kalman filter tuning procedure based on IFOA is presented, and the block diagram of the proposed method can be described as follows. Figure 3: Flowchart of improved fruit fly optimization algorithm (IFOA). Firstly, the state-space model of pushing distance estimation, as shown in Figure 4A, should be constructed. The state-space model can be represented by two equations: a processing equation and an observation equation. The processing equation of pushing distance estimation is obtained as follows:  
\[p_{k}=p_{k-1}+\Delta t\cdot v_{k-1}+\frac{1}{2}a_{k}\Delta t^{2} \tag{13}\] \[v_{k}=v_{k-1}+a_{k}\Delta t\]  
By linearization of above equation and comparing it with Equation (2), parameters of the processing model can be constructed. \(A_{k}=\left[ \begin{array}{cc}1&\Delta t\\ 0&1\end{array} \right]\), \(B_{k}=\left[ \begin{array}{c}\
icefrac{{1}}{{2}}\Delta t^{2}\\ \Delta t\end{array} \right]\) and \(u_{k}\) is the acceleration \(a_{k}\). Since the only measurable state variable is displacement \(p_{k}\), the observation equation is shown as follows:  
\[y_{k}=\left[ \begin{array}{cc}1&0\end{array} \right]\left[ \begin{array}{c}p _{k}\\ v_{k}\end{array} \right] \tag{14}\]  
Then, the observation matrix is vector \(H_{k}=\left[ \begin{array}{cc}1&0\end{array} \right]\). 2. Fitness Function  
As analyzed in Section 4.1, to apply IFOA in pushing distance estimation, the fitness function is the key point to tune the Kalman filter. In this paper, the fitness function is obtaining a better set  
Figure 4: Block diagram of the offline Kalman filter tuning procedure based on IFOA; (**A**) the state-space model of pushing distance estimation; (**B**) the diagram of proposed IFOA; (**C**) the basic Kalman filter. \(\frac{\partial}{\partial\tau}\) is the output port of the state-space model; \(\frac{\partial\tau}{\partial\tau}\) is the input port of the Kalman filter observation model, and the input port and output port are connected to each other. of \(Q\) and \(R\) values resulting in lower mean squared error from the output of the Kalman filter. Thus, the fitness function of the tuning process is calculated as follows:  
\[f_{\min}=\parallel x_{k}^{+}-x\parallel=E\left[\left(x_{k}^{+}-x\right)\left(x _{k}^{+}-x\right)^{T}\right] \tag{15}\]  
where \(x_{k}^{+}\) is the current posterior estimation of the pushing distance, \(x\) is the real state of the pushing distance estimation system, and \(E(\cdot)\) are expectation operations, which obtain the sum of the mean squared error. (3) Kalman Filter  
The block diagram, as shown in Figure 4C, shows all of the procedures of a basic Kalman filter. In this paper, the acceleration signal obtained through the inertial sensor is treated as the control input \(u_{k}\). The measured displacement obtained through the built-in electro-hydraulic control system of the hydraulic powered roof support is the observable variable \(y_{k}\). During the parameter tuning process, the estimated state produced by the Kalman filter and the real state produced by the state-space model go through the fitness function, and obtain the mean square error.