From fedb137db9e21d32e0cdc8c3fc163bd8eb6274aa Mon Sep 17 00:00:00 2001 From: franckgaga Date: Thu, 6 Feb 2025 11:27:43 -0500 Subject: [PATCH 1/6] changed: `@error` instead of `@warn` in MHE fallback for arrival covariance following the "convention" throughout the package, a non fatal `@error` make more sense. It's similar to unfeasible MPC problem : something is wrong but there is a fallback: take the solution from the last time step --- src/estimator/mhe/execute.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/estimator/mhe/execute.jl b/src/estimator/mhe/execute.jl index 5ec313bef..2317bc315 100644 --- a/src/estimator/mhe/execute.jl +++ b/src/estimator/mhe/execute.jl @@ -445,7 +445,7 @@ function correct_cov!(estim::MovingHorizonEstimator) invert_cov!(estim, estim.P̂arr_old) catch err if err isa PosDefException - @warn("Arrival covariance is not positive definite: keeping the old one") + @error("Arrival covariance P̄ is not positive definite: keeping the old one") else rethrow() end @@ -465,7 +465,7 @@ function update_cov!(estim::MovingHorizonEstimator) invert_cov!(estim, estim.P̂arr_old) catch err if err isa PosDefException - @warn("Arrival covariance is not positive definite: keeping the old one") + @error("Arrival covariance P̄ is not positive definite: keeping the old one") else rethrow() end @@ -479,7 +479,7 @@ function invert_cov!(estim::MovingHorizonEstimator, P̄) estim.invP̄ .= inv_cholesky!(estim.buffer.P̂, P̄) catch err if err isa PosDefException - @warn("Arrival covariance is not invertible: keeping the old one") + @error("Arrival covariance P̄ is not invertible: keeping the old one") else rethrow() end From 9bf8646a22b9d9d01a968f6c29f4080f64f70f80 Mon Sep 17 00:00:00 2001 From: franckgaga Date: Thu, 6 Feb 2025 11:30:45 -0500 Subject: [PATCH 2/6] test: verify for `@error` instead of `@warn` --- test/test_state_estim.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_state_estim.jl b/test/test_state_estim.jl index 28c117b32..084d99f22 100644 --- a/test/test_state_estim.jl +++ b/test/test_state_estim.jl @@ -988,19 +988,19 @@ end P̂arr_old_copy = deepcopy(mhe.P̂arr_old) invP̄_copy = deepcopy(mhe.invP̄) @test_logs( - (:warn, "Arrival covariance is not positive definite: keeping the old one"), + (:error, "Arrival covariance is not positive definite: keeping the old one"), preparestate!(mhe, [50, 30], [5]) ) @test mhe.P̂arr_old ≈ P̂arr_old_copy @test mhe.invP̄ ≈ invP̄_copy @test_logs( - (:warn, "Arrival covariance is not positive definite: keeping the old one"), + (:error, "Arrival covariance is not positive definite: keeping the old one"), updatestate!(mhe, [10, 50], [50, 30], [5]) ) @test mhe.P̂arr_old ≈ P̂arr_old_copy @test mhe.invP̄ ≈ invP̄_copy @test_logs( - (:warn, "Arrival covariance is not invertible: keeping the old one"), + (:error, "Arrival covariance is not invertible: keeping the old one"), ModelPredictiveControl.invert_cov!(mhe, Hermitian(zeros(mhe.nx̂, mhe.nx̂),:L)) ) end From 2fb6fff1247b02c78f9b50e52e59220409e1c4d7 Mon Sep 17 00:00:00 2001 From: franckgaga Date: Thu, 6 Feb 2025 12:22:27 -0500 Subject: [PATCH 3/6] test: debug test fallback MHE --- test/test_state_estim.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_state_estim.jl b/test/test_state_estim.jl index 084d99f22..c7c3a2e94 100644 --- a/test/test_state_estim.jl +++ b/test/test_state_estim.jl @@ -988,19 +988,19 @@ end P̂arr_old_copy = deepcopy(mhe.P̂arr_old) invP̄_copy = deepcopy(mhe.invP̄) @test_logs( - (:error, "Arrival covariance is not positive definite: keeping the old one"), + (:error, "Arrival covariance P̄ is not positive definite: keeping the old one"), preparestate!(mhe, [50, 30], [5]) ) @test mhe.P̂arr_old ≈ P̂arr_old_copy @test mhe.invP̄ ≈ invP̄_copy @test_logs( - (:error, "Arrival covariance is not positive definite: keeping the old one"), + (:error, "Arrival covariance P̄ is not positive definite: keeping the old one"), updatestate!(mhe, [10, 50], [50, 30], [5]) ) @test mhe.P̂arr_old ≈ P̂arr_old_copy @test mhe.invP̄ ≈ invP̄_copy @test_logs( - (:error, "Arrival covariance is not invertible: keeping the old one"), + (:error, "Arrival covariance P̄ is not invertible: keeping the old one"), ModelPredictiveControl.invert_cov!(mhe, Hermitian(zeros(mhe.nx̂, mhe.nx̂),:L)) ) end From aa9ac612454d796635449350d9b950140afceded Mon Sep 17 00:00:00 2001 From: franckgaga Date: Thu, 6 Feb 2025 12:24:51 -0500 Subject: [PATCH 4/6] changed: update CI and test on `pre` instead of `nightly` --- .github/workflows/CI.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0a13f11b7..07558d4a5 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -19,9 +19,10 @@ jobs: fail-fast: false matrix: version: - - '1' - - '1.10' - - 'nightly' + - 'lts' # long-term support release + - '1' # latest stable 1.x release + - 'pre' # latest stable prerelease + # - 'nightly' # commented since noisy + 'pre' allows testing upcoming versions os: - ubuntu-latest arch: @@ -31,11 +32,11 @@ jobs: if: ${{ runner.debug == '1' }} run: echo "JULIA_DEBUG=ModelPredictiveControl" >> $GITHUB_ENV - uses: actions/checkout@v2 - - uses: julia-actions/setup-julia@v1 + - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - uses: julia-actions/cache@v1 + - uses: julia-actions/cache@v2 - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 - uses: julia-actions/julia-processcoverage@v1 From 677b9c7b134ec77be09a46800e330f3eb7b73e8d Mon Sep 17 00:00:00 2001 From: franckgaga Date: Thu, 6 Feb 2025 13:05:50 -0500 Subject: [PATCH 5/6] added: required permissions for new cache version in CI --- .github/workflows/CI.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 07558d4a5..10c7f8f62 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -14,6 +14,9 @@ jobs: test: name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} runs-on: ${{ matrix.os }} + permissions: # needed for julia-actions/cache delete old caches that it has created + actions: write + contents: read continue-on-error: ${{ matrix.version == 'nightly' }} strategy: fail-fast: false @@ -28,10 +31,10 @@ jobs: arch: - x64 steps: - - name: Set JULIA_DEBUG environment variable + - name: Set JULIA_DEBUG environment variable if applicable if: ${{ runner.debug == '1' }} run: echo "JULIA_DEBUG=ModelPredictiveControl" >> $GITHUB_ENV - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.version }} From 701c5ccab8a4749a7dddb2ff7afd5459dc2df912 Mon Sep 17 00:00:00 2001 From: franckgaga Date: Thu, 6 Feb 2025 13:46:04 -0500 Subject: [PATCH 6/6] doc: minor correction `getinfo` for MHE --- src/estimator/mhe/execute.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/estimator/mhe/execute.jl b/src/estimator/mhe/execute.jl index 2317bc315..84368b099 100644 --- a/src/estimator/mhe/execute.jl +++ b/src/estimator/mhe/execute.jl @@ -77,7 +77,7 @@ following fields: - `:Ŵ` or *`:What`* : optimal estimated process noise over ``N_k``, ``\mathbf{Ŵ}`` - `:ϵ` or *`:epsilon`* : optimal slack variable, ``ϵ`` - `:X̂` or *`:Xhat`* : optimal estimated states over ``N_k+1``, ``\mathbf{X̂}`` -- `:x̂` or *`:xhat`* : optimal estimated state for the next time step, ``\mathbf{x̂}_k(k+1)`` +- `:x̂` or *`:xhat`* : optimal estimated state, ``\mathbf{x̂}_k(k+p)`` - `:V̂` or *`:Vhat`* : optimal estimated sensor noise over ``N_k``, ``\mathbf{V̂}`` - `:P̄` or *`:Pbar`* : estimation error covariance at arrival, ``\mathbf{P̄}`` - `:x̄` or *`:xbar`* : optimal estimation error at arrival, ``\mathbf{x̄}``