I want to implement a Kalman Filter for predicting x/y positions. I have a sensor which gives me the

Alannah Short

Alannah Short

Answered question

2022-06-20

I want to implement a Kalman Filter for predicting x/y positions. I have a sensor which gives me the current position (noisy). Now I want to smooth and predict the position. Thus Kalman Filter came to my mind.

How do I have to design the filter taking the time in regards? I want to predict the next state which is ahead of the upcoming measurement. Moreover since i do not have a velocity, I'd like to estimate the velocity by the kalman as well.

State := [xpos,ypos,xvelocity,yvelocity]
Measurement := [xpos,ypos]
ControlInput := predictionTime

I would run the following algorithm, whenever i get a measurement:

1. Measure
2. Update kalman gain
3. Predict
4. Get State estimate

Now, when i use a predictionTime which is newer than the next measurement, the next measurement does not fit to the predicted state.

Is there a strategy to solve this issue? My predicted state and my next measurement do not fit, how could I fix this?

Answer & Explanation

pressacvt

pressacvt

Beginner2022-06-21Added 19 answers

Basically what you would do is the following:
Let:
X = [ x , y , v x , v y ]
P = σ x 2 0 0 0 0 σ y 2 0 0 0 0 σ v x 2 0 0 0 0 σ v y 2
Δ t
Be your state vector, state covariance matrix, and time interval between two measurements respectively.
How can you transition from one state K to another state K+1,, which is Dt seconds later? Taking the simple equation.
distance(meters)=speed(meters/sec)∗time(secs)
You see that transitioning from one state to another is done in the following way:
F k = 1 0 Δ t 0 0 1 0 Δ t 0 0 1 0 0 0 0 1
Because, when you do the state prediction, you apply the following equation (simplyfication with no input control vector):
X k = F k X k 1
Multiplying both matrixes together yields back the following equations:
x k = x k 1 + v x k 1 Δ t
y k = y k 1 + v y k 1 Δ t
v x k = v x k 1
v y k = v y k 1
If you need further clarification on another aspect, please do not hesitate to ask.

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?