State Estimation and Filters
The utility of sensors in FTC can be improved with a variety of algorithms.
Filters
Low pass filter
double a = 0.9; // low pass gain, must be within 0 < x < 1
LowPassFilter filter = new LowPassFilter(a);
while (true) {
double currentValue = readNoisySensor(); // imaginary, noisy sensor
double estimate = filter.estimate(currentValue); // smoothed sensor
}Least Squares + Kalman Filter
double Q = 0.3; // High values put more emphasis on the sensor.
double R = 3; // High Values put more emphasis on regression.
int N = 3; // The number of estimates in the past we perform regression on.
KalmanFilter filter = new KalmanFilter(Q,R,N);
while (true) {
double currentValue = readNoisySensor(); // imaginary, noisy sensor
double estimate = filter.estimate(currentValue); // smoothed sensor
}
Kalman Filter vs Low Pass Filter

Estimators
Last updated
Was this helpful?
