Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in EKF.py predict_update #271

Open
Paulkie99 opened this issue Jun 17, 2022 · 1 comment
Open

Error in EKF.py predict_update #271

Paulkie99 opened this issue Jun 17, 2022 · 1 comment

Comments

@Paulkie99
Copy link

I believe the Jacobian should be computed after the predict step instead of before.

H = HJacobian(x, *args)
# predict step
x = dot(F, x) + dot(B, u)
P = dot(F, P).dot(F.T) + Q
# save prior
self.x_prior = np.copy(self.x)
self.P_prior = np.copy(self.P)
# update step
PHT = dot(P, H.T)
self.S = dot(H, PHT) + R
self.SI = linalg.inv(self.S)
self.K = dot(PHT, self.SI)
self.y = z - Hx(x, *hx_args)
self.x = x + dot(self.K, self.y)
I_KH = self._I - dot(self.K, H)
self.P = dot(I_KH, P).dot(I_KH.T) + dot(self.K, R).dot(self.K.T)

@jsvacha
Copy link

jsvacha commented Oct 2, 2022

I agree. You want to linearize the system about the current estimate. Once you run the prediction, the estimate changes and so should the measurement Jacobian.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants