A Particle Filtering Approach for Fault Detection and Isolation of UAV IMU Sensors: Design, Implementation and Sensitivity Analysis

Sensor fault detection and isolation (SFDI) is a fundamental topic in unmanned aerial vehicle (UAV) development, where attitude estimation plays a key role in flight control systems and its accuracy is crucial for UAV reliability. In commercial drones with low maximum take-off weights, typical redundant architectures, based on triplex, can represent a strong limitation in UAV payload capabilities. This paper proposes an FDI algorithm for low-cost multi-rotor drones equipped with duplex sensor architecture. Here, attitude estimation involves two 9-DoF inertial measurement units (IMUs) including 3-axis accelerometers, gyroscopes and magnetometers. The SFDI algorithm is based on a particle filter approach to promptly detect and isolate IMU faulted sensors. The algorithm has been implemented on a low-cost embedded platform based on a Raspberry Pi board. Its effectiveness and robustness were proved through experimental tests involving realistic faults on a real tri-rotor aircraft. A sensitivity analysis was carried out on the main algorithm parameters in order to find a trade-off between performance, computational burden and reliability.


Introduction
In recent years the use of unmanned aircraft has significantly increased, making the mitigation of risks due to on-board avionics malfunctions essential, in view of sustainable and safe aviation.
Several applications have been exploited with military and civil objectives [1,2], including search and rescue missions in hostile environments [3], surveillance and security patrols [4], home security [5], precision agriculture [4] and network coverage [6], fields of application where UAVs play a key role in terms of reduction in operations and support costs [4]. The flight control system (FCS) is a key component of a generic UAV. It can include inertial sensors, air data systems, avionics, control surfaces/servos, servo-actuators, onboard software and other relevant subsystems contributing to UAV stability and control. A fault in such a system could be critical in the assessment of UAV reliability. It is worth noting that faults on FCSs account for 25% of U.S. military UAV incidents [7].
An FDI system must be able to detect and properly isolate faults in order to mitigate the effects on UAV system performance and integrity. Four key features should be present in an FDI system: • fast detection of abnormal situations; • isolation of faults; • robustness to noise and uncertainties; • low false alarm rate.
For a modern aircraft, three kinds of fault can be considered: • sensor faults: a malfunction of the measurement subsystem; • actuator faults: a malfunction of actuators acting on system dynamics; • process faults: a strong change in system dynamics due to structural problems.
The most sophisticated UAVs are often equipped with technology solutions for automatically detecting and isolating faults on sensors, collectively labeled as fault detection and isolation (FDI) systems [8][9][10][11][12]. The presence of an FDI system increases the capability of UAVs to fulfill prescribed tasks even in the presence of faults. Quick detection and proper isolation of faults represents the first step of a reconfiguration strategy, required to minimize fault impact upon UAV performance [9,13]. In the literature, significant research efforts have been spent in terms of FDI solutions for UAVs. In [14], FDI on UAV Pitot tubes and control surfaces is carried out by using statistical change detection, while in [15], a state machine-based solution is proposed. Ref. [16] shows a sensor fusion-approach for FDI on air data sensors and [17] exploits self-tuning residual generators for fault detection on control surfaces. Finally, a cooperative FDI scheme for UAVs is proposed in [18,19] deals with the faults in UAV FDI systems.
In order to control UAV orientation with respect to an inertial reference system, one of the FCS tasks is attitude estimation. Usually, this consists of sensor fusion algorithms that use measurements coming from accelerometers, gyroscopes and magnetometers [20]. Being an essential task, the problem of UAV attitude estimation on the basis of sensor measurements can be non-trivial [21], and sensor fault detection must be considered to minimize risks due to loss of control.
In aerospace and several industrial applications, hardware redundancy-based techniques are the most common solutions to tackle faults on sensors. Such solutions require a set of redundant sensors to validate measurement data [22]. A typical approach in commercial and military aircraft is based on triple or more hardware redundancies to enhance safety and reliability [23]. Although hardware redundancy techniques are convenient solutions from the point of view of implementation and management, they bring several drawbacks such as weight, power consumption and costs, which are all relevant in small-size UAV applications.
In the literature, some effort has been spent trying to replace hardware redundancybased techniques with analytical redundancy-based ones [23][24][25][26][27][28][29][30][31][32]. In [25] a Kalman filtering approach is implemented in order to reveal oscillatory failures of redundant aircraft sensors, used for flight control law calculation. An FDI method that exploits set-valued observers is proposed in [26] for uncertain linear parameter-varying systems. This method uses a bank of filters and it does not need thresholds to state a fault, in contrast with residual-based architectures. A fault-tolerant scheme for the sensors of a large civil aircraft is proposed in [28,29] using Kalman filters and sliding mode observers. Further nonlinear and robust techniques, such as H ∞ filtering, can reinforce robustness to faults of physically redundant schemes [32,33].
In recent years, some FDI solutions based on particle filters (PFs) are also proposed. A PF is a sequential Monte Carlo method (SMC) [34] aimed at estimating the state of a dynamical system subject to random perturbations, via noisy output observations. A particle filter solution represents an attractive choice for UAV attitude estimation problems [20,[35][36][37][38][39] outperforming classical Kalman filter (KF)-based approaches [40] at the price of significant computational complexity growth [20]. A PF-based fault detection scheme is proposed by [41], while [42] highlights PF advantages in tackling FDI for non-linear systems and [43] also discusses PF drawbacks. In [44] a particle filter deals with the FDI problem for the autonomous integrity monitoring of a GPS receiver. Ref. [45] proposes two different PF-based FDI architectures, which are compared with more classical KF-based approaches. In [46] a particle filter solution is used to deal with both known and unknown faults for a complex system, focusing on a wheeled mobile robot, and in [47] a PF replaces principal component analysis in driving a Gaussian Mixture Model for process monitoring FDI. In [48] a general PF-based FDI scheme is proposed. Similarly [49] is focused upon tackling some of the most well-known PF problems.
In commercial unmanned aviation, costs are a key objective to ensure that UAVs become widespread and, in specific operations, risk assessment needs proof that the flight risk can be acceptable.
In such direction, this paper is focused on the implementation of a sensor fault detection and isolation technique on low-cost hardware, typical of commercial micro-and mini-UAVs. The scope of the proposed procedure is to detect and isolate faults on inertial measurement units used to estimate UAV attitude. The considered hardware is based on a duplex architecture with two inertial measurement units (IMUs) including 3-axis gyroscopes, accelerometers and magnetometers. The estimation problem is dealt with by the design of a particle-filter-based sensor fusion algorithm. From a theoretical point of view, a PF could be a realistic option when statistical performance is considered [50][51][52], because it is able to deal with non-linear motion models and non-Gaussian noise distributions.
Although the use of a PF approach [20] can increase the computational burden, the paper shows promising results by using an SFDI procedure based on two parallel PFs.
The effectiveness of the proposed procedure to detect and isolate IMU sensor faults is proved by means of numerical simulations conducted on a Raspberry Pi board using real data gathered during the flight of a tri-rotor aircraft. Furthermore, this work proposes a sensitivity analysis involving main algorithm parameter variations to estimate effects in terms of SFDI performance. The computation time on a low-cost and low-power embedded platform is assessed in order to prove the algorithm's applicability in a real-world scenario.
The paper is organized as follows: • in Section 2, the proposed hardware and software architecture are described; • in Section 3, the attitude estimation model is defined, using quaternion-based relations; • in Section 4, the particle filter algorithm is introduced; • in Section 5, the SFDI algorithm is shown with details on the implementation; • the effectiveness of the algorithm is shown by means of realistic simulations in Section 6, where an analysis against tunable parameters is discussed.

System Description
The proposed hardware architecture is composed of the following components: • two commercially available boards based on the STM32F103VCT CPU by ST, typically used on low-cost multi-rotors as flight controllers; such boards, called IMU-1 and IMU-2, weighing 17 grams, have a power consumption average below 1W and include the following inertial sensors: an MPU6050-based MEMS triaxial accelerometer and gyroscope (see specifications in Table 1); -an HMC5883L-based MEMS magnetometer (see specifications in Table 1); • a Raspberry Pi 3B platform, a single-board computer based on the Broadcom BCM2837 64bit CPU, with wireless LAN, USB and GPIO connectivity. It weighs 42 grams and in our test had a power consumption of less than 2.5W.
IMU-1 and IMU-2 are linked to the Raspberry Pi platform by USB ports through an on-board serial to USB chip. This configuration simplified the prototyping while ensuring a high bandwidth for data transmission. Figure 1 summarizes the structure of the experimental setup. IMUs act as data collectors. The on-board software acquires signals from sensors on the I 2 C port at a frequency of 100 Hz and sends them through a serial connection.
The SFDI algorithm, together with particle filtering, was implemented on the Raspberry Pi 3B platform as a real-time task over a Debian-based operating system with a fully preemptive GNU/Linux 4.14 kernel. It was coded using MATLAB R2019b by Mathworks and was made executable on the embedded hardware by using code generation. The produced C code was properly modified to customize peripherals access and recompiled on the board. During our tests, the SFDI executable had the highest execution priority to minimize any jitter due to the operating system.
The goal of the SFDI algorithm is to monitor the health of each IMU and to supervise the overall system by providing reliable data to the flight control system. In standard conditions, the output of the SFDI algorithm is the average attitude estimated using both IMUs, while, when a fault is detected, the procedure provides as outputs only the orientation computed by the operational IMU.

UAV Attitude Estimation Problem
Vehicle attitude is defined as its orientation with respect to a reference frame and its accurate estimation is an important topic in the robotics and aerospace fields. UAV attitude is obtained by using a sensor fusion algorithm, together with data provided by IMU sensors.
The attitude obtained by integrating gyro measurements in terms of angular velocities is affected by non-negligible issues, due to bias and random-walk errors. On the other hand, accelerometers and magnetometers provide a good estimate only in static or quasi-static conditions, in the absence of any constant acceleration and magnetic field changes. In order to mitigate such problems, different sensor data fusion algorithms can be implemented on-board [53,54]. Most UAV attitude estimation algorithms are based on an extended Kalman filter [20,[55][56][57], unscented Kalman filter [58,59], particle filtering [36,51,60], quaternion estimation (QUEST) algorithms [61,62], complementary filter [63,64] and Madgwick filter [65].
To describe the attitude estimation problem, two reference systems must be defined: • a north-east-down (NED) reference frame, parallel to the Earth's surface, with the X Eaxis pointed toward north, the Y E -axis pointed toward east and the Z E -axis oriented downwards; • the body frame, centered in the UAV's center of gravity (CG), with the X B -axis pointed toward the UAV nose, the Z B -axis downward and the Y B -axis oriented to complete a right-handed system.
Since UAV navigation is done in a bounded space, the NED frame can be centered in the UAV departing point and assumed as an inertial reference system.
Transition from the inertial to the body frame is obtained with a sequence of three ordered rotations, denoted as 3 − 2 − 1 [66] (see Figure 2): • the first rotation around the Z E axis by the yaw angle ψ, from OX E Y E Z E to OX Y Z ; • the second rotation around the Y axis by the pitch angle θ from OX Y Z to OX Y Z ; • the third rotation around the X axis by the roll angle The angles ψ, θ and φ are called Euler angles and describe the aircraft's attitude, i.e., the orientation of the body frame with respect to the inertial NED frame.
Alternatively, to define the relative rotation of the body frame with respect to the inertial frame, a quaternion-based representation can be used [67]. From Euler's theorem, any rotation sequence is equivalent to a single rotation by a given angle α about a fixed axis passing through the origin. This rotation can be described by the unit quaternion vector q = [q 0 ,q 1 ,q 2 ,q 3 ] T , whose components define the axis vector ζ = [ζ x , ζ y , ζ z ] T and the angle α (see Figure 3):q Let us call q = [q 0 , q 1 , q 2 , q 3 ] T the unit quaternion vector associated to R BE (q) from the NED reference frame to the body frame: Euler angle-based representation and quaternion-based representation are equivalent; therefore, a one-to-one correspondence between Euler angles and the quaternion vector exists: The Euler angles are computed as follows [66]: Figure 2. Inertial (E) and body-fixed (B) reference frames. Transition from the NED frame to the body frame is obtained with a sequence of three ordered rotations around the Z E axis, the Y axis and the X axis of angles ψ, θ and φ, respectively.
In the absence of noise and uncertainties in IMU measurements, the UAV attitude estimation could be carried out by integrating the angular speed vector ω = [p, q, r] T from a known initial attitude.
Consequently, the quaternion vector exhibits the following dynamics:q where the matrix Q(ω(t)) is However, the gyroscope output is an angular velocity affected by white noise. In static conditions, in the absence of rotations, the gyroscope output is not zero as expected, but it is a white noise with a zero mean and a given standard deviation. On a finite time horizon, the integration will lead to a drifting of the angle estimation [68,69].
The sensed rotational velocities ω S (t) can be assumed different from ω due to the presence of bias and stochastic noise: T represent the vectors of biases and unknown zero-mean noise affecting gyroscopes, respectively. In steady-state and slowly varying conditions, a good solution is to involve accelerometers and magnetometers, being dependent on the UAV orientation. The relationship between UAV orientation and accelerometer and magnetometer output vectors a B and M B is defined as follows: where g E = 0 0 g T is the gravity vector with g = 9.801 m/s 2 and M E is the Earth's magnetic field, both defined in the Earth frame. However, although an optimization-based procedure can be used to solve Equations (9) and (10), the last approach is not reliable [67,70], due to the presence of non-negligible noise in measurements.
In order to exploit (9) and (10), consider the sensed accelerations and field magnetic measurements: with v a (t) and v M (t) vectors of sensor noise affecting triaxial accelerometers and magnetometers at the time instant t, respectively.
The attitude estimation can be carried out by merging both approaches [20,71]. The kinematic model (6) is usually extended with additional dynamics in order to take into account the gyroscope biases [72]: where τ is a time constant compliant with bias dynamics. To correct the previous estimation, (15) and (16) can be used: Equations (13)-(16) can be expressed in the following generic form: where In such representation, accelerometers and magnetometers provide output sensor measurements according to (18), whereas gyroscopes represent an external input acting on (17).
The attitude estimation problem can be reformulated as the estimation of the state vector x from (17) based on output measurements (18). Corrective actions can then be designed and implemented, feeding back the error between measured and estimated outputs. Optimal estimation has the role of reducing sensitivity to noise and forcing the additional state vector components b to compensate for gyro biases or other low-frequency uncertain contributions.

Particle Filter Algorithm
Let us assume the following generic discrete time representation: being x ∈ R n x , y ∈ R n y , ω s ∈ R n ω , v ∈ R n v and d ∈ R n d . It can be obtained by applying Euler's discretization to (17) and (18) where with T S > 0 the constant sampling time.
Equations (19) and (20) represent a partially observed Markov process, where the output vector y(·) is observable, while the state x(·) is unobservable. A Markov process is a stochastic process whose state vector x(k) depends only on x(k − 1), being independent of x(k − l), with l > 1.
A particle filter is used to estimate x(k) in (19), fulfilling (20) under the hypothesis that the process d(k − 1) and the measurement noise v(k) are unknown.
The particle filter is a numeric implementation of a Bayesian estimator [73]. The Bayesian approaches are based on Bayes' rule. Their goal is to estimate the conditional probability density function (PDF) of the current state x(k), given the whole set of acquired measurements at time k, denoted by Y (k) = {y(0), y(1), . . . , y(k)}. The conditional PDF is denoted as p(x(k)|Y (k)).
The Bayesian estimator can be formulated in a recursive way, in order to update the PDF when a new measurement is acquired [74].
At the first time step k = 0, since no measurements are available, e.g., the set Y (0) = ∅, the estimator is initialized as follows: where p(x(0)) is the known initial PDF of state. At each time step k, the a priori PDF denoted by p(x(k)|Y (k − 1)) is computed using the Chapman-Kolmogorov formula [73]: In the a posteriori phase, the conditional PDF is computed by using Bayes' rule as follows: where p(y(k)|x(k)) is available thanks to measurement equations and the PDF of the measurement noise v(k). The PDF p(y(k)|Y (k − 1)) depends on the a priori PDF p(x(k)|Y (k − 1)) and p(y(k)|x(k)): Equations (23)- (25) involve intractable multidimensional integrals [34]. The particle filtering approach offers a numerical solution to this problem [75].
In PF algorithms, PDF p(x(k)|y(k)) can be approximated by a set of random samples named particles. According to [76], the convergence rate of the particle-approximated cumulative function is O 1 √ ∆ , with ∆ a constant tunable parameter indicating the number of particles. An important feature that characterizes particle filter algorithms is the method used to obtain new samples. A widely used class of resampling techniques is sequence importance resampling (SIR) [77].
Let us assume discrete-time model (19) and (20). A particle filter is used to estimate the x(k) value knowing the vector y(k) of accelerometer and magnetometer measurements and the vector ω S (k − 1) of the rotational speed sensed by the gyroscopes.
Assuming that the PDF of the initial state p(x(0)) is known, the PF algorithm is initialized randomly generating ∆ particlesx(0), on the basis of PDF p(x(0)). Then, at each time step k, the procedure involves the following steps: (i) the set of a priori particles X(k|k − 1) at the k-th sampling step is obtained by propagating the set X(k − 1|k − 1) with the state Equation (19), considering the process noise d(k) equal to zero. Therefore, the generic particle x δ (k) ∈ X(k|k − 1) is computed as follows: We compute the relative likelihoodw δ (k) of each particle x δ (k) conditioned on the measurement y(k)., i.e., evaluate the PDF p(y(k)|x δ (k)) on the basis of the nonlinear measurement equation and the PDF of the measurement noise v(k). Under the assumption of additive measurement noise, the weightw δ (k) can be computed as follows:w where P(·) denotes the probability and y δ is obtained according to the output equation, neglecting the measurement noise v(k): (iii) The weightsw δ (k) are normalized according to the following equation: (iv) A set of particles taking into account a posteriori knowledgeX(k|k) is obtained by randomly drawing ∆ samples from X(k|k − 1) therefore, each particle x δ ∈ X(k|k − 1) is chosen m δ times. The integer number m δ must satisfy the following conditions: • m δ is a non-negative integer; To compute the parameter m δ the following sub-procedure is applied: define a series of ∆ + 1 thresholds σ δ as: In order to counteract the so-called particle degeneracy problem, which can weaken algorithm convergence and robustness [78], the set of a posteriori particle X(k|k) is obtained by randomly scattering each particle of setX(k|k) in a given neighborhood. (vi) The state estimatex(k) is evaluated as the algebraic mean of a posteriori particles belonging to X(k|k):x In Section 6.2 a sensitivity analysis against introduced tunable parameters ∆ and ν is proposed.

SFDI Algorithm for a Duplex IMU
In the view of accomplishing navigation purposes, let us consider an onboard flight controller based on a duplex sensor architecture including two IMUs, named IMU-1 and IMU-2, with triaxial accelerometers, gyroscopes and magnetometers, whose output sensor measurements y (1) (k) and y (2) (k) are defined as follows: where a For each IMU i, the quaternion vector q (i) (k) and gyroscope biases b (i) (k) are estimated by using a particle filter, named PFi, fed with ω (i) S (k) and y (i) (k). A sensor reconfiguration logic has been implemented to achieve FDIR, formulated as an event-driven state machine, based on the following sets of logical states: where • subscript A indicates accelerometers, subscript G is for gyroscopes and subscript M is for magnetometers; • N Z is the normal state for sensor Z ∈ {A, G, M}; • A Z is the alert state activated at the detection phase on the basis of a preliminary comparison between IMUs; • F j is the fault state for the IMU unit j ∈ {1, 2}.
In Figure 4, the state transition graph is shown. The events driving the state transition of the proposed state machine can be grouped into three algorithm steps: Step 1-FAULT DETECTION. Under the assumption of a non-contemporary fault, at each time step k, the transition from normal N(k − 1) to alert A(k) state (and vice versa from A(k − 1) to N(k)) is achieved by comparing measurement accelerometer, magnetometer and gyroscope measurements from IMUs.
where a l,s , M l,s and ω l,s are the l-th components of accelerometer, magnetometer and gyroscope measurements, respectively. τ a , τ m and τ g are positive scalar thresholds for accelerometers, magnetometers and gyroscopes, required to make the detection robust against sensor noise and uncertainties.
Step 2-FAULT ISOLATION. Once the presence of a fault is detected, withk the time instant of fault detection, then b (i) 0 = b (i) (k) As for the transition from the alert to the faulted state, a fault on the i-th IMU is declared if the following condition holds: where || · || ∞ denotes the infinity norm and Ω is a diagonal weighing matrix required to take into account the effects of sensor noise. The faulted IMUī can be isolated solving the following problem:ī The residual σ(i) represents the error between output estimation and measurements, increased with the difference between the estimated biases at the current time and at the detection time: where || · || 2 indicates the Euclidean norm. According to (42), a faulted sensor belongs to the IMU whose output is farther from the relevant full particle filter forecast.
Step 3-FAULT RECOVERY. When the fault condition is no longer held (E Z2 ), the system is able to recover the faulted IMU by checking the consistency between attitude estimations from both PFs, through In Section 6.2 a sensitivity analysis against introduced tunable parameters τ a , τ m , τ g and Ω is proposed.

Numerical Simulations Based on Experimental Data
Experimental validation of the proposed approach was carried out with the aim of proving its effectiveness along with its applicability to a low-cost small-UAV architecture. For this purpose, the hardware platform presented in Section 2 was installed on a light tri-rotor aircraft of less than 2 kg (see Figure 5), to gather in-flight sensor data. The tri-rotor platform has an on-board flight controller [79], used to perform an indoor flight, forcing the system to follow pre-assigned reference angles and altitudes.
Captured data from both IMUs is shown in Figure 6. The estimated attitude in the absence of any fault is shown in Figure 6d. Three maneuvers were performed, sequentially changing Euler angles:

Fault Scenario Analyses
Experimental data gathered during the flight were used as measurements in numerical simulations, where realistic faults were injected to test the SFDI algorithm.
Typical fault scenarios [80][81][82][83][84] were considered: • F1: intermittent abrupt bias-a step disturbance of 0.2 g is added to a (1) y,S (t) for t ∈ [3, 13] s; • F2: slow drift-a linearly increasing signal with a rate of 0.2 rad/s 2 is added to the measured yaw rate on IMU-2 starting from the time instant t = 3.5 s; • F3: abrupt freezing-magnetometer data M (1) x,S (t) stops being updated at t = 3 s; • F4: oscillation-a sinusoidal signal with a frequency of 30 rad/s is added to the r (1) 28] s; • F5: random walk-Gaussian noise, whose amplitude is smaller than the relevant detection threshold, is integrated and added to accelerometer data a x,S (t) for t ∈ [23, 33] s. Table 2 resumes the values of the SFDI scheme design parameters, as introduced in Sections 4 and 5. The intermittent abrupt bias on a (1) y,S (t) is depicted in Figure 7a. As shown in Figure 7b, the attitude estimated by IMU-1 is affected by an error that mostly affects the roll angle. In Figure 7b, vertical dashed red lines indicate the range in which the fault is injected and the gray area is used to highlight the time interval in which the SFDI algorithm is in the fault state.
As expected, the considered fault is quickly (t d = 0.27 s) detected and IMU-2 is correctly labeled as the operational unit (see red line in Figure 7b). Furthermore, at t = 13 s, the accelerometer returns to operational and after 6.96 s the SFDI algorithm returns to the normal state, restoring estimated attitude based on IMU-1 measurements. The time required to restore the estimated attitude based on IMU-1 depends on the design parameters, see Section 6.2. However, it does not affect the performance of the estimated attitude, given the presence of IMU-2.

Scenario F2-Slow Drift
In Figure 8a, the slow drift injected at time t = 3.5 s, with a slope of 0.2 rad/s 2 , into the z-axis gyroscope measurement r S (t) of IMU-2 is shown. As shown in Figure 8c, at time t = 4.61 s, the SFDI scheme isolates the gyroscope fault and moves to the fault state. As IMU-2 does not return to an operational state, the SFDI algorithm persists in the same condition until the end of simulation. A slow drift is difficult to detect and isolate, due to the small slope, causing a delay between the beginning of the fault and the isolation. However, the correction of the magnetometer and the use of the average attitude (green line) in the normal state limit the error in the yaw estimation of some degrees (<3 deg). Figure 8b shows the norm of the estimated gyroscope biases for both IMUs. It is worth noting that the bias estimated by IMU-2 is increasing over time due to the fault, while IMU-1 is almost hidden by the x-axis. x from IMU-1 subject to an abrupt freezing over almost the whole simulation.
Results in Figure 9b show that the SFDI algorithm switches between normal and fault states several times, when the broken value of M x is similar to the correct one and estimated attitudes are in the predefined threshold. Furthermore, it is worth noting that the fault was isolated with a significant delay. This behavior depends on magnetometer signals M (1) x and M (2) x that, in the first phases of the flight, are almost the same. At the take-off, M (2) x is affected by a small change due to the magnetic field of the electric motors that is altered by an increasing power request. Because the faulted IMU is frozen, only at the take-off is the SFDI algorithm able to detect the fault. After that, at several times during the flight, both errors on attitudes and magnetometer signals are below the predefined threshold, causing the return to the normal state. However, the reliability of the overall system is not compromised because, as shown in Figure 9b

Scenario F4-Oscillation
In Figure 10a, the considered fault on the z-axis gyroscope measurement r (1) S is shown. In particular, a sinusoidal disturbance, with a frequency (∼10 Hz), compliant to tri-rotor dynamics, is added to r (1) S in the time interval t ∈ [3, 28] s. As shown in Figure 10c, although the attitude estimated by IMU-1 is only partially affected by the fault, the SFDI algorithm is able to detect the problem after a very short time, with the transition to the fault state from t = 3.02 s to t = 28.01 s denoting a fast return to the normal state, once the signal on IMU-1 becomes operational.
In Figure 10b, the norm of the estimated gyro biases is shown, highlighting the difference between IMUs.  In Figure 11a, the effects of the random walk disturbance on accelerometer data are shown. This signal is created by integrating a Gaussian noise with a mean value of 0.07 g and overlapped to the real signal in the time interval [23 s, 33 s]. In order to stress the algorithm, the mean value of noise is lower than the relevant detection threshold.  As shown in Figure 11b, the SFDI algorithm moves to the fault state at t = 28.16 s, with a notable delay from the beginning of the injected fault. The reliability of the estimated attitude is not affected and such delay depends on the tri-rotor attitude: without any relevant maneuver affecting a change in the pitch angle, a small error on a (1) x,S (t) results in a small trace on the attitude (<1 deg in the simulation). After IMU-1 becomes newly operational, the SFDI algorithm returns to the normal state (at t = 33.41 s).

Algorithm Parameter Sensitivity Analysis
Effects of parameters on the performance of the proposed algorithm are discussed by means of a comparison between several choices. Scenario F1 is considered. We denote with T 0 = {300, 301, . . . , 1300} the discrete time set in which the fault is injected. Executing the SFDI algorithm the fault is detected and isolated. With T f = {k : F 1 (k) = 1} being the set of time instants in which IMU-1 is considered faulted, the following performance indices were considered:

1.
computation time-the time needed to execute the SFDI algorithm at each time instant on the embedded platform Raspberry Pi 3B; 2.
correct detection-the ratio between the correctly detected fault time interval and the real fault duration, computed as CD = card(T f ∩ T 0 )/card(T 0 ), where card(T ) denotes the cardinality of set T ; 3.
wrong detection-the ratio between the badly detected fault time interval and the real fault duration, computed as WD = card(T f ∩ T 0 )/card(T 0 ), where T 0 is the complementary set of T 0 ; 4.
detection time-the delay between the beginning of the fault and the detection, computed as DT = (min T f − min T 0 ); 5.
recovery time-the delay between the end of the fault and the fault recovery, computed as RT = (max T f − max T 0 ).
In Table 3, the computing time is shown considering several numbers of particles ∆. Results are taken from 30 executions of the algorithm for each ∆ value on the above mentioned Raspberry Pi 3B platform. In Table 4, the effects in terms of variation of 2-5 performance indices for varying numbers of particles are shown. A growth in the number of particles decreases PF convergence time thus leading to a quicker recovery from a fault. However, if the output of both (operational and faulty) IMUs is close, an excessively short convergence speed may cause the mislabeling of a faulty IMU as operational, reducing the correct detection ratio. For these reasons increasing the ∆ value behind a certain threshold brings no advantages, while increasing computational effort, see Table 3. In view of the sensitivity analysis results, the chosen value of ∆ is boldfaced. It represents the number of particles, among the considered values, showing the best correct detection ratio while guaranteeing real-time execution. In Table 5 the effects of τ a are evaluated. As expected, reducing the fault detection threshold may increase the number of wrong detections, whereas high threshold values may increase the number of missed detections. Detection time appears to be zero with lower τ a values because of false positives and the fact that recovery time may be affected by false detections. The chosen value of τ a is boldfaced and it represents the trade-off, among the considered thresholds, which shows the best ratio between the correct detection index and the wrong identification one. In Table 6 the influence of Ω is shown. A higher recovery threshold value leads to a shorter recovery time, which eventually leads to exiting the fault condition too early; it causes an increase in the number of missed alarms, reducing SFDI algorithm sensitivity. The chosen value of Ω is boldfaced and it represents the best threshold value in terms of acceptable recovery time. Finally, in Table 7 the effect of the v parameter is evaluated. It affects PF convergence time in two opposite ways. Larger v values may boost the convergence speed by enlarging the region where the algorithm searches for the best state estimate, but it can also reduce the correct match ratio in case of faults whose magnitude is close to the relevant detection threshold. Neither the wrong identification ratio nor the detection time are influenced by v value. The chosen value of v is boldfaced and it represents the trade-off in terms of the ratio between the correct detection and the wrong identification indices.

Conclusions
In commercial unmanned aviation, an increase in the system reliability is needed in order to make flight risks acceptable.
With this aim, in this paper, the implementation of a sensor fault detection and isolation technique on low-cost hardware typical of commercial micro-and mini-UAVs was performed. Given the crucial role of attitude estimation in flying platform stabilization, the proposed procedure is aimed at detecting and isolating faults on inertial measurement units used to estimate UAV attitude. The hardware is based on a duplex architecture with two inertial measurement units (IMUs) including 3-axis gyroscopes, accelerometers and magnetometers. A particle filtering approach is proposed to deal with the attitude estimation problem, being able to deal with non-linear motion models and non-Gaussian noise distributions.
Results show the effectiveness of such an approach. Data gathered from a real flight of a tri-rotor flying platform were useful to test the SFDI algorithm with real sensor disturbances due to vibrations and changes to magnetic field. The proposed algorithm correctly detected every injected fault, including for challenging scenarios such as freezing faults and slow drifts.
The proposed architecture increases system reliability by doubling the number of on-board sensors. This produces a reduction in weight, costs and power consumption, in comparison to the gold standard of triplex architecture for avionics at the price of lower speed and accuracy.
In the literature, few duplex IMU architectures have been proposed. In Table 8, the authors compared the proposed SFDI algorithm with the SFDI logic presented in a previous work [72], to highlight the pros and cons of the current solution by comparing platforms in terms of detection time (t d ) and maximum attitude error (e max ). The implementation of the algorithm on a Raspberry Pi low-cost embedded platform with two IMU boards has shown that, although a particle filter is considered a heavy algorithm, the proposed procedure can be used on low-cost unmanned aircraft, with an increase in system reliability and without a significant change in the overall cost.
To make the algorithm readily available and easily tunable, a sensitivity analysis of algorithm parameters on the SFDI performance was conducted, highlighting the chosen settings.
For the latest low-cost drones equipped with sonar, lidar and optical flow sensors, the future applications of our procedure are currently under research, using more sensors and also validating duplex heterogeneous architectures, where redundant sensor platforms can contain different sensors.

Data Availability Statement:
The data presented in this study are available on request from the corresponding author.

Conflicts of Interest:
The authors declare no conflict of interest.