AceLand Unity Packages
  • Home
  • Getting Started
    • Installation
    • Project Settings
    • Architecture Graph
    • Development Level
  • Tutorial
    • Create Your Package
    • Create Project Settings
  • Packages
    • Library
      • Change Log
      • Editor Tools
      • Mono
        • Follow Object
        • Singleton
      • Attributes
        • Conditional Show
        • Inspector Button
        • ReadOnly Field
      • Build Leveling
      • CVS
      • DataTools
      • Disposable Object
      • Extensions
      • Json
      • Kalman Filter
      • Optional
      • Project Setting
      • Serialization Surrogate
      • Utils
    • Event Driven
      • Change Log
      • Event Bus
      • Signal
    • Input
      • Change Log
    • Memento Service
      • Change Log
    • Node Framework
      • Change Log
      • Mono Node
    • Node For Mono (dev)
    • Player Loop Hack
      • Change Log
    • Pool
      • Change Log
    • Security (dev)
    • States
      • Change Log
    • Task Utils
      • Change Log
    • WebRequest
      • Change Log
Powered by GitBook
On this page
  1. Packages
  2. Library

Kalman Filter

An algorithm uses a series of measurements observed over time

Last updated 6 months ago

Kalman Filter is known as linear quadratic estimation. Simple put, this is a denoise filter.

please read this for details.

This library has simplified Kalman Filter and constrait to use on float, Vector2, Vector3 and Vector4.

In wiki document, it may be too complicated if you are not familiar to Mathmatics. Basically we use the following values to estimate the result (prediction). What you need is to know the following values:

Q

the covariance of the process noise, default 0.000001

R

the covariance of the observation noise, default 0.001

P

last prediction with R, default 1

K

last prediction

X

last result

Q, R, P should be set on creating a Kalman Filter for your case. You can get the latest result when call Update with current value every cycle. You can also change Q and R on Update, or Update with mulitple values.

private IKalmanFilter<float> _myKalmanFilter;

private void Start()
{
    _myKalmanFilter = KalmanFilter.Builder<float>()
        .WithQ(processNoise)     // optional
        .WithR(observationNoise) // optional
        .WithP(lastPrediction)   // optional
        .Build();
}

private void Update()
{
    var newValue = GetValue();
    var stableValue = myKalmanFilter.Update(newValue);
}            
wiki document