# Kalman fitler to estimate position from velocity measurement

I am using the Kalman filter to estimate the position from velocity measurements. I implemented the filter, but the position estimate is not well enough (large RMSE and Covariance value). Some time ago, I estimated the velocity using the position measurements (vice versa of the previous case) and the results were satisfying. What could be the reason that the former case doesn't work well enough?

Edit: Let me re-introduce the problem. Suppose I design a robot and I need to estimate its position and velocity using a tachometer. (And yes I know the initial position.) Then, my state variables become

x = [p v]
p: position
v: velocity


Since the tachometer provides a velocity measurement (i.e. pulse per unit time presumably 1 sec), my measurement vector become

y = [v].


Now I assume that my robot make constant velocity moves and crease a CV model for it motion. Assume F,H,Q and R matrices are standard CV motion matrices. To summarize I have measurement of velocity and trying to estimate the position and velocity of the robot. When I use Kalman filter for that problem I have bad position estimates. However, apart from that problem, when I try to estimate the speed from the position measurement, I have nice results for the velocity. My question is about this difference. In the first case I have velocity measurement and I have bad estimates for the position. In the second case I have position measurements but I have nice speed estimates. Although, both measurements are indirect why do I have such a bad estimate when I try to estimate the position from velocity? Am I doing a nonsense thing by estimating the position from velocity measurement?

One possible answer could be: When I try to estimate the position from velocity measurements I integrate the error. However, when I try to estimate the velocity from position measurements I differentiate the error. Therefore the former provides bad results.

• Without knowing exactly what you have done, we have a limited ability to help. There could be lots of things, but finding the right one is harder without more information. – Irreducible Jan 30 at 14:17
• How do you initialize the position estimate? Because the velocity is the derivative of the position, you won't be able to get absolute position correctly without some other information. That should result in an offset from the true position, which will then give large RMSE and covariance. – Peter K. Jan 30 at 14:21
• @Irreducible I think I gave enough details of my problem. Instead of making irrelevant comments you might tell what is lack in the question like Peter did. – deathiscertainlifeisnot Jan 30 at 14:30
• I also agree with @Irreducible : Showing code or data (or both) will help get a sensible answer. – Peter K. Jan 30 at 14:35
• With Kalman filters, the devil is in the details, and people very commonly mistake the word Kalman for magic. So, we asked for details both to see what you're doing, and if you have a hope of succeeding. As to your comment about giving us code, I would much rather that you give us the detailed math than the detailed code, because that way I don't have to plow through your code to figure out the math. – TimWescott Jan 30 at 16:55