Table of Contents

Class Complementary

Namespace
Pamoja.Kit
Assembly
Pamoja.Kit.dll

Fuses a drifting rate, such as a gyroscope's, with a noisy absolute reading, such as an accelerometer's tilt, into one steady estimate.

public sealed class Complementary : IDisposable
Inheritance
Complementary
Implements
Inherited Members

Remarks

Each update integrates the rate onto the estimate, then nudges that toward the absolute reading by 1 - alpha, so the rate rules the short term and the absolute reading the long term. An update with a rate, reading, or time step that is not a finite number is ignored.

Constructors

Complementary(float, float)

Creates a filter.

public Complementary(float alpha, float initial)

Parameters

alpha float

The weight on the integrated rate, held to 0 to 1: near 1 trusts the rate and corrects slowly. One that is not a number is taken as 0.

initial float

The starting estimate.

Properties

Estimate

Gets the current estimate.

public float Estimate { get; }

Property Value

float

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Update(float, float, float)

Fuses a rate and an absolute reading over a time step.

public float Update(float rate, float absolute, float dt)

Parameters

rate float

The rate of change, such as degrees per second from a gyroscope.

absolute float

The absolute reading, such as a tilt from an accelerometer.

dt float

The time since the last update.

Returns

float

The fused estimate.