Constant-velocity Kalman filter for 2D position tracking. More...
| Import Statement: | import Clayground.Algorithm |
State [x, y, vx, vy]. Call predict(dt) on a fixed tick and correct(zx, zy, sigma) for every position measurement from any sensor; sigma is that sensor's standard deviation, which is how fusion weighs sources by their uncertainty.
Example usage:
import Clayground.Algorithm KalmanFilter2D { id: kf; processNoise: 0.8 } // per tick: kf.predict(dt) // per fix: kf.correct(fix.x, fix.y, 3.0)
estX : real |
Estimated x position.
estY : real |
Estimated y position.
processNoise : real |
Acceleration standard deviation of the motion model.
sigmaX : real |
Position uncertainty (std dev) along x.
sigmaY : real |
Position uncertainty (std dev) along y.
void correct(real zx, real zy, real sigma) |
Fuses a position measurement with standard deviation sigma.
void predict(real dt) |
Advances the state by dt using the constant-velocity model.
void reset(real px, real py) |
Re-initializes the state at a position with high uncertainty.