Shrink covariance matrix in one direction I have implemented a Kalman Filter for position estimate $(x,y)$ on a robot, but now I have a problem. When I detect a landmark, I would like to correct my estimate only on a defined direction. As an example, if my robot is travelling on the plane, and meets a landmark with orientation 0 degrees, I want to correct the position estimate only on a direction perpendicular to the landmark itself (i.e. 90 degrees).
This is how I'm doing it for the position estimate:


*

*I update $x_{posterior}$ as in the normal case, and store it in $x_{temp}$.

*I calculate the error $e = x_{temp} - x_{prior}$.

*I project this error vector $e$ on the direction perpendicular to the landmark to get $e' = \text{P}(e)$ where $\text{P}$ does the projection.

*I add this projected quantity to $x_{prior}$ to get $x'_{posterior} := e' + x_{prior}$.


This is working quite well, but (Question:) how can I do the same for the covariance matrix? Basically, I want to shrink the covariance only on the direction perpendicular to the landmark.
 A: Here is my solution, that is just an approximation but it is working quite well.
Essentially this is what I do:


*

*I store the a priori covariance matrix in $P_{old}$.

*I execute the normal (uncorrected) update step, and store the covariance matrix in $P_{new}$.

*Given the direction of the landmark $d$, I compute the parallel component (to this direction $d$) of the axis of the ellipse represented by $P_{old}$. Then, I select the component with maximum length and store it in $a_{par}$.

*I compute the perpendicular component (to the same direction $d$) of the axis of the ellipse represented by $P_{new}$. Then, I select the component with maximum length and store it in $a_{perp}$.

*Finally I generate the corrected ellipse from the 2 axis $a_{par}$ and $a_{perp}$ and store the covariance matrix in $P$. 


This is represented in the following example (direction of the landmark $d$ = 0°) figure, where the red ellipse is represented by $P_{old}$, the green ellipse by $P_{new}$, and the blue ellipse is the corrected one represented by $P$, where only the component perpendicular to $d$ has been shrunk.

