使用卡尔曼滤波器跟踪位置和速度

问题描述:

我正在使用卡尔曼滤波器(恒速模型)来跟踪物体的位置和速度.我测量对象的x,y并跟踪x,y,vx,vy.这是可行的,但是如果传感器读数x,y,vx,vy的正高斯噪声增加了±20 mm,即使该点不仅仅是在移动噪声,它也会波动.对于足以满足我的需求的位置,但是当该点静止时速度会发生变化,这会导致我的物体速度计算出现问题.有办法解决这个问题吗?还可以切换到恒定加速度模型吗?我正在通过相机跟踪机器人.

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.

我正在使用opencv实现,我的kalman模型与[1]相同

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/ >

设计卡尔曼滤波器最重要的不是数据,而是误差估计.该示例中的矩阵似乎是任意选择的,但是您应该使用系统的特定知识来选择它们.特别是:

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:

  • 误差协方差具有单位.它是标准偏差的平方.因此,您的位置误差以长度平方"为单位,速度以每时间长度平方"为单位.这些矩阵中的值会有所不同,具体取决于您是以m还是mm为单位.
  • 您正在实现恒定速度"模型,但是示例中的"processNoiseCov"为位置和速度过程噪声设置了相同的值.这意味着您可能由于错误的速度而错位了,,并且您可能错了,因为物体以与速度无关的方式来回传送.在CV模型中,您会期望位置过程噪声会非常低(仅出于数值原因并涵盖建模误差,基本上为非零),并且系统的真正未知运动将归因于未知速度.这个问题也干扰了KF从位置输入推断速度的能力,因为位置的传送错误"并非归因于速度变化.
  • 如果您输入+/- 20mm的误差(如果要模拟理想行为,则应该输入高斯噪声),​​则标准偏差约为11.5mm或方差为(11.5mm)^ 2 .不知道您的单位是多少(毫米或米),我不能说"measurementNoiseCov"的数值应该是多少,但是它不是0.1(如示例中所示).
  • 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).

最后,即使所有正确的设置,也请记住,KF最终是线性滤波器.无论您输入什么噪声,都会在输出中显示出来,只是按一定的比例(卡尔曼增益)进行缩放.

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).