A question about Extended Kalman Filter

In summary, the conversation discusses the implementation of a visual 3D model-based vehicle tracking system using an extended Kalman filter. The individual is having trouble understanding how to get the matrices F and H from f(X) and h(X) and is unsure about the initial values for the measurement and error covariances. They have also noticed some issues with the filtered solution and are seeking advice on how to make it work. After two weeks of troubleshooting, it was discovered that the problem was due to a simple error in the representation of rotational state. Overall, the conversation highlights the complexities and challenges of implementing a tracking system using an extended Kalman filter.
  • #1
steven_mx
2
0
Hi,

I'm currently implementing a visual 3D model-based vehicle tracking system as my undergrad dissertation. I've implemented the vehicle localization algorithm and now have an estimate of the x, y location on the ground plane as well as the orientation angle of the vehicle which would like to track using an extended Kalman filter.

I have read the paper by Lou et al. which can be found at http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.132.8981&rep=rep1&type=pdf This should have pretty much what I need. However, I'm having problems understanding how to get the matrices F and H from f(X) and h(X) respectively. I also read the paper at http://academic.csuohio.edu/simond/pubs/ESDNonlinear.pdf which seems to be very similar to what I am implementing, however I'm getting funny results, notably:

- When the vehicle does a turn, the model orientation (predicted by Kalman filter) keeps going round and round in circles instead of following the vehicle motion.

To understand what I mean, take a look at what I've been doing so far. This is before I apply the EKF (my estimates from the vehicle localization module): and this is after I apply the EKF:

I am also unsure about the initial values I should set for the measurement and error covariances, Vk and Qk, so I'm not sure whether the problem is with the way I derived F and H or whether I got the initial values for the covariances wrong.

I have already spent 2 weeks on this and have run out of ideas. I would really appreciate if someone could give me an idea on how to make it work. Thanks a lot in advance.

Steven
 
Last edited by a moderator:
Mathematics news on Phys.org
  • #2
I only read partially the first paper, it appears that f(x) could mean two different thing in the paper: in Eq 1, x_dot=f(x) and in Eq 6, x_k+1=f(x_k). You have to linearize the differential eq model of eq 1 to get x_dot=Ax, then relate this to the discrete version (difference equation: x_k+1= F x_k) through some exponential matrix. It appears the matrix H is already written out explicitly in Eq 2, isn't it?
When I debug Kalman Filter, I usually print out step by step how the covariance and gain are computed, and this usually would lead to insight as to why some terms are too sensitive or got overcorrected. I do not have the experience in your field so I really have no idea how u would get werid result. The only general rule is the obvious one: check your model and equations and make sure they are correct, and look at how covariance value influence the gain, try using different initial value and noise statistic
 
  • #3
You have three videos, one labeled before.avi, another kalman.avi, and the third "Visual Model-Based Vehicle Tracking using an Extended Kalman Filter". That third one with the long title looks pretty good. Is this third one not your work, something to show that the problem is tractable?

Anyhow, the first one looks like you have some Kalman-like methodology going on as the noise is strongest when the vehicle is smallish (further away from the camera) and is turning. There appears to be a good lock in that section where the vehicle is going straight.

The second one is obviously the problem. There is a basic problem with the EKF, and you may have run into it. When the filtered solution is far from the truth (and hence far from the measurements) the filter can diverge. You may need to adjust your tuning parameters. Take in a bit more or bit less measurement than your sensor model suggests, for example. Sometimes you have to lie to the filter about the performance of your sensors. Or lie to the filter about plant noise. Or both. Filter tuning can be a bit more art than science.

It also looks like you may have some problems with your state descriptions or your derivatives. The goofy behavior always appears to start with a step change in the filtered solution. It then rotates for a short while, makes another step change, rotates for a bit, ..., before finally locking on to something close to the truth. Are you using Euler angles for rotational state? If so, you may be running into a singularity/gimbal lock.
 
Last edited:
  • #4
Hi,

Thank you very much for your replies. The third video is my work... I finally traced the problem to the inputs :) However I couldn't reply to this thread since it was still being accepted by a mentor.

The problem was pretty silly but for some reason I missed it: I am representing the vehicle orientation as the angle of the vehicle around an axis perpendicular to the ground plane. Conceptually, if the car is at 60 degrees in one frame and at -301 degrees in the other frame, the car has only moved by 1 degrees. However for the Kalman filter it would have moved by 361 degrees. Most of the time the vehicle localization module was giving out positive angles, but at random times it was giving out negative angles, causing the EKF to diverge. When drawn on screen, the model looks perfectly fine as you can see from before.avi, so probably that's why I didn't suspect the problem before.

Thank you again for the help!
 
  • #5
There will always be some problems with representing rotational state. Even quaternions are not immune. A unit quaternion used to represent rotations in 3-space and its additive inverse are indistinguishable insofar as rotation is concerned. A Kalman filter doesn't know that, and this can lead to all kinds of interesting, but goofy, filter behavior.
 

1. What is an Extended Kalman Filter (EKF)?

An Extended Kalman Filter (EKF) is a nonlinear version of the Kalman Filter, which is a mathematical algorithm used to estimate the state of a system based on a series of measurements. The EKF is commonly used in fields such as robotics, control systems, and signal processing.

2. How does an Extended Kalman Filter work?

The EKF works by predicting the state of a system at a given time, based on a mathematical model of the system and its previous state. It then compares this prediction to the actual measurement of the system at that time, and uses a weighted average of the two to update the estimated state.

3. What types of systems can an Extended Kalman Filter be applied to?

The EKF can be applied to any system that can be modeled using nonlinear equations, as long as the system has a state that can be measured and predicted. This includes systems such as vehicles, robots, and biological systems.

4. What are the limitations of an Extended Kalman Filter?

One limitation of the EKF is that it assumes the system and measurement models are linearized, which may not always be accurate. Additionally, the EKF can struggle with systems that have highly nonlinear behavior or high levels of noise in the measurements.

5. How is the Extended Kalman Filter different from the regular Kalman Filter?

The main difference between the EKF and the regular Kalman Filter is that the EKF can handle nonlinear systems, while the regular Kalman Filter is only applicable to linear systems. The EKF also uses a more complex mathematical model and a more involved update process, but can provide more accurate estimates in certain situations.

Similar threads

Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
798
  • Engineering and Comp Sci Homework Help
Replies
1
Views
738
  • General Engineering
Replies
1
Views
2K
  • General Engineering
Replies
4
Views
2K
  • General Engineering
Replies
2
Views
3K
Replies
24
Views
10K
  • General Engineering
Replies
6
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
1K
  • General Engineering
Replies
1
Views
8K
Back
Top