@@ -300,27 +300,32 @@ MovingHorizonEstimator estimator with a sample time Ts = 10.0 s, Ipopt optimizer
300300 with ``p=1`` is particularly useful for the MHE since it moves its expensive
301301 computations after the MPC optimization. That is, [`preparestate!`](@ref) will solve the
302302 optimization by default, but it can be postponed to [`updatestate!`](@ref) with
303- `direct=false`. Note that contrarily to all the other estimators in the module, the MHE
304- in its current form with ``p=0`` interprets the initial state estimate and covariance as
305- ``\m athbf{x̂}_{-1}(-1)`` and ``\m athbf{P̂}_{-1}(-1)``, that is, an *a posteriori*
306- estimate[^2] from the last time step.
307-
308- [^2]: M. Hovd (2012), "A Note On The Smoothing Formulation Of Moving Horizon Estimation",
309- *Facta Universitatis*, Vol. 11 №2.
303+ `direct=false`.
310304
311305 The Extended Help of [`SteadyKalmanFilter`](@ref) details the augmentation with `nint_ym`
312306 and `nint_u` arguments. The default augmentation scheme is identical, that is `nint_u=0`
313307 and `nint_ym` computed by [`default_nint`](@ref). Note that the constructor does not
314308 validate the observability of the resulting augmented [`NonLinModel`](@ref). In such
315309 cases, it is the user's responsibility to ensure that it is still observable.
316-
317- The slack variable ``ϵ`` relaxes the constraints if enabled, see [`setconstraint!`](@ref).
318- It is disabled by default for the MHE (from `Cwt=Inf`) but it should be activated for
319- problems with two or more types of bounds, to ensure feasibility (e.g. on the estimated
320- state ``\m athbf{x̂}`` and sensor noise ``\m athbf{v̂}``).
321-
322- The optimization and the estimation of the covariance at arrival
323- ``\m athbf{P̂}_{k-N_k}(k-N_k+p)`` depend on `model`:
310+
311+ The estimation covariance at arrival ``\m athbf{P̂}_{k-N_k}(k-N_k+p)`` gives an uncertainty
312+ on the state estimate at the beginning of the window ``k-N_k+p``, that is, in the past.
313+ It is not the same as the current estimate covariance ``\m athbf{P̂}_k(k)``, a value not
314+ computed by the MHE (contrarily to e.g. the [`KalmanFilter`](@ref)). Three keyword
315+ arguments specify its initial value with ``\m athbf{P̂_i} = \m athrm{diag}\{ \m athbf{P}(0),
316+ \m athbf{P_{int_{u}}}(0), \m athbf{P_{int_{ym}}}(0) \} ``. The initial state estimate
317+ ``\m athbf{x̂_i}`` can be manually specified with [`setstate!`](@ref), or automatically
318+ with [`initstate!`](@ref) for [`LinModel`](@ref). Note the MHE with ``p=0`` is slightly
319+ inconsistent with all the other estimators here. It interprets the initial values as
320+ ``\m athbf{x̂}_{-1}(-1) = \m athbf{x̂_i}`` and ``\m athbf{P̂}_{-1}(-1) = \m athbf{P̂_i}``, that
321+ is, an *a posteriori* estimate[^2] from the last time step. The MHE with ``p=1`` is
322+ consistent, interpreting them as ``\m athbf{x̂}_{-1}(0) = \m athbf{x̂_i}`` and
323+ ``\m athbf{P̂}_{-1}(0) = \m athbf{P̂_i}``.
324+
325+ [^2]: M. Hovd (2012), "A Note On The Smoothing Formulation Of Moving Horizon Estimation",
326+ *Facta Universitatis*, Vol. 11 №2.
327+
328+ The optimization and the update of the arrival covariance depend on `model`:
324329
325330 - If `model` is a [`LinModel`](@ref), the optimization is treated as a quadratic program
326331 with a time-varying Hessian, which is generally cheaper than nonlinear programming. By
@@ -330,10 +335,14 @@ MovingHorizonEstimator estimator with a sample time Ts = 10.0 s, Ipopt optimizer
330335 functions must be compatible with this feature. See [Automatic differentiation](https://jump.dev/JuMP.jl/stable/manual/nlp/#Automatic-differentiation)
331336 for common mistakes when writing these functions. An [`UnscentedKalmanFilter`](@ref)
332337 estimates the arrival covariance by default.
333-
334- Note that if `Cwt≠Inf`, the attribute `nlp_scaling_max_gradient` of `Ipopt` is set to
335- `10/Cwt` (if not already set), to scale the small values of ``ϵ``. Use the second
336- constructor to specify the covariance estimation method.
338+
339+ The slack variable ``ϵ`` relaxes the constraints if enabled, see [`setconstraint!`](@ref).
340+ It is disabled by default for the MHE (from `Cwt=Inf`) but it should be activated for
341+ problems with two or more types of bounds, to ensure feasibility (e.g. on the estimated
342+ state ``\m athbf{x̂}`` and sensor noise ``\m athbf{v̂}``). Note that if `Cwt≠Inf`, the
343+ attribute `nlp_scaling_max_gradient` of `Ipopt` is set to `10/Cwt` (if not already set),
344+ to scale the small values of ``ϵ``. Use the second constructor to specify the covariance
345+ estimation method.
337346"""
338347function MovingHorizonEstimator (
339348 model:: SM ;
0 commit comments