# Fault-Tolerant Optimal Consensus Control for Heterogeneous Multi-Agent Systems
## 4 Simulations  
In this section, simulations are performed to validate the effectiveness of the proposed algorithm (31) and (33). The experiment involves a leader UAV, three follower UAVs, and three UGVs forming the system. MATLAB 2017a is used as the experimental platform. The Laplacian matrix corresponding to the undirected communication topology is shown below:  
\[L= \begin{bmatrix}3&-1&-1&0&0&-1\\ -1&3&-1&0&-1&0\\ \frac{-1}{-1}&-1&3&-1&0&0\\ 0&0&-1&3&-1&-1\\ 0&-1&0&-1&3&-1\\ -1&0&0&-1&-1&3\\ \end{bmatrix} \quad\zeta= \begin{bmatrix}1&0&0&0&0&0\\ 0&0&0&0&0&0\\ 0&0&0&0&0&0\\ 0&0&0&0&0&0\\ 0&0&0&1&0&0\\ 0&0&0&0&0&0\\ 0&0&0&0&0&0\end{bmatrix} \]  
Each UAV has a 12-dimensional state, while the state vector of the UGV is 4-dimensional. The correlation coefficient matrix of the system (11) is as previously designed. The system primarily considers the partial failure of actuators. Therefore, all followers' actuator failure coefficients must be set between 0 and 1 in the simulation. This experiment finds the following failure coefficient scenarios. \[\mathcal{P}_{A1}= \begin{bmatrix}0.5&0&0\\ 0&0.3&0\\ 0&0&0.6\end{bmatrix} ,\mathcal{P}_{A3}= \begin{bmatrix}0.5\cos t&0&0\\ 0&0.8&0\\ 0&0&0.2\end{bmatrix} ,\mathcal{P}_{G1}= \begin{bmatrix}0.1&0\\ 0&0.8\sin t\end{bmatrix} \]  
According to the above coefficient matrix and failure coefficient design, MATLAB simulation is employed to verify the control algorithm (31) and algorithm (33) proposed for the heterogeneous multi-agent system. To highlight the superior convergence speed of the proposed algorithm, this study compares it with the consensus algorithm for heterogeneous multi-agent systems described in reference [29], under typical initial conditions. Initial states are randomly set between 0 and 10. Initial states are as follows: UAV0's position is (8.14, 9.05, 1.26) m, with a velocity of (9.13, 6.32, 0.97) m/s and attitude angles of (0,0,0)\({}^{\circ}\) with angular velocities of (0,0,0)\({}^{\circ}\)/s; UAV1's position is (2.78, 5.46, 9.57) m, with a velocity of (9.64, 1.57, 9.7) m/s and attitude angles of (0,0,0)\({}^{\circ}\) with angular velocities of (0,0,0)\({}^{\circ}\)/s; UAV2's position is (9.57, 4.85, 8) m, with a velocity of (1.41, 4.21, 9.15) m/s and attitude angles of (0,0,0)\({}^{\circ}\) with angular velocities of (0,0)\({}^{\circ}\)/s; UAV3's position is (7.92, 9.59, 6.55) m, with a velocity of (0.35, 8.49, 9.33) m/s and attitude angles of (0,0,0)\({}^{\circ}\) with angular velocities of (0,0,0)\({}^{\circ}\)/s; UAV1's position is (6.78, 7.57) m, with a velocity of (7.43, 3.92) m/s; UGV2's position is (6.55, 1.71) m, with a velocity of (7.06, 1.31) m/s; UGV3's position is (2.76, 0.46) m, with a velocity of (0.97, 8.23) m/s. The initial states of the agents in reference [28] are as follows: UAV1's position is (6.94, 3.17, 50) m, with a velocity of (0.34, 4.38, 1.31) m/s and attitude angles of (0,0)\({}^{\circ}\) with angular velocities of (0,0,0)\({}^{\circ}\)/s; UAV2's position is (7.65, 7.95, 50) m, with a velocity of (4.89, 4.45, \(-\)2) m/s and attitude angles of (0,0,0)\({}^{\circ}\) with angular velocities of (0,0,0)\({}^{\circ}\)/s; UAV3's position is (7.09, 7.54, 50) m, with a velocity of (6.79, 6.55, \(-\)1) m/s and attitude angles of (0,0,0)\({}^{\circ}\) with angular velocities of (0,0)\({}^{\circ}\)/s; UAV3's position is (1.19, 4.98) m with a velocity of (9.59, 2.55) m/s; UGV2's position is (5.85, 2.23) m with a velocity of (7.53, 2.55) m/s. The parameters are \(\alpha=0.1\), \(\beta=0.8\), \(\gamma_{1}=4.0\), \(\gamma_{2}=1.5;g_{1}=0.1,g_{2}=0.8\). Utilizing the algorithms presented in Equations (31) and (33) and comparing them with those from Reference [29], simulations of the UAV and UGV systems are depicted in Figures 1-12. The comparison demonstrates that both protocols facilitate consensus among UAVs and UGVs. Figures 1 and 2 illustrate that the methods proposed in (31) and (33) for addressing leader-following consistency outperform the approach presented in reference [29], demonstrating superior performance.