Robust and Optimal Sensor Fusion - Matlab Computation
Table of Contents
- 1. Optimal Sensor Fusion - Minimize the Super Sensor Noise
- 2. Optimal Sensor Fusion - Minimize the Super Sensor Dynamical Uncertainty
- 2.1. Super Sensor Dynamical Uncertainty
- 2.2. Dynamical uncertainty of the individual sensors
- 2.3. Synthesis objective
- 2.4. Requirements as an \(\mathcal{H}_\infty\) norm
- 2.5. Weighting Function used to bound the super sensor uncertainty
- 2.6. \(\mathcal{H}_\infty\) Synthesis
- 2.7. Super sensor uncertainty
- 2.8. Super sensor noise
- 2.9. Conclusion
- 3. Optimal Sensor Fusion - Mixed Synthesis
- 4. Equivalent Super Sensor
- 5. Optimal And Robust Sensor Fusion in Practice
- 6. Methods of complementary filter synthesis
In this document, the design of complementary filters is studied.
One use of complementary filter is described below:
The basic idea of a complementary filter involves taking two or more sensors, filtering out unreliable frequencies for each sensor, and combining the filtered outputs to get a better estimate throughout the entire bandwidth of the system. To achieve this, the sensors included in the filter should complement one another by performing better over specific parts of the system bandwidth.
- in section 1, the optimal design of the complementary filters in order to obtain the lowest resulting "super sensor" noise is studied
When blending two sensors using complementary filters with unknown dynamics, phase lag may be introduced that renders the close-loop system unstable.
- in section 2, the blending robustness to sensor dynamic uncertainty is studied.
Then, three design methods for generating two complementary filters are proposed:
- in section 6.1, analytical formulas are proposed
- in section 6.2, the \(\mathcal{H}_\infty\) synthesis is used
- in section 6.3, the classical feedback architecture is used
- in section 6.4, analytical formulas found in the literature are listed
1 Optimal Sensor Fusion - Minimize the Super Sensor Noise
The idea is to combine sensors that works in different frequency range using complementary filters.
Doing so, one "super sensor" is obtained that can have better noise characteristics than the individual sensors over a large frequency range.
The complementary filters have to be designed in order to minimize the effect noise of each sensor on the super sensor noise.
All the files (data and Matlab scripts) are accessible here.
1.1 Architecture
Let's consider the sensor fusion architecture shown on figure 1 where two sensors (sensor 1 and sensor 2) are measuring the same quantity \(x\) with different noise characteristics determined by \(N_1(s)\) and \(N_2(s)\).
\(\tilde{n}_1\) and \(\tilde{n}_2\) are normalized white noise:
\begin{equation} \label{org3add10f} \Phi_{\tilde{n}_1}(\omega) = \Phi_{\tilde{n}_1}(\omega) = 1 \end{equation}
Figure 1: Fusion of two sensors
We consider that the two sensor dynamics \(G_1(s)\) and \(G_2(s)\) are ideal:
\begin{equation} \label{orgb0f5e1e} G_1(s) = G_2(s) = 1 \end{equation}We obtain the architecture of figure 2.
Figure 2: Fusion of two sensors with ideal dynamics
\(H_1(s)\) and \(H_2(s)\) are complementary filters:
\begin{equation} \label{org22daba8} H_1(s) + H_2(s) = 1 \end{equation}The goal is to design \(H_1(s)\) and \(H_2(s)\) such that the effect of the noise sources \(\tilde{n}_1\) and \(\tilde{n}_2\) has the smallest possible effect on the estimation \(\hat{x}\).
We have that the Power Spectral Density (PSD) of \(\hat{x}\) is: \[ \Phi_{\hat{x}}(\omega) = |H_1(j\omega) N_1(j\omega)|^2 \Phi_{\tilde{n}_1}(\omega) + |H_2(j\omega) N_2(j\omega)|^2 \Phi_{\tilde{n}_2}(\omega), \quad \forall \omega \]
And the goal is the minimize the Root Mean Square (RMS) value of \(\hat{x}\):
\begin{equation} \label{org8e39dfa} \sigma_{\hat{x}} = \sqrt{\int_0^\infty \Phi_{\hat{x}}(\omega) d\omega} \end{equation}1.2 Noise of the sensors
Let's define the noise characteristics of the two sensors by choosing \(N_1\) and \(N_2\):
- Sensor 1 characterized by \(N_1(s)\) has low noise at low frequency (for instance a geophone)
- Sensor 2 characterized by \(N_2(s)\) has low noise at high frequency (for instance an accelerometer)
omegac = 100*2*pi; G0 = 1e-5; Ginf = 1e-4; N1 = (Ginf*s/omegac + G0)/(s/omegac + 1)/(1 + s/2/pi/100); omegac = 1*2*pi; G0 = 1e-3; Ginf = 1e-8; N2 = ((sqrt(Ginf)*s/omegac + sqrt(G0))/(s/omegac + 1))^2/(1 + s/2/pi/4000)^2;
1.3 H-Two Synthesis
As \(\tilde{n}_1\) and \(\tilde{n}_2\) are normalized white noise: \(\Phi_{\tilde{n}_1}(\omega) = \Phi_{\tilde{n}_2}(\omega) = 1\) and we have: \[ \sigma_{\hat{x}} = \sqrt{\int_0^\infty |H_1 N_1|^2(\omega) + |H_2 N_2|^2(\omega) d\omega} = \left\| \begin{matrix} H_1 N_1 \\ H_2 N_2 \end{matrix} \right\|_2 \] Thus, the goal is to design \(H_1(s)\) and \(H_2(s)\) such that \(H_1(s) + H_2(s) = 1\) and such that \(\left\| \begin{matrix} H_1 N_1 \\ H_2 N_2 \end{matrix} \right\|_2\) is minimized.
For that, we use the \(\mathcal{H}_2\) Synthesis.
We use the generalized plant architecture shown on figure 4.
Figure 4: \(\mathcal{H}_2\) Synthesis - Generalized plant used for the optimal generation of complementary filters
The transfer function from \([n_1, n_2]\) to \(\hat{x}\) is: \[ \begin{bmatrix} N_1 H_1 \\ N_2 (1 - H_1) \end{bmatrix} \] If we define \(H_2 = 1 - H_1\), we obtain: \[ \begin{bmatrix} N_1 H_1 \\ N_2 H_2 \end{bmatrix} \]
Thus, if we minimize the \(\mathcal{H}_2\) norm of this transfer function, we minimize the RMS value of \(\hat{x}\).
We define the generalized plant \(P\) on matlab as shown on figure 4.
P = [0 N2 1; N1 -N2 0];
And we do the \(\mathcal{H}_2\) synthesis using the h2syn
command.
[H1, ~, gamma] = h2syn(P, 1, 1);
Finally, we define \(H_2(s) = 1 - H_1(s)\).
H2 = 1 - H1;
The complementary filters obtained are shown on figure 5.
The PSD of the noise of the individual sensor and of the super sensor are shown in Fig. 6.
The Cumulative Power Spectrum (CPS) is shown on Fig. 7.
The obtained RMS value of the super sensor is lower than the RMS value of the individual sensors.
PSD_S1 = abs(squeeze(freqresp(N1, freqs, 'Hz'))).^2; PSD_S2 = abs(squeeze(freqresp(N2, freqs, 'Hz'))).^2; PSD_H2 = abs(squeeze(freqresp(N1*H1, freqs, 'Hz'))).^2+abs(squeeze(freqresp(N2*H2, freqs, 'Hz'))).^2;
Figure 6: Power Spectral Density of the estimated \(\hat{x}\) using the two sensors alone and using the optimally fused signal (png, pdf)
CPS_S1 = 1/pi*cumtrapz(2*pi*freqs, PSD_S1); CPS_S2 = 1/pi*cumtrapz(2*pi*freqs, PSD_S2); CPS_H2 = 1/pi*cumtrapz(2*pi*freqs, PSD_H2);
1.4 Alternative H-Two Synthesis
An alternative Alternative formulation of the \(\mathcal{H}_2\) synthesis is shown in Fig. 8.
Figure 8: Alternative formulation of the \(\mathcal{H}_2\) synthesis
1.5 H-Infinity Synthesis - method A
Another objective that we may have is that the noise of the super sensor \(n_{SS}\) is following the minimum of the noise of the two sensors \(n_1\) and \(n_2\): \[ \Gamma_{n_{ss}}(\omega) = \min(\Gamma_{n_1}(\omega),\ \Gamma_{n_2}(\omega)) \]
In order to obtain that ideal case, we need that the complementary filters be designed such that:
\begin{align*} & |H_1(j\omega)| = 1 \text{ and } |H_2(j\omega)| = 0 \text{ at frequencies where } \Gamma_{n_1}(\omega) < \Gamma_{n_2}(\omega) \\ & |H_1(j\omega)| = 0 \text{ and } |H_2(j\omega)| = 1 \text{ at frequencies where } \Gamma_{n_1}(\omega) > \Gamma_{n_2}(\omega) \end{align*}Which is indeed impossible in practice.
We could try to approach that with the \(\mathcal{H}_\infty\) synthesis by using high order filters.
As shown on Fig. 3, the frequency where the two sensors have the same noise level is around 9Hz. We will thus choose weighting functions such that the merging frequency is around 9Hz.
The weighting functions used as well as the obtained complementary filters are shown in Fig. 9.
n = 5; w0 = 2*pi*10; G0 = 1/10; G1 = 10000; Gc = 1/2; W1a = (((1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (G0/Gc)^(1/n))/((1/G1)^(1/n)*(1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (1/Gc)^(1/n)))^n; n = 5; w0 = 2*pi*8; G0 = 1000; G1 = 0.1; Gc = 1/2; W2a = (((1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (G0/Gc)^(1/n))/((1/G1)^(1/n)*(1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (1/Gc)^(1/n)))^n;
P = [W1a -W1a; 0 W2a; 1 0];
And we do the \(\mathcal{H}_\infty\) synthesis using the hinfsyn
command.
[H2a, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on');
[H2a, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on'); Resetting value of Gamma min based on D_11, D_12, D_21 terms Test bounds: 0.1000 < gamma <= 10500.0000 gamma hamx_eig xinf_eig hamy_eig yinf_eig nrho_xy p/f 1.050e+04 2.1e+01 -3.0e-07 7.8e+00 -1.3e-15 0.0000 p 5.250e+03 2.1e+01 -1.5e-08 7.8e+00 -5.8e-14 0.0000 p 2.625e+03 2.1e+01 2.5e-10 7.8e+00 -3.7e-12 0.0000 p 1.313e+03 2.1e+01 -3.2e-11 7.8e+00 -7.3e-14 0.0000 p 656.344 2.1e+01 -2.2e-10 7.8e+00 -1.1e-15 0.0000 p 328.222 2.1e+01 -1.1e-10 7.8e+00 -1.2e-15 0.0000 p 164.161 2.1e+01 -2.4e-08 7.8e+00 -8.9e-16 0.0000 p 82.130 2.1e+01 2.0e-10 7.8e+00 -9.1e-31 0.0000 p 41.115 2.1e+01 -6.8e-09 7.8e+00 -4.1e-13 0.0000 p 20.608 2.1e+01 3.3e-10 7.8e+00 -1.4e-12 0.0000 p 10.354 2.1e+01 -9.8e-09 7.8e+00 -1.8e-15 0.0000 p 5.227 2.1e+01 -4.1e-09 7.8e+00 -2.5e-12 0.0000 p 2.663 2.1e+01 2.7e-10 7.8e+00 -4.0e-14 0.0000 p 1.382 2.1e+01 -3.2e+05# 7.8e+00 -3.5e-14 0.0000 f 2.023 2.1e+01 -5.0e-10 7.8e+00 0.0e+00 0.0000 p 1.702 2.1e+01 -2.4e+07# 7.8e+00 -1.6e-13 0.0000 f 1.862 2.1e+01 -6.0e+08# 7.8e+00 -1.0e-12 0.0000 f 1.942 2.1e+01 -2.8e-09 7.8e+00 -8.1e-14 0.0000 p 1.902 2.1e+01 -2.5e-09 7.8e+00 -1.1e-13 0.0000 p 1.882 2.1e+01 -9.3e-09 7.8e+00 -2.0e-15 0.0001 p 1.872 2.1e+01 -1.3e+09# 7.8e+00 -3.6e-22 0.0000 f 1.877 2.1e+01 -2.6e+09# 7.8e+00 -1.2e-13 0.0000 f 1.880 2.1e+01 -5.6e+09# 7.8e+00 -1.4e-13 0.0000 f 1.881 2.1e+01 -1.2e+10# 7.8e+00 -3.3e-12 0.0000 f 1.882 2.1e+01 -3.2e+10# 7.8e+00 -8.5e-14 0.0001 f Gamma value achieved: 1.8824
H1a = 1 - H2a;
We then compute the Power Spectral Density as well as the Cumulative Power Spectrum.
PSD_Ha = abs(squeeze(freqresp(N1*H1a, freqs, 'Hz'))).^2+abs(squeeze(freqresp(N2*H2a, freqs, 'Hz'))).^2; CPS_Ha = 1/pi*cumtrapz(2*pi*freqs, PSD_Ha);
1.6 H-Infinity Synthesis - method B
We have that: \[ \Phi_{\hat{x}}(\omega) = \left|H_1(j\omega) N_1(j\omega)\right|^2 + \left|H_2(j\omega) N_2(j\omega)\right|^2 \]
Then, at frequencies where \(|H_1(j\omega)| < |H_2(j\omega)|\) we would like that \(|N_1(j\omega)| = 1\) and \(|N_2(j\omega)| = 0\) as we discussed before. Then \(|H_1 N_1|^2 + |H_2 N_2|^2 = |N_1|^2\).
We know that this is impossible in practice. A more realistic choice is to design \(H_2(s)\) such that when \(|N_2(j\omega)| > |N_1(j\omega)|\), we have that: \[ |H_2 N_2|^2 = \epsilon |H_1 N_1|^2 \]
Which is equivalent to have (by supposing \(|H_1| \approx 1\)): \[ |H_2| = \sqrt{\epsilon} \frac{|N_1|}{|N_2|} \]
And we have:
\begin{align*} \Phi_{\hat{x}} &= \left|H_1 N_1\right|^2 + |H_2 N_2|^2 \\ &= (1 + \epsilon) \left| H_1 N_1 \right|^2 \\ &\approx \left|N_1\right|^2 \end{align*}Similarly, we design \(H_1(s)\) such that at frequencies where \(|N_1| > |N_2|\): \[ |H_1| = \sqrt{\epsilon} \frac{|N_2|}{|N_1|} \]
For instance, is we take \(\epsilon = 1\), then the PSD of \(\hat{x}\) is increased by just by a factor \(\sqrt{2}\) over the all frequencies from the idea case.
We use this as the weighting functions for the \(\mathcal{H}_\infty\) synthesis of the complementary filters.
The weighting function and the obtained complementary filters are shown in Fig. 10.
epsilon = 2; W1b = 1/epsilon*N1/N2; W2b = 1/epsilon*N2/N1; W1b = W1b/(1 + s/2/pi/1000); % this is added so that it is proper
P = [W1b -W1b; 0 W2b; 1 0];
And we do the \(\mathcal{H}_\infty\) synthesis using the hinfsyn
command.
[H2b, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on');
[H2b, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on'); Test bounds: 0.0000 < gamma <= 32.8125 gamma hamx_eig xinf_eig hamy_eig yinf_eig nrho_xy p/f 32.812 1.8e+01 3.4e-10 6.3e+00 -2.9e-13 0.0000 p 16.406 1.8e+01 3.4e-10 6.3e+00 -1.2e-15 0.0000 p 8.203 1.8e+01 3.3e-10 6.3e+00 -2.6e-13 0.0000 p 4.102 1.8e+01 3.3e-10 6.3e+00 -2.1e-13 0.0000 p 2.051 1.7e+01 3.4e-10 6.3e+00 -7.2e-16 0.0000 p 1.025 1.6e+01 -1.3e+06# 6.3e+00 -8.3e-14 0.0000 f 1.538 1.7e+01 3.4e-10 6.3e+00 -2.0e-13 0.0000 p 1.282 1.7e+01 3.4e-10 6.3e+00 -7.9e-17 0.0000 p 1.154 1.7e+01 3.6e-10 6.3e+00 -1.8e-13 0.0000 p 1.089 1.7e+01 -3.4e+06# 6.3e+00 -1.7e-13 0.0000 f 1.122 1.7e+01 -1.0e+07# 6.3e+00 -3.2e-13 0.0000 f 1.138 1.7e+01 -1.3e+08# 6.3e+00 -1.8e-13 0.0000 f 1.146 1.7e+01 3.2e-10 6.3e+00 -3.0e-13 0.0000 p 1.142 1.7e+01 5.5e-10 6.3e+00 -2.8e-13 0.0000 p 1.140 1.7e+01 -1.5e-10 6.3e+00 -2.3e-13 0.0000 p 1.139 1.7e+01 -4.8e+08# 6.3e+00 -6.2e-14 0.0000 f 1.139 1.7e+01 1.3e-09 6.3e+00 -8.9e-17 0.0000 p Gamma value achieved: 1.1390
H1b = 1 - H2b;
PSD_Hb = abs(squeeze(freqresp(N1*H1b, freqs, 'Hz'))).^2+abs(squeeze(freqresp(N2*H2b, freqs, 'Hz'))).^2; CPS_Hb = 1/pi*cumtrapz(2*pi*freqs, PSD_Hb);
1.7 Comparison of the methods
The three methods are now compared.
The Power Spectral Density of the super sensors obtained with the complementary filters designed using the three methods are shown in Fig. 11.
The Cumulative Power Spectrum for the same sensors are shown on Fig. 12.
The RMS value of the obtained super sensors are shown on table 1.
rms value | |
---|---|
Sensor 1 | 1.3e-03 |
Sensor 2 | 1.3e-03 |
H2 Fusion | 1.2e-04 |
H-Infinity a | 2.4e-04 |
H-Infinity b | 1.4e-04 |
1.8 Obtained Super Sensor's noise uncertainty
We would like to verify if the obtained sensor fusion architecture is robust to change in the sensor dynamics.
To study the dynamical uncertainty on the super sensor, we defined some multiplicative uncertainty on both sensor dynamics. Two weights \(w_1(s)\) and \(w_2(s)\) are used to described the amplitude of the dynamical uncertainty.
omegac = 100*2*pi; G0 = 0.1; Ginf = 10; w1 = (Ginf*s/omegac + G0)/(s/omegac + 1); omegac = 0.2*2*pi; G0 = 5; Ginf = 0.1; w2 = (Ginf*s/omegac + G0)/(s/omegac + 1); omegac = 5000*2*pi; G0 = 1; Ginf = 50; w2 = w2*(Ginf*s/omegac + G0)/(s/omegac + 1);
The sensor uncertain models are defined below.
G1 = 1 + w1*ultidyn('Delta',[1 1]); G2 = 1 + w2*ultidyn('Delta',[1 1]);
The super sensor uncertain model is defined below using the complementary filters obtained with the \(\mathcal{H}_2\) synthesis. The dynamical uncertainty bounds of the super sensor is shown in Fig. 13. Right Half Plane zero might be introduced in the super sensor dynamics which will render the feedback system unstable.
Gss = G1*H1 + G2*H2;
1.9 Conclusion
From the above complementary filter design with the \(\mathcal{H}_2\) and \(\mathcal{H}_\infty\) synthesis, it still seems that the \(\mathcal{H}_2\) synthesis gives the complementary filters that permits to obtain the minimal super sensor noise (when measuring with the \(\mathcal{H}_2\) norm).
However, the synthesis does not take into account the robustness of the sensor fusion.
2 Optimal Sensor Fusion - Minimize the Super Sensor Dynamical Uncertainty
We initially considered perfectly known sensor dynamics so that it can be perfectly inverted.
We now take into account the fact that the sensor dynamics is only partially known. To do so, we model the uncertainty that we have on the sensor dynamics by multiplicative input uncertainty as shown in Fig. 14.
Figure 14: Sensor fusion architecture with sensor dynamics uncertainty
The objective here is to design complementary filters \(H_1(s)\) and \(H_2(s)\) in order to minimize the dynamical uncertainty of the super sensor.
All the files (data and Matlab scripts) are accessible here.
2.1 Super Sensor Dynamical Uncertainty
In practical systems, the sensor dynamics has always some level of uncertainty. Let's represent that with multiplicative input uncertainty as shown on figure 14.
Figure 15: Fusion of two sensors with input multiplicative uncertainty
The dynamics of the super sensor is represented by
\begin{align*} \frac{\hat{x}}{x} &= (1 + w_1 \Delta_1) H_1 + (1 + w_2 \Delta_2) H_2 \\ &= 1 + w_1 H_1 \Delta_1 + w_2 H_2 \Delta_2 \end{align*}with \(\Delta_i\) is any transfer function satisfying \(\| \Delta_i \|_\infty < 1\).
We see that as soon as we have some uncertainty in the sensor dynamics, we have that the complementary filters have some effect on the transfer function from \(x\) to \(\hat{x}\).
The uncertainty set of the transfer function from \(\hat{x}\) to \(x\) at frequency \(\omega\) is bounded in the complex plane by a circle centered on 1 and with a radius equal to \(|w_1(j\omega) H_1(j\omega)| + |w_2(j\omega) H_2(j\omega)|\) (figure 16).
We then have that the angle introduced by the super sensor is bounded by \(\arcsin(\epsilon)\): \[ \angle \frac{\hat{x}}{x}(j\omega) \le \arcsin \Big(|w_1(j\omega) H_1(j\omega)| + |w_2(j\omega) H_2(j\omega)|\Big) \]
Figure 16: Maximum phase variation
2.2 Dynamical uncertainty of the individual sensors
Let say we want to merge two sensors:
- sensor 1 that has unknown dynamics above 10Hz: \(|w_1(j\omega)| > 1\) for \(\omega > 10\text{ Hz}\)
- sensor 2 that has unknown dynamics below 1Hz and above 1kHz \(|w_2(j\omega)| > 1\) for \(\omega < 1\text{ Hz}\) and \(\omega > 1\text{ kHz}\)
We define the weights that are used to characterize the dynamic uncertainty of the sensors.
omegac = 100*2*pi; G0 = 0.1; Ginf = 10; w1 = (Ginf*s/omegac + G0)/(s/omegac + 1); omegac = 0.2*2*pi; G0 = 5; Ginf = 0.1; w2 = (Ginf*s/omegac + G0)/(s/omegac + 1); omegac = 5000*2*pi; G0 = 1; Ginf = 50; w2 = w2*(Ginf*s/omegac + G0)/(s/omegac + 1);
From the weights, we define the uncertain transfer functions of the sensors. Some of the uncertain dynamics of both sensors are shown on Fig. 17 with the upper and lower bounds on the magnitude and on the phase.
G1 = 1 + w1*ultidyn('Delta',[1 1]); G2 = 1 + w2*ultidyn('Delta',[1 1]);
2.3 Synthesis objective
The uncertainty region of the super sensor dynamics is represented by a circle in the complex plane as shown in Fig. 16.
At each frequency \(\omega\), the radius of the circle is \(|w_1(j\omega) H_1(j\omega)| + |w_2(j\omega) H_2(j\omega)|\).
Thus, the phase shift \(\Delta\phi(\omega)\) due to the super sensor uncertainty is bounded by: \[ |\Delta\phi(\omega)| \leq \arcsin\big( |w_1(j\omega) H_1(j\omega)| + |w_2(j\omega) H_2(j\omega)| \big) \]
Let's define some allowed frequency depend phase shift \(\Delta\phi_\text{max}(\omega) > 0\) such that: \[ |\Delta\phi(\omega)| < \Delta\phi_\text{max}(\omega), \quad \forall\omega \]
If \(H_1(s)\) and \(H_2(s)\) are designed such that \[ |w_1(j\omega) H_1(j\omega)| + |w_2(j\omega) H_2(j\omega)| < \sin\big( \Delta\phi_\text{max}(\omega) \big) \]
The maximum phase shift due to dynamic uncertainty at frequency \(\omega\) will be \(\Delta\phi_\text{max}(\omega)\).
2.4 Requirements as an \(\mathcal{H}_\infty\) norm
We know try to express this requirement in terms of an \(\mathcal{H}_\infty\) norm.
Let's define one weight \(w_\phi(s)\) that represents the maximum wanted phase uncertainty: \[ |w_{\phi}(j\omega)|^{-1} \approx \sin(\Delta\phi_{\text{max}}(\omega)), \quad \forall\omega \]
Then:
\begin{align*} & |w_1(j\omega) H_1(j\omega)| + |w_2(j\omega) H_2(j\omega)| < \sin\big( \Delta\phi_\text{max}(\omega) \big), \quad \forall\omega \\ \Longleftrightarrow & |w_1(j\omega) H_1(j\omega)| + |w_2(j\omega) H_2(j\omega)| < |w_\phi(j\omega)|^{-1}, \quad \forall\omega \\ \Longleftrightarrow & \left| w_1(j\omega) H_1(j\omega) w_\phi(j\omega) \right| + \left| w_2(j\omega) H_2(j\omega) w_\phi(j\omega) \right| < 1, \quad \forall\omega \end{align*}Which is approximately equivalent to (with an error of maximum \(\sqrt{2}\)):
\begin{equation} \label{org7b4fd38} \left\| \begin{matrix} w_1(s) w_\phi(s) H_1(s) \\ w_2(s) w_\phi(s) H_2(s) \end{matrix} \right\|_\infty < 1 \end{equation}One should not forget that at frequency where both sensors has unknown dynamics (\(|w_1(j\omega)| > 1\) and \(|w_2(j\omega)| > 1\)), the super sensor dynamics will also be unknown and the phase uncertainty cannot be bounded. Thus, at these frequencies, \(|w_\phi|\) should be smaller than \(1\).
2.5 Weighting Function used to bound the super sensor uncertainty
Let's define \(w_\phi(s)\) in order to bound the maximum allowed phase uncertainty \(\Delta\phi_\text{max}\) of the super sensor dynamics. The magnitude \(|w_\phi(j\omega)|\) is shown in Fig. 18 and the corresponding maximum allowed phase uncertainty of the super sensor dynamics of shown in Fig. 19.
Dphi = 20; % [deg] n = 4; w0 = 2*pi*900; G0 = 1/sin(Dphi*pi/180); Ginf = 1/100; Gc = 1; wphi = (((1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/Ginf)^(2/n)))*s + (G0/Gc)^(1/n))/((1/Ginf)^(1/n)*(1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/Ginf)^(2/n)))*s + (1/Gc)^(1/n)))^n; W1 = w1*wphi; W2 = w2*wphi;
Figure 18: Magnitude of the weght \(w_\phi(s)\) that is used to bound the uncertainty of the super sensor (png, pdf)
The obtained upper bounds on the complementary filters in order to limit the phase uncertainty of the super sensor are represented in Fig. 20.
2.6 \(\mathcal{H}_\infty\) Synthesis
The \(\mathcal{H}_\infty\) synthesis architecture used for the complementary filters is shown in Fig. 21.
Figure 21: Architecture used for \(\mathcal{H}_\infty\) synthesis of complementary filters
The generalized plant is defined below.
P = [W1 -W1; 0 W2; 1 0];
And we do the \(\mathcal{H}_\infty\) synthesis using the hinfsyn
command.
[H2, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on');
[H2, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on'); Resetting value of Gamma min based on D_11, D_12, D_21 terms Test bounds: 0.0447 < gamma <= 1.3318 gamma hamx_eig xinf_eig hamy_eig yinf_eig nrho_xy p/f 1.332 1.3e+01 -1.0e-14 1.3e+00 -2.6e-18 0.0000 p 0.688 1.3e-11# ******** 1.3e+00 -6.7e-15 ******** f 1.010 1.1e+01 -1.5e-14 1.3e+00 -2.5e-14 0.0000 p 0.849 6.9e-11# ******** 1.3e+00 -2.3e-14 ******** f 0.930 5.2e-12# ******** 1.3e+00 -6.1e-18 ******** f 0.970 5.6e-11# ******** 1.3e+00 -2.3e-14 ******** f 0.990 5.0e-11# ******** 1.3e+00 -1.7e-17 ******** f 1.000 2.1e-10# ******** 1.3e+00 0.0e+00 ******** f 1.005 1.9e-10# ******** 1.3e+00 -3.7e-14 ******** f 1.008 1.1e+01 -9.1e-15 1.3e+00 0.0e+00 0.0000 p 1.006 1.2e-09# ******** 1.3e+00 -6.9e-16 ******** f 1.007 1.1e+01 -4.6e-15 1.3e+00 -1.8e-16 0.0000 p Gamma value achieved: 1.0069
And \(H_1(s)\) is defined as the complementary of \(H_2(s)\).
H1 = 1 - H2;
The obtained complementary filters are shown in Fig. 22.
2.7 Super sensor uncertainty
We can now compute the uncertainty of the super sensor. The result is shown in Fig. 23.
Gss = G1*H1 + G2*H2;
The uncertainty of the super sensor cannot be made smaller than both the individual sensor. Ideally, it would follow the minimum uncertainty of both sensors.
We here just used very wimple weights. For instance, we could improve the dynamical uncertainty of the super sensor by making \(|w_\phi(j\omega)|\) smaller bellow 2Hz where the dynamical uncertainty of the sensor 1 is small.
2.8 Super sensor noise
We now compute the obtain Power Spectral Density of the super sensor's noise. The noise characteristics of both individual sensor are defined below.
omegac = 100*2*pi; G0 = 1e-5; Ginf = 1e-4; N1 = (Ginf*s/omegac + G0)/(s/omegac + 1)/(1 + s/2/pi/100); omegac = 1*2*pi; G0 = 1e-3; Ginf = 1e-8; N2 = ((sqrt(Ginf)*s/omegac + sqrt(G0))/(s/omegac + 1))^2/(1 + s/2/pi/4000)^2;
The PSD of both sensor and of the super sensor is shown in Fig. 24. The CPS of both sensor and of the super sensor is shown in Fig. 25.
2.9 Conclusion
Using the \(\mathcal{H}_\infty\) synthesis, the dynamical uncertainty of the super sensor can be bounded to acceptable values.
However, the RMS of the super sensor noise is not optimized as it was the case with the \(\mathcal{H}_2\) synthesis
3 Optimal Sensor Fusion - Mixed Synthesis
3.1 Mixed \(\mathcal{H}_2\) / \(\mathcal{H}_\infty\) Synthesis - Introduction
The goal is to design complementary filters such that:
- the maximum uncertainty on the super sensor is bounded
- the RMS value of the super sensor noise is minimized
To do so, we can use the Mixed \(\mathcal{H}_2\) / \(\mathcal{H}_\infty\) Synthesis.
The Matlab function for that is h2hinfsyn
(doc).
3.2 Definition of the weights
We define the weights that are used to characterize the dynamic uncertainty of the sensors. This will be used for the \(\mathcal{H}_\infty\) part of the synthesis.
omegac = 100*2*pi; G0 = 0.1; Ginf = 10; w1 = (Ginf*s/omegac + G0)/(s/omegac + 1); omegac = 0.2*2*pi; G0 = 5; Ginf = 0.1; w2 = (Ginf*s/omegac + G0)/(s/omegac + 1); omegac = 5000*2*pi; G0 = 1; Ginf = 50; w2 = w2*(Ginf*s/omegac + G0)/(s/omegac + 1); Dphi = 20; % [deg] n = 4; w0 = 2*pi*900; G0 = 1/sin(Dphi*pi/180); Ginf = 1/100; Gc = 1; wphi = (((1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/Ginf)^(2/n)))*s + (G0/Gc)^(1/n))/((1/Ginf)^(1/n)*(1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/Ginf)^(2/n)))*s + (1/Gc)^(1/n)))^n; W1 = w1*wphi; W2 = w2*wphi;
We define the noise characteristics of the two sensors by choosing \(N_1\) and \(N_2\). This will be used for the \(\mathcal{H}_2\) part of the synthesis.
omegac = 100*2*pi; G0 = 1e-5; Ginf = 1e-4; N1 = (Ginf*s/omegac + G0)/(s/omegac + 1)/(1 + s/2/pi/100); omegac = 1*2*pi; G0 = 1e-3; Ginf = 1e-8; N2 = ((sqrt(Ginf)*s/omegac + sqrt(G0))/(s/omegac + 1))^2/(1 + s/2/pi/4000)^2;
We define the generalized plant that will be used for the mixed synthesis.
W1 = ss(W1); W2 = ss(W2); N1 = ss(N1); N2 = ss(N2); P = [W1 -W1; 0 W2; N1 -N1; 0 N2; 1 0];
3.3 Mixed \(\mathcal{H}_2\) / \(\mathcal{H}_\infty\) Synthesis
Nmeas = 1; Ncon = 1; Nz2 = 2; [H2,~,normz,~] = h2hinfsyn(P, Nmeas, Ncon, Nz2, [1, 1], 'HINFMAX', 2, 'H2MAX', 1, 'DKMAX', 1, 'TOL', 0.01, 'DISPLAY', 'on'); H1 = 1 - H2;
Nmeas = 1; Ncon = 1; Nz2 = 2; [H2,~,normz,~] = h2hinfsyn(P, Nmeas, Ncon, Nz2, [1, 1], 'HINFMAX', 2, 'H2MAX', 1, 'DKMAX', 1, 'TOL', 0.01, 'DISPLAY', 'on'); Optimization of 1.000 * G^2 + 1.000 * H^2 : ---------------------------------------------- Solver for linear objective minimization under LMI constraints Iterations : Best objective value so far 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 3.749873 36 2.525491 37 2.525491 38 2.302555 39 2.302555 40 2.302555 41 2.084831 42 2.084831 43 2.084831 44 2.084831 45 1.923139 46 1.923139 47 1.811169 48 1.811169 49 1.811169 50 1.571754 51 1.571754 52 1.474991 53 1.474991 54 1.426075 55 1.424048 56 1.424048 * switching to QR 57 1.418277 58 1.416028 *** new lower bound: 1.402576 Result: feasible solution of required accuracy best objective value: 1.416028 guaranteed relative accuracy: 9.50e-03 f-radius saturation: 10.090% of R = 1.00e+08 Guaranteed Hinf performance: 1.01e+00 Guaranteed H2 performance: 4.44e-01 H1 = 1 - H2;
3.4 Obtained Super Sensor's noise
PSD_S1 = abs(squeeze(freqresp(N1, freqs, 'Hz'))).^2; PSD_S2 = abs(squeeze(freqresp(N2, freqs, 'Hz'))).^2; PSD_H2 = abs(squeeze(freqresp(N1*H1, freqs, 'Hz'))).^2+abs(squeeze(freqresp(N2*H2, freqs, 'Hz'))).^2;
CPS_S1 = 1/pi*cumtrapz(2*pi*freqs, PSD_S1); CPS_S2 = 1/pi*cumtrapz(2*pi*freqs, PSD_S2); CPS_H2 = 1/pi*cumtrapz(2*pi*freqs, PSD_H2);
3.5 Obtained Super Sensor's Uncertainty
G1 = 1 + w1*ultidyn('Delta',[1 1]); G2 = 1 + w2*ultidyn('Delta',[1 1]);
Gss = G1*H1 + G2*H2; Gsss = usample(Gss, 20);
4 Equivalent Super Sensor
The goal here is to find the parameters of a single sensor that would best represent a super sensor.
4.1 Sensor Fusion Architecture
Let consider figure 26 where two sensors are merged. The dynamic uncertainty of each sensor is represented by a weight \(w_i(s)\), the frequency characteristics each of the sensor noise is represented by the weights \(N_i(s)\). The noise sources \(\tilde{n}_i\) are considered to be white noise: \(\Phi_{\tilde{n}_i}(\omega) = 1, \ \forall\omega\).
\begin{align*} \hat{x} &= H_1(s) N_1(s) \tilde{n}_1 + H_2(s) N_2(s) \tilde{n}_2 \\ &\quad \quad + \Big(H_1(s) \big(1 + w_1(s) \Delta_1(s)\big) + H_2(s) \big(1 + w_2(s) \Delta_2(s)\big)\Big) x \\ &= H_1(s) N_1(s) \tilde{n}_1 + H_2(s) N_2(s) \tilde{n}_2 \\ &\quad \quad + \big(1 + H_1(s) w_1(s) \Delta_1(s) + H_2(s) w_2(s) \Delta_2(s)\big) x \end{align*}To the dynamics of the super sensor is:
\begin{equation} \frac{\hat{x}}{x} = 1 + H_1(s) w_1(s) \Delta_1(s) + H_2(s) w_2(s) \Delta_2(s) \end{equation}And the noise of the super sensor is:
\begin{equation} n_{ss} = H_1(s) N_1(s) \tilde{n}_1 + H_2(s) N_2(s) \tilde{n}_2 \end{equation}4.2 Equivalent Configuration
4.3 Model the uncertainty of the super sensor
At each frequency \(\omega\), the uncertainty set of the super sensor shown on figure 26 is a circle centered on \(1\) with a radius equal to \(|H_1(j\omega) w_1(j\omega)| + |H_2(j\omega) w_2(j\omega)|\) on the complex plane. The uncertainty set of the sensor shown on figure 27 is a circle centered on \(1\) with a radius equal to \(|w_{ss}(j\omega)|\) on the complex plane.
Ideally, we want to find a weight \(w_{ss}(s)\) so that:
\[ |w_{ss}(j\omega)| = |H_1(j\omega) w_1(j\omega)| + |H_2(j\omega) w_2(j\omega)|, \quad \forall\omega \]
4.4 Model the noise of the super sensor
The PSD of the estimation \(\hat{x}\) when \(x = 0\) of the configuration shown on figure 26 is:
\begin{align*} \Phi_{\hat{x}}(\omega) &= | H_1(j\omega) N_1(j\omega) |^2 \Phi_{\tilde{n}_1} + | H_2(j\omega) N_2(j\omega) |^2 \Phi_{\tilde{n}_2} \\ &= | H_1(j\omega) N_1(j\omega) |^2 + | H_2(j\omega) N_2(j\omega) |^2 \end{align*}The PSD of the estimation \(\hat{x}\) when \(x = 0\) of the configuration shown on figure 27 is:
\begin{align*} \Phi_{\hat{x}}(\omega) &= | N_{ss}(j\omega) |^2 \Phi_{\tilde{n}} \\ &= | N_{ss}(j\omega) |^2 \end{align*}Ideally, we want to find a weight \(N_{ss}(s)\) such that:
\[ |N_{ss}(j\omega)|^2 = | H_1(j\omega) N_1(j\omega) |^2 + | H_2(j\omega) N_2(j\omega) |^2 \quad \forall\omega \]
4.5 First guess
We could choose
\begin{align*} w_{ss}(s) &= H_1(s) w_1(s) + H_2(s) w_2(s) \\ N_{ss}(s) &= H_1(s) N_1(s) + H_2(s) N_2(s) \end{align*}But we would have:
\begin{align*} |w_{ss}(j\omega)| &= |H_1(j\omega) w_1(j\omega) + H_2(j\omega) w_2(j\omega)|, \quad \forall\omega \\ &\neq |H_1(j\omega) w_1(j\omega)| + |H_2(j\omega) w_2(j\omega)|, \quad \forall\omega \end{align*}and
\begin{align*} |N_{ss}(j\omega)|^2 &= | H_1(j\omega) N_1(j\omega) + H_2(j\omega) N_2(j\omega) |^2 \quad \forall\omega \\ &\neq | H_1(j\omega) N_1(j\omega)|^2 + |H_2(j\omega) N_2(j\omega) |^2 \quad \forall\omega \\ \end{align*}5 Optimal And Robust Sensor Fusion in Practice
Here are the steps in order to apply optimal and robust sensor fusion:
- Measure the noise characteristics of the sensors to be merged (necessary for "optimal" part of the fusion)
- Measure/Estimate the dynamic uncertainty of the sensors (necessary for "robust" part of the fusion)
- Apply H2/H-infinity synthesis of the complementary filters
5.1 Measurement of the noise characteristics of the sensors
5.1.1 Huddle Test
The technique to estimate the sensor noise is taken from barzilai98_techn_measur_noise_sensor_presen.
Let's consider two sensors (sensor 1 and sensor 2) that are measuring the same quantity \(x\) as shown in figure 28.
Figure 28: Huddle test block diagram
Each sensor has uncorrelated noise \(n_1\) and \(n_2\) and internal dynamics \(G_1(s)\) and \(G_2(s)\) respectively.
We here suppose that each sensor has the same magnitude of instrumental noise: \(n_1 = n_2 = n\). We also assume that their dynamics is ideal: \(G_1(s) = G_2(s) = 1\).
We then have:
\begin{equation} \label{org1d48a5f} \gamma_{\hat{x}_1\hat{x}_2}^2(\omega) = \frac{1}{1 + 2 \left( \frac{|\Phi_n(\omega)|}{|\Phi_{\hat{x}}(\omega)|} \right) + \left( \frac{|\Phi_n(\omega)|}{|\Phi_{\hat{x}}(\omega)|} \right)^2} \end{equation}Since the input signal \(x\) and the instrumental noise \(n\) are incoherent:
\begin{equation} \label{org1fc0cd5} |\Phi_{\hat{x}}(\omega)| = |\Phi_n(\omega)| + |\Phi_x(\omega)| \end{equation}From equations \eqref{org1d48a5f} and \eqref{org1fc0cd5}, we finally obtain
5.1.2 Weights that represents the noises' PSD
For further complementary filter synthesis, it is preferred to consider a normalized noise source \(\tilde{n}\) that has a PSD equal to one (\(\Phi_{\tilde{n}}(\omega) = 1\)) and to use a weighting filter \(N(s)\) in order to represent the frequency dependence of the noise.
The weighting filter \(N(s)\) should be designed such that:
\begin{align*} & \Phi_n(\omega) \approx |N(j\omega)|^2 \Phi_{\tilde{n}}(\omega) \quad \forall \omega \\ \Longleftrightarrow & |N(j\omega)| \approx \sqrt{\Phi_n(\omega)} \quad \forall \omega \end{align*}These weighting filters can then be used to compare the noise level of sensors for the synthesis of complementary filters.
The sensor with a normalized noise input is shown in figure 29.
Figure 29: One sensor with normalized noise
5.1.3 Comparison of the noises' PSD
Once the noise of the sensors to be merged have been characterized, the power spectral density of both sensors have to be compared.
Ideally, the PSD of the noise are such that:
\begin{align*} \Phi_{n_1}(\omega) &< \Phi_{n_2}(\omega) \text{ for } \omega < \omega_m \\ \Phi_{n_1}(\omega) &> \Phi_{n_2}(\omega) \text{ for } \omega > \omega_m \end{align*}5.1.4 Computation of the coherence, power spectral density and cross spectral density of signals
The coherence between signals \(x\) and \(y\) is defined as follow \[ \gamma^2_{xy}(\omega) = \frac{|\Phi_{xy}(\omega)|^2}{|\Phi_{x}(\omega)| |\Phi_{y}(\omega)|} \] where \(|\Phi_x(\omega)|\) is the output Power Spectral Density (PSD) of signal \(x\) and \(|\Phi_{xy}(\omega)|\) is the Cross Spectral Density (CSD) of signal \(x\) and \(y\).
The PSD and CSD are defined as follow:
\begin{align} |\Phi_x(\omega)| &= \frac{2}{n_d T} \sum^{n_d}_{n=1} \left| X_k(\omega, T) \right|^2 \\ |\Phi_{xy}(\omega)| &= \frac{2}{n_d T} \sum^{n_d}_{n=1} [ X_k^*(\omega, T) ] [ Y_k(\omega, T) ] \end{align}where:
- \(n_d\) is the number for records averaged
- \(T\) is the length of each record
- \(X_k(\omega, T)\) is the finite Fourier transform of the \(k^{\text{th}}\) record
- \(X_k^*(\omega, T)\) is its complex conjugate
5.2 Estimate the dynamic uncertainty of the sensors
Let's consider one sensor represented on figure 30.
The dynamic uncertainty is represented by an input multiplicative uncertainty where \(w(s)\) is a weight that represents the level of the uncertainty.
The goal is to accurately determine \(w(s)\) for the sensors that have to be merged.
Figure 30: Sensor with dynamic uncertainty
5.3 Optimal and Robust synthesis of the complementary filters
Once the noise characteristics and dynamic uncertainty of both sensors have been determined and we have determined the following weighting functions:
- \(w_1(s)\) and \(w_2(s)\) representing the dynamic uncertainty of both sensors
- \(N_1(s)\) and \(N_2(s)\) representing the noise characteristics of both sensors
The goal is to design complementary filters \(H_1(s)\) and \(H_2(s)\) shown in figure 26 such that:
- the uncertainty on the super sensor dynamics is minimized
- the noise sources \(\tilde{n}_1\) and \(\tilde{n}_2\) has the lowest possible effect on the estimation \(\hat{x}\)
Figure 31: Sensor fusion architecture with sensor dynamics uncertainty
6 Methods of complementary filter synthesis
6.1 Complementary filters using analytical formula
All the files (data and Matlab scripts) are accessible here.
6.1.1 Analytical 1st order complementary filters
First order complementary filters are defined with following equations:
\begin{align} H_L(s) = \frac{1}{1 + \frac{s}{\omega_0}}\\ H_H(s) = \frac{\frac{s}{\omega_0}}{1 + \frac{s}{\omega_0}} \end{align}Their bode plot is shown figure 32.
w0 = 2*pi; % [rad/s] Hh1 = (s/w0)/((s/w0)+1); Hl1 = 1/((s/w0)+1);
6.1.2 Second Order Complementary Filters
We here use analytical formula for the complementary filters \(H_L\) and \(H_H\).
The first two formulas that are used to generate complementary filters are:
\begin{align*} H_L(s) &= \frac{(1+\alpha) (\frac{s}{\omega_0})+1}{\left((\frac{s}{\omega_0})+1\right) \left((\frac{s}{\omega_0})^2 + \alpha (\frac{s}{\omega_0}) + 1\right)}\\ H_H(s) &= \frac{(\frac{s}{\omega_0})^2 \left((\frac{s}{\omega_0})+1+\alpha\right)}{\left((\frac{s}{\omega_0})+1\right) \left((\frac{s}{\omega_0})^2 + \alpha (\frac{s}{\omega_0}) + 1\right)} \end{align*}where:
- \(\omega_0\) is the blending frequency in rad/s.
- \(\alpha\) is used to change the shape of the filters:
- Small values for \(\alpha\) will produce high magnitude of the filters \(|H_L(j\omega)|\) and \(|H_H(j\omega)|\) near \(\omega_0\) but smaller value for \(|H_L(j\omega)|\) above \(\approx 1.5 \omega_0\) and for \(|H_H(j\omega)|\) below \(\approx 0.7 \omega_0\)
- A large \(\alpha\) will do the opposite
This is illustrated on figure 33. The slope of those filters at high and low frequencies is \(-2\) and \(2\) respectively for \(H_L\) and \(H_H\).
Figure 33: Effect of the parameter \(\alpha\) on the shape of the generated second order complementary filters (png, pdf)
We now study the maximum norm of the filters function of the parameter \(\alpha\). As we saw that the maximum norm of the filters is important for the robust merging of filters.
figure; plot(alphas, infnorms) set(gca, 'xscale', 'log'); set(gca, 'yscale', 'log'); xlabel('$\alpha$'); ylabel('$\|H_1\|_\infty$');
6.1.3 Third Order Complementary Filters
The following formula gives complementary filters with slopes of \(-3\) and \(3\):
\begin{align*} H_L(s) &= \frac{\left(1+(\alpha+1)(\beta+1)\right) (\frac{s}{\omega_0})^2 + (1+\alpha+\beta)(\frac{s}{\omega_0}) + 1}{\left(\frac{s}{\omega_0} + 1\right) \left( (\frac{s}{\omega_0})^2 + \alpha (\frac{s}{\omega_0}) + 1 \right) \left( (\frac{s}{\omega_0})^2 + \beta (\frac{s}{\omega_0}) + 1 \right)}\\ H_H(s) &= \frac{(\frac{s}{\omega_0})^3 \left( (\frac{s}{\omega_0})^2 + (1+\alpha+\beta) (\frac{s}{\omega_0}) + (1+(\alpha+1)(\beta+1)) \right)}{\left(\frac{s}{\omega_0} + 1\right) \left( (\frac{s}{\omega_0})^2 + \alpha (\frac{s}{\omega_0}) + 1 \right) \left( (\frac{s}{\omega_0})^2 + \beta (\frac{s}{\omega_0}) + 1 \right)} \end{align*}The parameters are:
- \(\omega_0\) is the blending frequency in rad/s
- \(\alpha\) and \(\beta\) that are used to change the shape of the filters similarly to the parameter \(\alpha\) for the second order complementary filters
The filters are defined below and the result is shown on figure 35.
alpha = 1; beta = 10; w0 = 2*pi*14; Hh3_ana = (s/w0)^3 * ((s/w0)^2 + (1+alpha+beta)*(s/w0) + (1+(alpha+1)*(beta+1)))/((s/w0 + 1)*((s/w0)^2+alpha*(s/w0)+1)*((s/w0)^2+beta*(s/w0)+1)); Hl3_ana = ((1+(alpha+1)*(beta+1))*(s/w0)^2 + (1+alpha+beta)*(s/w0) + 1)/((s/w0 + 1)*((s/w0)^2+alpha*(s/w0)+1)*((s/w0)^2+beta*(s/w0)+1));
6.2 H-Infinity synthesis of complementary filters
All the files (data and Matlab scripts) are accessible here.
6.2.1 Synthesis Architecture
We here synthesize the complementary filters using the \(\mathcal{H}_\infty\) synthesis. The goal is to specify upper bounds on the norms of \(H_L\) and \(H_H\) while ensuring their complementary property (\(H_L + H_H = 1\)).
In order to do so, we use the generalized plant shown on figure 36 where \(w_L\) and \(w_H\) weighting transfer functions that will be used to shape \(H_L\) and \(H_H\) respectively.
Figure 36: Generalized plant used for the \(\mathcal{H}_\infty\) synthesis of the complementary filters
The \(\mathcal{H}_\infty\) synthesis applied on this generalized plant will give a transfer function \(H_L\) (figure 37) such that the \(\mathcal{H}_\infty\) norm of the transfer function from \(w\) to \([z_H,\ z_L]\) is less than one: \[ \left\| \begin{array}{c} H_L w_L \\ (1 - H_L) w_H \end{array} \right\|_\infty < 1 \]
Thus, if the above condition is verified, we can define \(H_H = 1 - H_L\) and we have that: \[ \left\| \begin{array}{c} H_L w_L \\ H_H w_H \end{array} \right\|_\infty < 1 \] Which is almost (with an maximum error of \(\sqrt{2}\)) equivalent to:
\begin{align*} |H_L| &< \frac{1}{|w_L|}, \quad \forall \omega \\ |H_H| &< \frac{1}{|w_H|}, \quad \forall \omega \end{align*}We then see that \(w_L\) and \(w_H\) can be used to shape both \(H_L\) and \(H_H\) while ensuring (by definition of \(H_H = 1 - H_L\)) their complementary property.
Figure 37: \(\mathcal{H}_\infty\) synthesis of the complementary filters
6.2.2 Weights
6.2.3 H-Infinity Synthesis
We define the generalized plant \(P\) on matlab.
P = [0 wL; wH -wH; 1 0];
And we do the \(\mathcal{H}_\infty\) synthesis using the hinfsyn
command.
[Hl_hinf, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on');
[Hl_hinf, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on'); Test bounds: 0.0000 < gamma <= 1.7285 gamma hamx_eig xinf_eig hamy_eig yinf_eig nrho_xy p/f 1.729 4.1e+01 8.4e-12 1.8e-01 0.0e+00 0.0000 p 0.864 3.9e+01 -5.8e-02# 1.8e-01 0.0e+00 0.0000 f 1.296 4.0e+01 8.4e-12 1.8e-01 0.0e+00 0.0000 p 1.080 4.0e+01 8.5e-12 1.8e-01 0.0e+00 0.0000 p 0.972 3.9e+01 -4.2e-01# 1.8e-01 0.0e+00 0.0000 f 1.026 4.0e+01 8.5e-12 1.8e-01 0.0e+00 0.0000 p 0.999 3.9e+01 8.5e-12 1.8e-01 0.0e+00 0.0000 p 0.986 3.9e+01 -1.2e+00# 1.8e-01 0.0e+00 0.0000 f 0.993 3.9e+01 -8.2e+00# 1.8e-01 0.0e+00 0.0000 f 0.996 3.9e+01 8.5e-12 1.8e-01 0.0e+00 0.0000 p 0.994 3.9e+01 8.5e-12 1.8e-01 0.0e+00 0.0000 p 0.993 3.9e+01 -3.2e+01# 1.8e-01 0.0e+00 0.0000 f Gamma value achieved: 0.9942
We then define the high pass filter \(H_H = 1 - H_L\). The bode plot of both \(H_L\) and \(H_H\) is shown on figure 39.
Hh_hinf = 1 - Hl_hinf;
6.3 Feedback Control Architecture to generate Complementary Filters
The idea is here to use the fact that in a classical feedback architecture, \(S + T = 1\), in order to design complementary filters.
Thus, all the tools that has been developed for classical feedback control can be used for complementary filter design.
All the files (data and Matlab scripts) are accessible here.
6.3.1 Architecture
Figure 40: Architecture used to generate the complementary filters
We have: \[ y = \underbrace{\frac{L}{L + 1}}_{H_L} y_1 + \underbrace{\frac{1}{L + 1}}_{H_H} y_2 \] with \(H_L + H_H = 1\).
The only thing to design is \(L\) such that the complementary filters are stable with the wanted shape.
A simple choice is: \[ L = \left(\frac{\omega_c}{s}\right)^2 \frac{\frac{s}{\omega_c / \alpha} + 1}{\frac{s}{\omega_c} + \alpha} \]
Which contains two integrator and a lead. \(\omega_c\) is used to tune the crossover frequency and \(\alpha\) the trade-off "bump" around blending frequency and filtering away from blending frequency.
6.3.2 Loop Gain Design
6.4 Analytical Formula found in the literature
6.4.1 Analytical Formula
min15_compl_filter_desig_angle_estim
\begin{align*} H_L(s) = \frac{K_p s + K_i}{s^2 + K_p s + K_i} \\ H_H(s) = \frac{s^2}{s^2 + K_p s + K_i} \end{align*}corke04_inert_visual_sensin_system_small_auton_helic
\begin{align*} H_L(s) = \frac{1}{s/p + 1} \\ H_H(s) = \frac{s/p}{s/p + 1} \end{align*} \begin{align*} H_L(s) = \frac{2 \omega_0 s + \omega_0^2}{(s + \omega_0)^2} \\ H_H(s) = \frac{s^2}{(s + \omega_0)^2} \end{align*} \begin{align*} H_L(s) = \frac{C(s)}{C(s) + s} \\ H_H(s) = \frac{s}{C(s) + s} \end{align*} \begin{align*} H_L(s) = \frac{3 \tau s + 1}{(\tau s + 1)^3} \\ H_H(s) = \frac{\tau^3 s^3 + 3 \tau^2 s^2}{(\tau s + 1)^3} \end{align*} \begin{align*} H_L(s) = \frac{2 \tau s + 1}{(\tau s + 1)^2} \\ H_H(s) = \frac{\tau^2 s^2}{(\tau s + 1)^2} \end{align*}6.4.2 Matlab
omega0 = 1*2*pi; % [rad/s] tau = 1/omega0; % [s] % From cite:corke04_inert_visual_sensin_system_small_auton_helic HL1 = 1/(s/omega0 + 1); HH1 = s/omega0/(s/omega0 + 1); % From cite:jensen13_basic_uas HL2 = (2*omega0*s + omega0^2)/(s+omega0)^2; HH2 = s^2/(s+omega0)^2; % From cite:shaw90_bandw_enhan_posit_measur_using_measur_accel HL3 = (3*tau*s + 1)/(tau*s + 1)^3; HH3 = (tau^3*s^3 + 3*tau^2*s^2)/(tau*s + 1)^3;
6.4.3 Discussion
Analytical Formula found in the literature provides either no parameter for tuning the robustness / performance trade-off.
6.5 Comparison of the different methods of synthesis
The generated complementary filters using \(\mathcal{H}_\infty\) and the analytical formulas are very close to each other. However there is some difference to note here:
- the analytical formula provides a very simple way to generate the complementary filters (and thus the controller), they could even be used to tune the controller online using the parameters \(\alpha\) and \(\omega_0\). However, these formula have the property that \(|H_H|\) and \(|H_L|\) are symmetrical with the frequency \(\omega_0\) which may not be desirable.
- while the \(\mathcal{H}_\infty\) synthesis of the complementary filters is not as straightforward as using the analytical formula, it provides a more optimized procedure to obtain the complementary filters
Bibliography
- [barzilai98_techn_measur_noise_sensor_presen] Aaron Barzilai, Tom VanZandt & Tom Kenny, Technique for Measurement of the Noise of a Sensor in the Presence of Large Background Signals, Review of Scientific Instruments, 69(7), 2767-2772 (1998). link. doi.
- [min15_compl_filter_desig_angle_estim] Min & Jeung, Complementary Filter Design for Angle Estimation Using Mems Accelerometer and Gyroscope, Department of Control and Instrumentation, Changwon National University, Changwon, Korea, 641-773 (2015).
- [corke04_inert_visual_sensin_system_small_auton_helic] Peter Corke, An Inertial and Visual Sensing System for a Small Autonomous Helicopter, Journal of Robotic Systems, 21(2), 43-51 (2004). link. doi.
- [jensen13_basic_uas] Austin Jensen, Cal Coopmans & YangQuan Chen, Basics and guidelines of complementary filters for small UAS navigation, nil, in in: 2013 International Conference on Unmanned Aircraft Systems (ICUAS), edited by (2013)
- [shaw90_bandw_enhan_posit_measur_using_measur_accel] Shaw & Srinivasan, Bandwidth Enhancement of Position Measurements Using Measured Acceleration, Mechanical Systems and Signal Processing, 4(1), 23-38 (1990). link. doi.
- [baerveldt97_low_cost_low_weigh_attit] Baerveldt & Klang, A Low-Cost and Low-Weight Attitude Estimation System for an Autonomous Helicopter, nil, in in: Proceedings of IEEE International Conference on Intelligent Engineering Systems, edited by (1997)