4.2.3 Complementary Filters
A complementary filter is one of the simplest and most useful sensor-fusion methods for combining measurements from sensors that possess complementary error characteristics.
The central idea is not to simply average two measurements.
Instead, each sensor is trusted in the portion of the frequency spectrum where it provides the most useful information.
For spacecraft attitude estimation, a classic example is the combination of
\[ \boxed{ \text{Gyroscope} + \text{Absolute Attitude Reference} }. \]
The gyroscope provides excellent short-term information about changes in attitude. It normally operates at a relatively high rate and captures rapid rotational motion well.
However, gyroscope bias and noise accumulate when angular-rate measurements are integrated, causing the attitude estimate to drift with time.
An absolute attitude reference—such as a star tracker, Sun-sensor-based attitude solution, magnetometer-based attitude solution, or another externally referenced measurement—does not suffer from the same unbounded integration drift.
However, the absolute reference may update more slowly, contain measurement noise, experience dropouts, or become unavailable under certain operating conditions.
The complementary filter exploits these different characteristics:
\[ \boxed{ \text{Gyro} \rightarrow \text{Short-Term / High-Frequency Information} } \]
and
\[ \boxed{ \text{Absolute Reference} \rightarrow \text{Long-Term / Low-Frequency Information} }. \]
The two are combined to obtain
\[ \boxed{ \text{Stable + Responsive Attitude Estimate} }. \]
The fundamental principle is therefore
\[ \boxed{ \text{Use Each Sensor Where It Is Strongest} } \]
rather than
\[ \boxed{ \text{Simply Average All Measurements} }. \]
4.2.3.1 Why Is a Complementary Filter Needed?
Consider a spacecraft equipped with a gyroscope and an absolute attitude sensor.
Suppose the gyroscope measures angular velocity
\[ \boldsymbol{\omega}_m \]
and the absolute attitude sensor provides a reference measurement
\[ \boldsymbol{\theta}_{abs}. \]
For a simple single-axis example, the gyro measurement can be written as
\[ \boxed{ \omega_m(t) = \omega(t) + b_g(t) + n_g(t) }. \]
where
- \(\omega(t)\) is the true angular rate,
- \(b_g(t)\) is gyroscope bias,
- \(n_g(t)\) is gyroscope measurement noise.
Attitude can be obtained by integrating angular rate:
\[ \theta_g(t) = \theta_g(0) + \int_0^t \omega_m(\tau) d\tau. \]
Substituting the measurement model gives
\[ \theta_g(t) = \theta(0) + \int_0^t \omega(\tau)d\tau + \int_0^t b_g(\tau)d\tau + \int_0^t n_g(\tau)d\tau. \]
The desired attitude information is contained in the first two terms.
The remaining terms create estimation error.
4.2.3.1.1 Effect of Constant Gyro Bias
If the bias is approximately constant,
\[ b_g(t) \approx b_g, \]
then
\[ \int_0^t b_g d\tau = b_g t. \]
Therefore, the attitude error grows approximately as
\[ \boxed{ \delta\theta_g(t) \approx b_g t }. \]
This explains a fundamental property of inertial attitude propagation:
\[ \boxed{ \text{Excellent Short-Term Response} + \text{Poor Long-Term Absolute Stability} }. \]
4.2.3.2 Why Not Use Only the Absolute Attitude Sensor?
Suppose the absolute attitude measurement is
\[ \boxed{ \theta_a(t) = \theta(t) + n_a(t) }. \]
Unlike the gyro-integrated attitude, this measurement is referenced to an external physical quantity.
For example,
- a star tracker uses observed star directions,
- a Sun sensor uses the Sun direction,
- a magnetometer uses the local geomagnetic-field direction.
Its error therefore does not necessarily accumulate indefinitely simply because time passes.
This makes the absolute sensor valuable for long-term reference.
However, an absolute sensor may also suffer from
- lower update rate,
- measurement noise,
- processing latency,
- field-of-view restrictions,
- blinding conditions,
- temporary dropouts,
- acquisition time,
- invalid solutions for certain spacecraft geometries.
Therefore, in the complementary-filter context,
\[ \boxed{ \text{Absolute Sensor} = \text{Good Long-Term Reference} + \text{Limited Short-Term Dynamic Capability} }. \]
The exact behaviour depends on the actual instrument. The important point is the complementary nature of the errors rather than a universal assumption that every absolute sensor is slow.
4.2.3.3 Complementary Sensor Characteristics
The gyroscope and absolute attitude reference contribute different kinds of useful information.
| Property | Gyroscope | Absolute Attitude Reference |
|---|---|---|
| Measured quantity | Angular rate | Absolute/reference attitude information |
| Typical role | Propagation | Correction |
| Short-term response | Excellent | Sensor dependent |
| Rapid rotational motion | Excellent | May be limited by update rate or processing |
| Long-term drift | Yes, after integration | Bounded by reference errors |
| Bias sensitivity | High | Different error mechanism |
| Update rate | Usually high | Often lower |
| Dropout vulnerability | Usually low while operating | Can be significant |
| Main contribution | High-frequency attitude dynamics | Low-frequency absolute reference |
The complementarity can therefore be summarised as
\[ \boxed{ \text{Gyro} \Rightarrow \text{High-Frequency Motion} } \]
and
\[ \boxed{ \text{Absolute Reference} \Rightarrow \text{Low-Frequency Correction} }. \]
4.2.3.4 Frequency-Domain Interpretation
Let the gyro-derived attitude estimate be
\[ \Theta_g(s) \]
and the absolute attitude measurement be
\[ \Theta_a(s). \]
A complementary filter combines the two using a high-pass and low-pass transfer function:
\[ \boxed{ \hat{\Theta}(s) = H_{HP}(s)\Theta_g(s) + H_{LP}(s)\Theta_a(s) }. \]
For a first-order complementary filter,
\[ \boxed{ H_{LP}(s) = \frac{1}{\tau s+1} } \]
and
\[ \boxed{ H_{HP}(s) = \frac{\tau s}{\tau s+1} }. \]
Adding the two transfer functions gives
\[ H_{LP}(s) + H_{HP}(s) = \frac{1+\tau s}{1+\tau s} = 1. \]
Therefore,
\[ \boxed{ H_{LP}(s) + H_{HP}(s) = 1 }. \]
This is the mathematical reason the filter is called complementary.
4.2.3.5 What Does the Low-Pass Branch Do?
The low-pass transfer function is
\[ H_{LP}(s) = \frac{1}{1+\tau s}. \]
At low frequency,
\[ s \rightarrow 0, \]
so
\[ H_{LP}(s) \rightarrow 1. \]
Slowly varying information from the absolute reference therefore passes strongly into the estimate.
At high frequency,
\[ \left| H_{LP}(j\omega) \right| \rightarrow 0. \]
High-frequency measurement fluctuations are therefore attenuated.
Conceptually,
\[ \boxed{\text{Absolute Attitude}} \rightarrow \boxed{\text{Low-Pass Filter}} \rightarrow \boxed{\text{Long-Term Reference}}. \]
4.2.3.6 What Does the High-Pass Branch Do?
The complementary high-pass transfer function is
\[ H_{HP}(s) = \frac{\tau s}{1+\tau s}. \]
At very low frequency,
\[ H_{HP}(s) \rightarrow 0. \]
Slowly varying gyro-derived errors, including long-term drift, are therefore suppressed.
At sufficiently high frequency,
\[ \left| H_{HP}(j\omega) \right| \rightarrow 1. \]
Rapid attitude changes represented by the gyro-derived solution are retained.
Conceptually,
\[ \boxed{\text{Gyroscope}} \rightarrow \boxed{\text{High-Pass Contribution}} \rightarrow \boxed{\text{Short-Term Dynamics}}. \]
The filter therefore seeks
\[ \boxed{ \text{Fast Gyro Response} + \text{Slow Absolute Correction} }. \]
4.2.3.7 Cutoff Frequency
The first-order cutoff frequency is related to the filter time constant by
\[ \boxed{ \omega_c = \frac{1}{\tau} } \]
in rad/s, or
\[ \boxed{ f_c = \frac{1}{2\pi\tau} } \]
in Hz.
The cutoff frequency determines approximately where responsibility transitions from the absolute reference to the gyro-derived attitude.
Below the crossover region,
\[ \boxed{\text{Absolute Reference Dominates}} \]
while above the crossover region,
\[ \boxed{\text{Gyro-Derived Dynamics Dominate}}. \]
At
\[ \omega = \omega_c, \]
the branch magnitudes are
\[ \boxed{ |H_{LP}(j\omega_c)| = |H_{HP}(j\omega_c)| = \frac{1}{\sqrt{2}} }. \]
This corresponds to approximately \(-3\) dB.
4.2.3.8 Physical Meaning of the Time Constant
The parameter
\[ \tau \]
controls how quickly the estimate is pulled back toward the absolute attitude reference.
A smaller \(\tau\) produces a higher cutoff frequency:
\[ \boxed{ \tau \downarrow \Rightarrow \text{Faster Absolute-Sensor Correction} }. \]
A larger \(\tau\) produces a lower cutoff frequency:
\[ \boxed{ \tau \uparrow \Rightarrow \text{Greater Short-Term Reliance on Gyro} }. \]
Therefore \(\tau\) is one of the main tuning parameters of a first-order complementary filter.
4.2.3.9 Discrete-Time Complementary Filter
For implementation, the complementary filter is often more intuitive in discrete time.
Suppose the previous fused attitude estimate is
\[ \hat{\theta}_{k-1}. \]
The gyro predicts the next attitude:
\[ \boxed{ \theta_{g,k} = \hat{\theta}_{k-1} + \omega_{m,k}\Delta t }. \]
The absolute sensor provides
\[ \theta_{a,k}. \]
The complementary estimate is
\[ \boxed{ \hat{\theta}_k = \alpha \left( \hat{\theta}_{k-1} + \omega_{m,k}\Delta t \right) + (1-\alpha)\theta_{a,k} }. \]
where
\[ 0 < \alpha < 1. \]
This equation contains three operations:
- propagate the previous attitude using the gyro,
- receive an independent absolute attitude observation,
- combine the propagated state with the reference.
4.2.3.10 Relationship Between \(\alpha\), \(\tau\), and Sampling Time
For one common first-order discretization,
\[ \boxed{ \alpha = \frac{\tau}{\tau+\Delta t} }. \]
Therefore,
\[ \boxed{ 1-\alpha = \frac{\Delta t}{\tau+\Delta t} }. \]
If
\[ \alpha \approx 1, \]
the filter relies strongly on the gyro-propagated attitude.
As \(\alpha\) decreases, the absolute reference receives greater influence.
However, \(\alpha\) should not be interpreted as a simple “percentage trust” parameter without considering the sampling interval.
The same numerical \(\alpha\) at two different values of \(\Delta t\) corresponds to different effective filter dynamics.
Therefore, tuning should preferably begin from
\[ \boxed{ \tau \quad\text{or}\quad f_c } \]
and then derive the discrete coefficient.
4.2.3.11 Prediction–Correction Interpretation
The same complementary filter can be rewritten in a form that connects directly with the state-estimation framework introduced earlier.
First, predict the attitude:
\[ \boxed{ \hat{\theta}_k^- = \hat{\theta}_{k-1}^+ + \omega_{m,k}\Delta t }. \]
The absolute sensor provides
\[ z_k = \theta_{a,k}. \]
Define the attitude residual:
\[ \boxed{ e_k = z_k - \hat{\theta}_k^- }. \]
Then apply the correction:
\[ \boxed{ \hat{\theta}_k^+ = \hat{\theta}_k^- + K_c e_k }. \]
where
\[ K_c = 1-\alpha. \]
Therefore,
\[ \boxed{\text{Predict with Gyro}} \rightarrow \boxed{\text{Compare with Reference}} \rightarrow \boxed{\text{Correct}}. \]
This already resembles the general estimation structure
\[ \boxed{ \text{Prediction} + \text{Innovation} + \text{Correction} }. \]
The key difference is that complementary-filter gains are normally selected explicitly by the designer, rather than computed from a propagated covariance as in a Kalman filter.
4.2.3.12 Why This Is Not Just Weighted Averaging
The expression
\[ \hat{\theta} = \alpha\theta_g + (1-\alpha)\theta_a \]
may look like an ordinary weighted average.
However,
\[ \theta_g \]
is not simply another static sensor reading.
It contains the dynamically propagated history of angular-rate measurements.
Therefore, the complementary filter should be understood as
\[ \boxed{ \text{Dynamic Propagation} + \text{Reference Correction} } \]
rather than
\[ \boxed{ \text{Sensor A Average Sensor B} }. \]
4.2.3.13 Example: Single-Axis Spacecraft Attitude
Consider a spacecraft rotating about one body axis.
The gyroscope measures
\[ \omega_m = \omega + b_g + n_g. \]
The propagated attitude is
\[ \hat{\theta}_k^- = \hat{\theta}_{k-1} + \omega_{m,k}\Delta t. \]
Suppose a star tracker supplies
\[ \theta_{ST,k}. \]
The complementary estimate becomes
\[ \boxed{ \hat{\theta}_k = \alpha\hat{\theta}_k^- + (1-\alpha)\theta_{ST,k} }. \]
If the gyro drifts slowly, the star tracker repeatedly pulls the solution back toward the absolute reference.
If the spacecraft performs a rapid maneuver between star-tracker measurements, the gyro continues to propagate attitude at high rate.
4.2.3.14 Gyroscope + Star Tracker Fusion
One of the most useful spacecraft applications is
\[ \boxed{ \text{Gyroscope} + \text{Star Tracker} }. \]
The gyro supplies high-rate angular-motion information.
The star tracker supplies highly accurate absolute attitude information.
A simplified architecture is
\[ \boxed{\text{Gyroscope}} \rightarrow \boxed{\text{Attitude Propagation}} \]
in parallel with
\[ \boxed{\text{Star Tracker}} \rightarrow \boxed{\text{Absolute Attitude Correction}} \]
followed by
\[ \boxed{\text{Complementary Fusion}} \rightarrow \boxed{\hat{\mathbf q}}. \]
This provides an intuitive conceptual bridge to more advanced spacecraft attitude estimators such as the MEKF.
4.2.3.15 Gyroscope + Sun Sensor Fusion
A Sun sensor provides a measured Sun direction in the sensor or spacecraft body frame.
A simplified measurement model is
\[ \boxed{ \mathbf s_m^B = \mathbf C_I^B(\mathbf q) \mathbf s^I + \mathbf n_s }. \]
The gyro propagates attitude between Sun-sensor measurements.
The Sun direction can then correct the attitude components that are observable from that vector.
However, one reference vector alone does not generally determine the full three-axis spacecraft attitude.
Rotation about the measured vector remains unobservable from that vector alone.
Therefore,
\[ \boxed{ \text{Gyro + One Sun Vector} } \]
does not automatically provide complete three-axis absolute attitude observability.
4.2.3.16 Gyroscope + Magnetometer Fusion
A magnetometer measures the geomagnetic-field vector in the spacecraft frame.
A simplified model is
\[ \boxed{ \mathbf B_m^B = \mathbf C_I^B(\mathbf q) \mathbf B^I + \mathbf b_m + \mathbf n_m }. \]
The gyroscope again provides high-rate attitude propagation.
The magnetometer provides an external reference vector.
However, magnetometer measurements can be affected by
- spacecraft-generated magnetic fields,
- hard-iron effects,
- soft-iron effects,
- current-dependent disturbances,
- sensor misalignment,
- geomagnetic-model error.
A complementary filter cannot compensate for a fundamentally incorrect measurement model.
In practical terms,
\[ \boxed{ \text{Fusion Quality} \le \text{Quality of Models and Measurements} }. \]
4.2.3.17 Gyro + Sun Sensor + Magnetometer
Two non-collinear reference vectors provide much stronger attitude observability than a single vector.
For example,
\[ \boxed{ \text{Sun Direction} + \text{Magnetic Field Direction} } \]
can be used to construct an absolute attitude solution using an algorithm such as TRIAD or another vector-based attitude-determination method.
That attitude solution can then be fused with gyro propagation:
\[ \boxed{ \text{Gyro Propagation} + \text{Sun/Magnetic Absolute Attitude} } \rightarrow \boxed{\text{Complementary Attitude Estimate}}. \]
This is a more realistic three-axis spacecraft example than treating a single vector measurement as a complete attitude observation.
4.2.3.18 Why Gyroscope Bias Is So Important
Recall the gyro measurement
\[ \omega_m = \omega + b_g + n_g. \]
A simple complementary filter can suppress the attitude drift created by the bias whenever a valid absolute reference is available.
However, the bias remains present in the raw gyro signal.
During a long absolute-sensor outage, the attitude estimate will again begin to drift.
This motivates estimating the gyro bias explicitly:
\[ \boxed{ \text{Estimate Attitude} + \text{Estimate Gyro Bias} }. \]
A bias-corrected angular rate is
\[ \boxed{ \omega_c = \omega_m - \hat b_g }. \]
Attitude propagation then uses \(\omega_c\) rather than the raw gyro measurement.
4.2.3.19 PI-Type Complementary Filter
A more advanced complementary filter can use proportional and integral correction.
Let the attitude error signal be
\[ e(t) = \theta_a(t) - \hat{\theta}(t). \]
A simple continuous-time structure is
\[ \boxed{ \dot{\hat{\theta}} = \omega_m - \hat b_g + K_P e } \]
with bias estimate
\[ \boxed{ \dot{\hat b}_g = -K_I e }. \]
Here,
- \(K_P\) corrects the attitude error,
- \(K_I\) adjusts the estimated gyro bias more slowly.
The integral action allows persistent attitude disagreement to be interpreted as evidence of gyro bias.
Conceptually,
\[ \boxed{\text{Attitude Residual}} \rightarrow \begin{cases} \text{Fast Attitude Correction}\\ \text{Slow Bias Correction} \end{cases} \]
This begins to resemble a practical attitude observer rather than a simple weighted average.
4.2.3.20 Three-Axis Attitude Is Not Three Independent Angles
For simple educational examples, roll, pitch, and yaw may be filtered independently.
For a real spacecraft, this approach becomes problematic.
Spacecraft attitude belongs to the nonlinear rotation group
\[ SO(3). \]
Large rotations are coupled, and Euler angles contain singularities and coordinate-dependent behaviour.
Practical spacecraft attitude fusion therefore normally uses
\[ \boxed{\text{Quaternion}} \]
or
\[ \boxed{\text{Rotation Matrix}} \]
rather than three independent scalar complementary filters.
4.2.3.21 Quaternion Attitude Propagation
Let the attitude quaternion be
\[ \mathbf q = \begin{bmatrix} q_0\\ q_1\\ q_2\\ q_3 \end{bmatrix}. \]
Using the bias-corrected angular rate
\[ \boldsymbol{\omega}_c = \boldsymbol{\omega}_m - \hat{\mathbf b}_g, \]
quaternion kinematics can be written as
\[ \boxed{ \dot{\mathbf q} = \frac{1}{2} \Omega(\boldsymbol{\omega}_c) \mathbf q }. \]
One common form of the angular-rate matrix is
\[ \Omega(\boldsymbol{\omega}) = \begin{bmatrix} 0 & -\omega_x & -\omega_y & -\omega_z\\ \omega_x & 0 & \omega_z & -\omega_y\\ \omega_y & -\omega_z & 0 & \omega_x\\ \omega_z & \omega_y & -\omega_x & 0 \end{bmatrix}. \]
The exact signs depend on the quaternion convention, multiplication order, and frame definition.
Therefore, the convention must be documented and used consistently.
4.2.3.21.1 Quaternion Normalization
Numerical propagation may cause small deviations from unit norm.
Therefore,
\[ \boxed{ \mathbf q \leftarrow \frac{\mathbf q} {\|\mathbf q\|} } \]
should be applied as appropriate to maintain a valid unit quaternion.
4.2.3.22 Quaternion Correction
Suppose gyro propagation produces
\[ \mathbf q_k^- \]
while the absolute attitude sensor supplies
\[ \mathbf q_{a,k}. \]
A quaternion attitude error can be formed as
\[ \boxed{ \delta\mathbf q = \mathbf q_{a,k} \otimes (\mathbf q_k^-)^{-1} } \]
for one chosen convention.
This quaternion represents the rotation required to move the predicted attitude toward the measured attitude.
For small attitude errors,
\[ \delta\mathbf q \approx \begin{bmatrix} 1\\ \frac{1}{2}\delta\boldsymbol{\theta} \end{bmatrix}. \]
The vector
\[ \delta\boldsymbol{\theta} \]
can therefore be used as a small-angle correction signal.
The geometric correction process is
\[ \boxed{\text{Propagate Quaternion with Gyro}} \]
\[ \downarrow \]
\[ \boxed{\text{Compute Rotation Error from Reference}} \]
\[ \downarrow \]
\[ \boxed{\text{Apply Partial Correction}}. \]
4.2.3.23 Quaternion Sign Ambiguity
A quaternion possesses the property
\[ \boxed{ \mathbf q \equiv -\mathbf q }. \]
Both quaternions represent the same physical orientation.
For example,
\[ \mathbf q_1 = \begin{bmatrix} 1\\0\\0\\0 \end{bmatrix} \]
and
\[ \mathbf q_2 = \begin{bmatrix} -1\\0\\0\\0 \end{bmatrix} \]
describe the same attitude.
A naive arithmetic blend could incorrectly treat them as opposite orientations.
Therefore quaternion sign consistency should be enforced before interpolation or attitude-error computation.
A common test is
\[ \mathbf q_1^T \mathbf q_2. \]
If the dot product is negative, one quaternion may be sign-flipped before further processing.
4.2.3.24 Complementary Filtering Using Reference Vectors
A spacecraft does not always receive a complete absolute attitude quaternion.
It may instead receive physical reference vectors.
For example,
\[ \mathbf s^B \]
from a Sun sensor and
\[ \mathbf B^B \]
from a magnetometer.
The expected body-frame Sun vector can be calculated from the current attitude estimate:
\[ \hat{\mathbf s}^B = \mathbf C_I^B(\hat{\mathbf q}) \mathbf s^I. \]
Similarly,
\[ \hat{\mathbf B}^B = \mathbf C_I^B(\hat{\mathbf q}) \mathbf B^I. \]
A vector misalignment error can be constructed using a cross product:
\[ \boxed{ \mathbf e_s = \hat{\mathbf s}^B \times \mathbf s_m^B }. \]
Similarly,
\[ \boxed{ \mathbf e_B = \hat{\mathbf B}^B \times \mathbf B_m^B }. \]
A combined correction can be formed as
\[ \boxed{ \mathbf e = w_s\mathbf e_s + w_B\mathbf e_B }. \]
The weights \(w_s\) and \(w_B\) reflect the relative confidence assigned to the two reference vectors.
This idea forms the basis of nonlinear geometric complementary attitude observers.
4.2.3.25 What Does “High-Pass the Gyro” Really Mean?
This phrase is useful but can be misleading.
A gyroscope measures angular rate, not attitude.
The angular-rate measurement is first integrated or otherwise used to propagate attitude.
In a scalar Laplace-domain representation,
\[ \Theta_g(s) = \frac{1}{s} \Omega_m(s). \]
The complementary structure is therefore more accurately written as
\[ \boxed{ \hat{\Theta}(s) = \frac{\tau s}{1+\tau s} \left[ \frac{1}{s} \Omega_m(s) \right] + \frac{1}{1+\tau s} \Theta_a(s) }. \]
The gyro branch simplifies to
\[ \frac{\tau}{1+\tau s} \Omega_m(s). \]
Therefore, “high-pass gyro” is shorthand for high-pass weighting of the gyro-derived attitude contribution, not necessarily a literal high-pass filter applied directly to raw angular-rate samples.
4.2.3.26 Selecting the Cutoff Frequency
The cutoff frequency should not be chosen arbitrarily.
It should reflect the actual measurement and error characteristics of the sensor pair.
Important considerations include
- gyro bias stability,
- angle random walk,
- gyro noise density,
- absolute-sensor measurement noise,
- absolute-sensor update rate,
- expected spacecraft rotational dynamics,
- sensor latency,
- slew bandwidth,
- disturbance environment,
- expected sensor dropout duration.
A useful design goal is to place the crossover near the region where the relative quality of the two sensor sources changes.
4.2.3.27 What Happens If the Cutoff Frequency Is Too High?
If
\[ f_c \]
is too high, the absolute reference influences too much of the frequency spectrum.
Possible consequences include
- more absolute-sensor noise entering the fused estimate,
- greater sensitivity to star-tracker jitter,
- greater sensitivity to vision noise,
- more visible jumps from discrete reference updates,
- reduced short-term smoothness.
Conceptually,
\[ \boxed{ f_c \text{ too high} \Rightarrow \text{Too Much Absolute-Sensor Influence} }. \]
4.2.3.28 What Happens If the Cutoff Frequency Is Too Low?
If
\[ f_c \]
is too low, gyro propagation dominates for too long.
Possible consequences include
- slower removal of gyro drift,
- greater sensitivity to bias,
- slower convergence after initialization,
- larger error during long propagation intervals.
Conceptually,
\[ \boxed{ f_c \text{ too low} \Rightarrow \text{Too Much Gyro Reliance} }. \]
Tuning therefore balances
\[ \boxed{\text{Drift Rejection}} \]
against
\[ \boxed{\text{Noise Rejection}}. \]
4.2.3.29 Sensor Update Rates and Multi-Rate Operation
Spacecraft attitude sensors rarely operate at identical rates.
Commonly,
\[ f_{gyro} \gg f_{star}. \]
The gyro may propagate attitude at every navigation cycle:
\[ \hat{\mathbf q}_{k+1}^{-} = f_q \left( \hat{\mathbf q}_k^+, \boldsymbol{\omega}_{m,k}, \Delta t \right). \]
The star tracker performs a correction only when a new valid measurement is available.
Therefore,
\[ \boxed{\text{Gyro Update}} \rightarrow \boxed{\text{Propagate}} \]
occurs frequently, whereas
\[ \boxed{\text{Star Tracker Available}} \rightarrow \boxed{\text{Correct}} \]
occurs less frequently.
The same old absolute measurement should not be repeatedly applied as though it were new information.
4.2.3.30 Sensor Latency
Suppose a star tracker reports a measurement at processing time
\[ t_k \]
but the measurement actually corresponds to
\[ t_k-\tau. \]
If that measurement is compared directly with the current predicted attitude
\[ \hat{\mathbf q}(t_k), \]
the residual contains not only estimation error but also spacecraft motion over the latency interval.
During rapid slew,
\[ \boxed{\text{Latency}} \rightarrow \boxed{\text{Apparent Attitude Error}} \]
even if the sensor and gyro propagation are individually accurate.
Practical implementations therefore require accurate timestamps and, when necessary, time alignment or delayed-measurement handling.
4.2.3.31 Sensor Dropout
An absolute attitude sensor may temporarily become unavailable because of
- Sun intrusion,
- Earth-limb interference,
- excessive spacecraft angular rate,
- acquisition failure,
- field-of-view limitations,
- invalid quality flags.
During the outage,
\[ \boxed{\text{Absolute Correction}=0} \]
and the estimator operates using
\[ \boxed{\text{Gyro-Only Propagation}}. \]
The estimate remains available, but drift accumulates.
When the absolute sensor becomes valid again, the correction should be reintroduced carefully.
An abrupt replacement
\[ \hat{\mathbf q} \leftarrow \mathbf q_{ST} \]
can create a discontinuity.
Complementary correction allows the estimate to return smoothly toward the reference.
4.2.3.32 Measurement Validation Before Fusion
A complementary filter should not automatically use every received absolute measurement.
The measurement should first pass validity and consistency checks.
A practical sequence is
\[ \boxed{\text{Absolute Sensor Measurement}} \]
\[ \downarrow \]
\[ \boxed{\text{Quality / Validity Check}} \]
\[ \downarrow \]
\[ \boxed{\text{Residual Check}} \]
\[ \downarrow \]
\[ \boxed{\text{Complementary Correction}}. \]
If the measurement is invalid,
\[ \boxed{\text{Reject Measurement}} \]
and continue propagation.
4.2.3.33 Fixed-Gain Versus Adaptive Complementary Filters
A basic complementary filter uses fixed gains such as
\[ \alpha = \text{constant} \]
or
\[ K_P = \text{constant}. \]
However, sensor quality may change during the mission.
If star-tracker quality degrades,
\[ K_{abs} \downarrow \]
can reduce its influence.
When measurement quality improves,
\[ K_{abs} \uparrow. \]
Thus,
\[ \boxed{\text{Sensor Quality}} \rightarrow \boxed{\text{Correction Gain}}. \]
Once the weighting is determined systematically from uncertainty models, however, the design begins to approach probabilistic filtering methods such as the Kalman filter.
4.2.3.34 Initialization
A complementary attitude filter requires an initial attitude estimate.
If a valid absolute attitude measurement is available,
\[ \boxed{ \hat{\mathbf q}_0 = \mathbf q_{abs,0} } \]
is a natural initialization.
If only reference vectors are available, an initial attitude determination algorithm may be needed.
If no absolute attitude reference is initially available, the estimator may propagate from a coarse or previously stored attitude, but absolute uncertainty may remain large.
4.2.3.35 Important Spacecraft Note: Gyro + Accelerometer Tilt Fusion
In terrestrial UAV applications, a common complementary filter combines
\[ \boxed{\text{Gyroscope + Accelerometer}} \]
because the accelerometer can provide a gravity-related tilt reference under suitable conditions.
This logic must not be transferred blindly to an orbiting spacecraft.
An accelerometer measures specific force, not gravitational acceleration directly.
In orbital free fall, the spacecraft and accelerometer are accelerating together under gravity.
Therefore, the accelerometer does not provide the same gravity-vector attitude reference that is available to a stationary terrestrial vehicle.
Hence,
\[ \boxed{ \text{Gyro + Accelerometer Tilt Complementary Filter} } \]
commonly used for drones should not be copied directly into spacecraft attitude determination.
Suitable spacecraft references may instead include
\[ \boxed{ \text{Star Tracker} + \text{Sun Sensor} + \text{Magnetometer} +\cdots }. \]
4.2.3.36 Complementary Filtering Beyond Attitude
The complementary-filter principle is broader than spacecraft attitude estimation.
If one information source is reliable mainly at higher frequencies and another is reliable mainly at lower frequencies,
\[ \boxed{ \hat X(s) = H_{HP}(s)X_1(s) + H_{LP}(s)X_2(s) } \]
may be useful.
Possible applications include
- inertial/GNSS velocity blending,
- altitude estimation,
- angular-rate estimation,
- relative-navigation smoothing,
- combining differentiated and integrated measurements,
- terrestrial IMU/barometer altitude fusion.
The physical error spectra must justify the complementary relationship.
4.2.3.37 Complementary Filter vs Low-Pass Filtering
A low-pass filter applied to one noisy sensor gives
\[ \boxed{\text{Noisy Measurement}} \rightarrow \boxed{\text{Low-Pass Filter}} \rightarrow \boxed{\text{Smoothed Measurement}}. \]
This is not necessarily sensor fusion.
A complementary filter combines multiple information sources:
\[ \boxed{\text{Sensor A}} + \boxed{\text{Sensor B}} \rightarrow \boxed{\text{Combined Estimate}}. \]
Therefore,
\[ \boxed{ \text{Signal Filtering} \neq \text{Sensor Fusion} }. \]
4.2.3.38 Complementary Filter vs Kalman Filter
4.2.3.38.1 Complementary Filter
The correction weighting is typically designed explicitly:
\[ \boxed{ K_c = \text{Designed Gain} }. \]
The gain is selected from sensor characteristics and desired bandwidth.
A basic complementary filter generally does not propagate a complete state covariance matrix.
4.2.3.38.2 Kalman Filter
A Kalman filter calculates its gain from predicted state uncertainty and measurement uncertainty:
\[ \boxed{ \mathbf K_k = \mathbf P_k^- \mathbf H_k^T \left( \mathbf H_k \mathbf P_k^- \mathbf H_k^T + \mathbf R_k \right)^{-1} }. \]
The Kalman filter therefore answers:
Given the current uncertainty of my prediction and the uncertainty of this measurement, how strongly should I correct the state?
A complementary filter instead uses a designed frequency or observer-based weighting.
4.2.3.39 Relationship Between Complementary and Kalman Filtering
Complementary and Kalman filters are not completely unrelated.
For certain linear stationary systems with approximately constant noise characteristics, a Kalman filter can approach a steady-state condition in which the Kalman gain changes very little.
Its behaviour may then resemble a properly tuned fixed-gain complementary estimator.
Conceptually,
\[ \boxed{ \text{Complementary Filter} \approx \text{Fixed-Gain Estimator} } \]
whereas
\[ \boxed{ \text{Kalman Filter} = \text{Covariance-Based Estimator} }. \]
Complementary filtering therefore provides an excellent conceptual bridge from simple sensor fusion to recursive probabilistic estimation.
4.2.3.40 Advantages of Complementary Filters
4.2.3.40.1 Simplicity
The mathematical structure is compact and relatively easy to understand.
4.2.3.40.2 Low Computational Cost
A large covariance matrix does not need to be propagated.
4.2.3.40.3 High Update Rate
The algorithm can run efficiently at IMU or gyroscope rate.
4.2.3.40.4 Intuitive Tuning
Parameters such as
\[ \tau, \qquad f_c, \qquad \alpha, \qquad K_P, \qquad K_I \]
have clear physical interpretations.
4.2.3.40.5 Real-Time Suitability
Complementary attitude filters are well suited to embedded real-time implementation when the estimation problem is relatively compact.
4.2.3.40.6 Educational Value
Complementary filtering clearly demonstrates the fundamental sensor-fusion principle
\[ \boxed{ \text{Propagation} + \text{Independent Correction} }. \]
4.2.3.41 Limitations of Complementary Filters
The same simplicity that makes complementary filtering attractive also creates important limitations.
A basic complementary filter does not naturally provide a complete covariance estimate
\[ \boxed{\mathbf P}. \]
It also does not automatically calculate optimal weighting from
\[ \mathbf Q \]
and
\[ \mathbf R. \]
Difficulties increase when dealing with
- many coupled states,
- multiple sensor biases,
- correlated errors,
- strong nonlinearities,
- changing measurement quality,
- delayed measurements,
- large asynchronous sensor networks,
- formal navigation integrity requirements,
- covariance-based capture or handover criteria.
Therefore, complementary filtering is excellent for
\[ \boxed{ \text{Simple / Fast / Robust Fusion} } \]
but can become insufficient for
\[ \boxed{ \text{Complex Multi-Sensor Navigation Estimation} }. \]
4.2.3.42 When Is a Complementary Filter Appropriate?
A complementary filter is particularly attractive when
- the estimated state is relatively small,
- sensor characteristics are clearly complementary,
- computational resources are limited,
- deterministic real-time execution is important,
- a full covariance estimate is not required,
- measurement conditions are reasonably predictable,
- a robust attitude observer is desired.
A natural example is
\[ \boxed{ \text{Gyro} + \text{Absolute Attitude Reference} }. \]
4.2.3.43 When Should a More Advanced Estimator Be Considered?
More advanced state estimation becomes attractive when the state includes quantities such as
\[ \mathbf x = \begin{bmatrix} \mathbf r\\ \mathbf v\\ \mathbf q\\ \mathbf b_g\\ \mathbf b_a\\ \mathbf r_{rel}\\ \mathbf v_{rel}\\ \cdots \end{bmatrix} \]
and measurements originate from several nonlinear sensor models.
For example,
\[ \boxed{ \text{IMU} + \text{GNSS} + \text{Star Tracker} + \text{Camera} + \text{LiDAR} } \]
may require an EKF, ESKF, MEKF, UKF, or another estimator depending on mission needs.
4.2.3.44 Simulink Implementation Concept
A basic single-axis complementary filter can be represented by the following signal chain.
\[ \boxed{\omega_m} \]
\[ \downarrow \]
\[ \boxed{\text{Bias Correction}} \]
\[ \downarrow \]
\[ \boxed{\text{Integrator}} \]
\[ \downarrow \]
\[ \boxed{\text{Gyro-Derived Attitude}}. \]
The absolute branch is
\[ \boxed{\theta_{abs}} \rightarrow \boxed{\text{Low-Frequency Reference}}. \]
Both branches are combined in
\[ \boxed{\text{Complementary Fusion}} \]
to produce
\[ \boxed{\hat{\theta}}. \]
4.2.3.44.1 Prediction–Correction Simulink Form
A more practical implementation is
\[ \boxed{\hat{\theta}_{k-1}} \rightarrow \boxed{+\omega_m\Delta t} \rightarrow \boxed{\hat{\theta}_k^-} \]
followed by
\[ \boxed{ \theta_{abs,k} - \hat{\theta}_k^- } \rightarrow \boxed{\text{Gain}} \rightarrow \boxed{\text{Correction}} \]
producing
\[ \boxed{\hat{\theta}_k^+}. \]
4.2.3.45 Verification of a Complementary Filter
A complementary filter should not be assessed using only one nominal simulation.
Several test cases should be considered.
4.2.3.45.1 Static Attitude Test
Set
\[ \omega = 0. \]
Verify that the estimate remains stable despite gyro bias.
4.2.3.45.2 Constant-Rate Rotation
Apply
\[ \omega = \text{constant}. \]
Evaluate tracking accuracy and phase behaviour.
4.2.3.45.3 Slew Maneuver
Apply a representative spacecraft attitude maneuver and evaluate
- peak error,
- settling time,
- lag,
- overshoot.
4.2.3.45.4 Gyro Bias Test
Introduce
\[ b_g \neq 0. \]
Verify that the absolute reference prevents unbounded attitude drift.
4.2.3.45.5 Absolute-Sensor Noise Test
Increase
\[ \sigma_{abs}. \]
Evaluate how strongly the measurement noise enters the fused estimate.
4.2.3.45.6 Absolute-Sensor Dropout Test
Disable the absolute reference for a period and observe gyro-only drift and reacquisition behaviour.
4.2.3.45.7 Latency Test
Introduce measurement delay and determine whether rapid motion creates systematic correction errors.
4.2.3.45.8 Outlier Test
Inject an erroneous attitude measurement and verify that validation logic prevents an unsafe correction.
4.2.3.46 Performance Metrics
For a scalar attitude example, the estimation error is
\[ \boxed{ e_\theta = \theta_{true} - \hat{\theta} }. \]
The RMS attitude error is
\[ \boxed{ RMSE_\theta = \sqrt{ \frac{1}{N} \sum_{k=1}^{N} e_{\theta,k}^{2} } }. \]
For quaternion attitude, a useful metric is the principal rotation angle obtained from the attitude-error quaternion.
Additional useful quantities include
- maximum attitude error,
- steady-state error,
- convergence time,
- drift during sensor outage,
- post-reacquisition transient,
- gyro-bias estimation error,
- noise level in the fused estimate.
4.2.3.47 Monte Carlo Verification
Sensor errors are stochastic.
Therefore, the complementary filter should also be evaluated using repeated Monte Carlo simulations.
Variables may include
- initial attitude error,
- gyro bias,
- gyro noise,
- absolute-sensor noise,
- sensor update timing,
- dropout duration,
- latency,
- sensor alignment error.
For Monte Carlo run \(i\),
\[ e_\theta^{(i)}(t) \]
can be recorded.
The ensemble can then be used to calculate
- mean error,
- RMS error,
- percentile bounds,
- worst-case error,
- convergence probability,
- mission-requirement success rate.
This provides stronger evidence of filter robustness than a single nominal simulation.
4.2.3.48 Complete Spacecraft Complementary-Filter Architecture
A realistic spacecraft attitude-estimation chain can now be assembled.
The gyroscope branch is
\[ \boxed{\text{Gyroscope}} \]
\[ \downarrow \]
\[ \boxed{\text{Calibration + Bias Compensation}} \]
\[ \downarrow \]
\[ \boxed{\text{High-Rate Quaternion Propagation}}. \]
The absolute-reference branch is
\[ \boxed{ \text{Star Tracker / Sun Sensor / Magnetometer} } \]
\[ \downarrow \]
\[ \boxed{\text{Calibration + Frame Transformation}} \]
\[ \downarrow \]
\[ \boxed{\text{Validity + Quality Checking}} \]
\[ \downarrow \]
\[ \boxed{\text{Attitude / Vector Residual}}. \]
The two paths meet at
\[ \boxed{\text{Complementary Correction}} \]
producing
\[ \boxed{ \hat{\mathbf q}, \hat{\mathbf b}_g }. \]
These estimates are then supplied to
\[ \boxed{\text{Guidance + Attitude Control}}. \]
A more complete flight implementation also includes
\[ \boxed{ \text{Timestamping} + \text{Dropout Handling} + \text{Outlier Rejection} + \text{Mode Logic} }. \]
4.2.3.49 Complete Conceptual Flow
The entire complementary-filter concept can be summarized as
\[ \boxed{\text{True Spacecraft Attitude}} \]
\[ \downarrow \]
\[ \begin{array}{cc} \boxed{\text{Gyroscope}} & \boxed{\text{Absolute Reference Sensor}} \\[6pt] \downarrow & \downarrow \\[6pt] \boxed{\text{Fast-Rate Information}} & \boxed{\text{Absolute Reference}} \\[6pt] \downarrow & \downarrow \\[6pt] \boxed{\text{Propagation}} & \boxed{\text{Validation}} \end{array} \]
\[ \downarrow \]
\[ \boxed{\text{Residual}} \]
\[ \downarrow \]
\[ \boxed{\text{Complementary Correction}} \]
\[ \downarrow \]
\[ \boxed{ \text{Stable High-Rate Attitude Estimate} }. \]
The essential principle is
\[ \boxed{ \text{Short-Term Dynamics from Gyro} + \text{Long-Term Reference from Absolute Sensor} }. \]
4.2.3.50 Key Takeaways
- Complementary filtering combines sensors with complementary error characteristics.
- It is not simply an arithmetic average of sensor measurements.
- Gyroscopes provide excellent short-term rotational information, but integrated attitude drifts because of bias and noise.
- Absolute reference sensors provide long-term correction but may update more slowly or suffer from noise, geometry limitations, latency, and dropout.
- First-order complementary filters satisfy \[ \boxed{ H_{LP}(s) + H_{HP}(s) = 1 }. \]
- The cutoff frequency \[ \boxed{ f_c = \frac{1}{2\pi\tau} } \] controls the crossover between gyro and absolute-reference influence.
- A common discrete implementation is \[ \boxed{ \hat{\theta}_k = \alpha \left( \hat{\theta}_{k-1} + \omega_{m,k}\Delta t \right) + (1-\alpha)\theta_{a,k} }. \]
- Quaternion or rotation-matrix implementations are preferable to independent Euler-angle filtering for real spacecraft.
- Gyro bias can be estimated using integral correction.
- Multi-rate measurements, timestamps, latency, validity flags, dropouts, and reacquisition are essential parts of a real implementation.
- The common terrestrial gyro-plus-accelerometer tilt filter should not be copied blindly into orbital spacecraft attitude determination, because an accelerometer measures specific force rather than providing a conventional gravity reference in free fall.
- Complementary filters are computationally efficient and intuitive but do not naturally provide the full covariance framework required for complex multi-sensor navigation.
Next: 4.2.4 Observer-Based Fusion
Complementary filtering introduces the important principle
\[ \boxed{ \text{Use the Model / Gyro to Predict} + \text{Use Measurements to Correct} }. \]
However, the correction law has so far been designed mainly through fixed gains such as
\[ \alpha, \qquad K_P, \qquad K_I. \]
The next section formulates this idea more generally as a dynamic observer:
\[ \boxed{ \dot{\hat{\mathbf x}} = f(\hat{\mathbf x},\mathbf u) + \mathbf L \left[ \mathbf z - h(\hat{\mathbf x}) \right] }. \]
This introduces the formal idea of feeding the measurement residual back into a dynamic state estimator.
4.2.4 Observer-Based Fusion
Luenberger observers, observer error dynamics, gain design, nonlinear observers, spacecraft attitude observers, convergence, stability, and observer-based sensor fusion.
Continue to Observer-Based Fusion →