Skip to content

added: covestim arg. in both MovingHorizonEstimator constructors + honor P̂_0#374

Merged
franckgaga merged 3 commits into
mainfrom
covestim_mhe_const
Jun 11, 2026
Merged

added: covestim arg. in both MovingHorizonEstimator constructors + honor P̂_0#374
franckgaga merged 3 commits into
mainfrom
covestim_mhe_const

Conversation

@franckgaga

@franckgaga franckgaga commented Jun 10, 2026

Copy link
Copy Markdown
Member

It's now possible to customize the estimator for the arrival covariance $\mathbf{\bar{P}}$ in the first constructor of the MovingHorizonEstimator, that is, the one that avoid specifying the full covariance matrices. A constant arrival covariance $\mathbf{\bar{P}}$ is very useful, and it's supported by providing a SteadyKalmanFilter object in the covestim argument. But the argument was exposed only in the second constructor of the MHE, which is less "user-friendly". This is no longer the case.

I also changed the behavior compared PR #248. The P̂_0 argument of MovingHorizonEstimator constructor was not honored when a covestim argument was provided, which is totally counterintuitive and I would even consider this as a bug. It is now always honored. It is no longer required to manually call setstate! to set the arrival covariance value when it's estimated by a SteadyKalmanFilter, that is, a constant. The user can just provide σP_0, σPint_ym_0 and σPint_u_0 arguments in the first constructor, or P̂_0 in the second, and it will be fixed at these values.

In the case that the user would like to fix it at the steady-state value $\mathbf{\hat{P}}(\infty)$, the user can call the first MHE constructor with σP_0=nothing, or P̂_0=nothing for the second one, and it will fetch the value from covestim.cov.P̂, which is the steady-state covariance for the SteadyKalmanFilter.

As mentioned in the documentation, it is also possible to set a constant arrival covariance with NonLinModels by constructing a SteadyKalmanFilter with an dummy LinModel and pass this object in covestim, as long as the number of estimated states nx̂ mathches the MHE.

@codecov-commenter

codecov-commenter commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.57%. Comparing base (f8de776) to head (d43ab01).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #374   +/-   ##
=======================================
  Coverage   98.57%   98.57%           
=======================================
  Files          27       27           
  Lines        5468     5477    +9     
=======================================
+ Hits         5390     5399    +9     
  Misses         78       78           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@franckgaga franckgaga changed the title added: covestim arg. in both MovingHorizonEstimator constructors added: covestim arg. in both MovingHorizonEstimator constructors + honor P̂_0 Jun 11, 2026
@franckgaga franckgaga changed the title added: covestim arg. in both MovingHorizonEstimator constructors + honor P̂_0 added: covestim arg. in both MovingHorizonEstimator constructors + honor P̂_0 Jun 11, 2026
@franckgaga franckgaga merged commit 1313f07 into main Jun 11, 2026
5 checks passed
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

Successfully merging this pull request may close these issues.

2 participants