On driver table have the option to use prediction interval instead of checkpoints #265
iFuSiiOnzZ
started this conversation in
Ideas
Replies: 1 comment
-
|
I was thinking on how to mitigate the gap interval variability, it would be a good idea to use somekind of moving average, usually the exponential is quite good as is fast on piking changes on the data input. Or try to use a Kalman filter which reduces the noise. EMA: https://en.wikipedia.org/wiki/Exponential_smoothing class EmaFilter
{
private double _value = 0;
private double _alpha = 1;
public EmaFilter(int period) { _alpha = 2.0 / (period + 1); }
public double Update(double value) { _value = _alpha * value + (1.0 - _alpha) * _value; return _value; }
}Kalman: https://en.wikipedia.org/wiki/Exponential_smoothing lass KalmanFilter
{
private double Q = 1e-5; // Process noise covariance
private double R = 1e-2; // Measurement noise covariance
private double S = 0; // Estimated state
private double P = 1; // Estimated error covariance
private double K = 0; // Kalman gain
public KalmanFilter(double value)
{
Update(value);
}
public double Update(double value)
{
// Predict step
P = P + Q;
// Measurement update step
K = P / (P + R);
S = S + K * (value - S);
P = (1.0 - K) * P;
return S;
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
So, the idea is to compute the interval between cars taking into account the velocity and the distance between them.
Algorithm:
Problems:
As the car's speed is not constants, (T), the time interval, is very instable.
Code example:
Beta Was this translation helpful? Give feedback.
All reactions