## 4 Control System Design
### Software Design
\begin{split}\mathrm{x}^{+}=\left[\sigma_{+}(\sigma_{-})^{-1} \right]\mathrm{x}^{-}+\left[\sigma_{+}\mathrm{H}^{\rm{T}}(\mathrm{R})^{-1} \right]\mathrm{x}=&\left[\sigma_{+}\mathrm{H}^{\rm{T}}(\mathrm{ R})^{-1}\right]\mathrm{x}\\ \sigma_{+}=\left[(\sigma_{-})^{-1}+\mathrm{H}^{\rm{T}}(\mathrm{R })^{-1}\mathrm{H}\right]^{-1}\\ \mathrm{H}=&\begin{pmatrix}1\\ 1\end{pmatrix},\ \mathrm{x}=\begin{pmatrix}\bar{x_{1}}\\ \bar{x_{2}}\end{pmatrix},\ \mathrm{R}=\begin{pmatrix}\sigma_{1}{}^{2}&0\\ 0&\sigma_{2}{}^{2}\end{pmatrix}\end{split}  \tag{13}\]  
where \(\mathrm{x}^{-}\) is the last data fusion result; \(\mathrm{x}\) is the arithmetic mean matrix; \(\sigma_{+}\) is the variance of the data fusion results; \(\mathrm{H}\) is the coefficient matrix of the measurement equation; and \(\mathrm{R}\) is the covariance matrix of the measurement noise. Figure 5: Communication diagram. Will (\(\sigma\). )\({}^{-1}\) = 0 is substituted to obtain:  
\[\mathrm{x^{+}}=\left[\sum_{\mathrm{i=1}}^{2}\frac{1}{\sigma_{\mathrm{i}}^{2}} \right]^{-1}\cdot\sum_{\mathrm{i=1}}^{2}\frac{\overline{\mathrm{x_{i}}}}{\sigma_ {\mathrm{i}}^{2}}\sigma_{+}=\left[\sum_{\mathrm{i=1}}^{2}\frac{1}{\sigma_{ \mathrm{i}}^{2}}\right]^{-1} \tag{14}\]  
\(\mathrm{x^{+}}\) is the inclination value after fusion, and the inclination value after fusion is closer to the real value. The levelling of the mobile platform is divided into automatic levelling and manual levelling. The automatic levelling process is a continuous cyclic process. IMU will constantly detect the inclination data. When the mobile platform is tilted, it will achieve automatic levelling by controlling the lifting of the electric drive. Through the fixed-point method, an automatic levelling control system is designed, which specifies that the position of the first electric push rod is fixed and does not participate in the levelling process. The automatic levelling control process is as follows: IMUs obtain the inclination information of the mobile platform and carry on the fusion, and the fused information is transmitted to the controller through CAN communication. After receiving the information, the controller begins to calculate the height difference of each electric push rod relative to the first electric push rod, so as to make a control decision. At this time, the driver begins to drive the electric push rod to participate in the levelling process to achieve the level of the position and posture of the mobile platform. Manual levelling is controlled by switches. There are thirteen switches in total, which control the raising and lowering of the four electric push rods, raising and lowering at the same time, and performing an emergency stop. When any switch is pressed, a push rod will perform the corresponding action. The pressure sensor is installed on the four outriggers. After levelling, the stress in each outrigger is detected, and the outrigger with the virtual leg is adjusted to eliminate the virtual leg. The flow chart of outrigger automatic levelling is shown in Figure 6 and virtual leg detection is are shown in Figure 7, and the manual levelling button settings are shown in Table 1. \begin{table}
\begin{tabular}{c c c} \hline
**Manual Levelling Button Label** & **Movement Trend** & **From** \\ \hline
0 & Manual/Automatic & Controller \\
1 & 1 Up & Linear actuator1 \\
2 & 2 Up & Linear actuator 2 \\
3 & 3 Up & Linear actuator 3 \\
4 & 4 Up & Linear actuator 4 \\
11 & 1 Down & Linear actuator 1 \\
22 & 2 Down & Linear actuator 2 \\
33 & 3 Down & Linear actuator 3 \\
44 & 4 Down & Linear actuator 4 \\
5 & All up & Linear actuators 1, 2, 3, 4 \\
6 & All down & Linear actuators 1, 2, 3, 4 \\
7 & Reset & Linear actuators 1, 2, 3, 4 \\
8 & Cease & Linear actuators 1, 2, 3, 4 \\ \end{tabular}
\end{table} 
Table 1: Switch signal input. Figure 6: Leveling flow chart.