Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tracking position and velocity using a kalman filter

I am using a kalman filter (constant velocity model) to track postion and velocity of an object. I measure x,y of the object and track x,y,vx,vy . Which works but if a add gausian noise of +- 20 mm to the sensor readings x,y,vx,vy fluctuates even though the point is not moving just noise. For location that is good enough for my needs but velocity changes when the point is stationary and that is causing problems with my object speed calculations. Is there a way around this problem? also if switching to constant acceleration model improve on this? I am tracking a robot via a camera.

I am using opencv implementation and my kalman model is same as [1]

[1] http://www.morethantechnical.com/2011/06/17/simple-kalman-filter-for-tracking-using-opencv-2-2-w-code/

like image 981
Hamza Yerlikaya Avatar asked Dec 15 '15 13:12

Hamza Yerlikaya


People also ask

How is Kalman filter used for tracking?

The procedure for tracking a single object is shown below. There are two distinct scenarios that the Kalman filter addresses: When the ball is detected, the Kalman filter first predicts its state at the current video frame, and then uses the newly detected object location to correct its state.

Why use Kalman filter for object tracking?

Kalman filtering (KF) [5] is widely used to track moving objects, with which we can estimate the velocity and even acceleration of an object with the measurement of its locations. However, the accuracy of KF is dependent on the assumption of linear motion for any object to be tracked.

What is Kalman filter in dynamic positioning?

In a Dynamic Positioning application a Kalman filter is used to estimate the state of the vessel (for which a dynamics model has been developed) based on noisy measurements from reference systems and sensors. This is a first “functional” definition of the Kalman filter.

What is Kalman filter algorithm?

Kalman filtering is an algorithm that provides estimates of some unknown variables given the measurements observed over time. Kalman filters have been demonstrating its usefulness in various applications. Kalman filters have relatively simple form and require small computational power.


1 Answers

The most important thing about designing a Kalman filter is not the data, it's the error estimates. The matrices in that example seem to be chosen arbitrarily, but you should pick them using specific knowledge of your system. In particular:

  • Error covariance has units. It's standard deviation squared. So your position error is in "length squared" and velocity in "length per time squared". The values in those matrices will be different depending on whether you work in m or mm.
  • You are implementing a "constant velocity" model, but the "processNoiseCov" from the example sets the same values for both position and velocity process noise. This means that you might be wrong about your position due to being wrong about your velocity, and you might be wrong because the object teleported around in a way that's independent of velocity. In a CV model you would expect that the position process noise would be very low (basically nonzero only for numerical reasons and to cover modelling error) and the true unknown motion of the system would be attributed to unknown velocity. This problem also interferes with the KF's ability to infer velocity from position input, because the "teleportation error" of position is not attributed to velocity change.
  • If you're putting in +/-20mm of error (you should really put in Gaussian noise if you want to simulate ideal behavior) you have an approximate standard deviation of 11.5mm or a variance of (11.5mm)^2. Not knowing what your units are (mm or m) I can't say what the numerical value of "measurementNoiseCov" should be, but it's not 0.1 (as in the example).

And finally, even with all of that correct, keep in mind that the KF is ultimately a linear filter. Whatever noise you put in will show up in the output, just scaled by some factor (the Kalman gain).

like image 73
Ben Jackson Avatar answered Nov 13 '22 09:11

Ben Jackson