@@ -80,7 +80,7 @@ function update_estimate!(estim::MovingHorizonEstimator{NT}, u, ym, d) where NT<
8080 x̂ .= X̂[end - nx̂+ 1 : end ]
8181 if Nk == estim. He
8282 uarr, ymarr, darr = estim. U[1 : model. nu], estim. Ym[1 : nym], estim. D[1 : model. nd]
83- update_cov! (estim. P̂arr_old, estim, model , uarr, ymarr, darr)
83+ update_cov! (estim, model, estim. x̂arr_old, estim . P̂arr_old , uarr, ymarr, darr)
8484 estim. invP̄. data .= Hermitian (inv (estim. P̂arr_old), :L )
8585 end
8686 return nothing
@@ -324,16 +324,16 @@ function trunc_bounds(estim::MovingHorizonEstimator{NT}, Bmin, Bmax, n) where NT
324324end
325325
326326" Update the covariance `P̂` with the `KalmanFilter` if `model` is a `LinModel`."
327- function update_cov! (P̂, estim:: MovingHorizonEstimator , :: LinModel , u, ym, d)
327+ function update_cov! (estim:: MovingHorizonEstimator , :: LinModel , _ , P̂ , u, ym, d)
328328 return update_estimate_kf! (estim, u, ym, d, estim. Â, estim. Ĉ[estim. i_ym, :], P̂)
329329end
330330" Update it with the `ExtendedKalmanFilter` if model is not a `LinModel`."
331- function update_cov! (P̂, estim:: MovingHorizonEstimator , model:: SimModel , u, ym, d)
331+ function update_cov! (estim:: MovingHorizonEstimator , model:: SimModel , x̂, P̂ , u, ym, d)
332332 # TODO : also support UnscentedKalmanFilter
333333 x̂next, ŷ = similar (estim. x̂), similar (model. yop)
334- F̂ = ForwardDiff. jacobian ((x̂next, x̂) -> f̂! (x̂next, estim, estim. model, x̂, u, d), x̂next, estim . x̂)
335- Ĥ = ForwardDiff. jacobian ((ŷ, x̂) -> ĥ! (ŷ, estim, estim. model, x̂, d), ŷ, estim . x̂)
336- return update_estimate_kf! (estim, u, ym, d, F̂, Ĥ[estim. i_ym, :], P̂)
334+ F̂ = ForwardDiff. jacobian ((x̂next, x̂) -> f̂! (x̂next, estim, estim. model, x̂, u, d), x̂next, x̂)
335+ Ĥ = ForwardDiff. jacobian ((ŷ, x̂) -> ĥ! (ŷ, estim, estim. model, x̂, d), ŷ, x̂)
336+ return update_estimate_kf! (estim, u, ym, d, F̂, Ĥ[estim. i_ym, :], P̂)
337337end
338338
339339
0 commit comments