Skip to content

Commit e83ee42

Browse files
authored
Merge pull request #154 from JuliaControl/error_log_mhe_arrival
changed: `@error` instead of `@warn` in MHE arrival covariance fallback + update CI
2 parents cc2a92f + 701c5cc commit e83ee42

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

.github/workflows/CI.yml

+11-7
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,32 @@ jobs:
1414
test:
1515
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
1616
runs-on: ${{ matrix.os }}
17+
permissions: # needed for julia-actions/cache delete old caches that it has created
18+
actions: write
19+
contents: read
1720
continue-on-error: ${{ matrix.version == 'nightly' }}
1821
strategy:
1922
fail-fast: false
2023
matrix:
2124
version:
22-
- '1'
23-
- '1.10'
24-
- 'nightly'
25+
- 'lts' # long-term support release
26+
- '1' # latest stable 1.x release
27+
- 'pre' # latest stable prerelease
28+
# - 'nightly' # commented since noisy + 'pre' allows testing upcoming versions
2529
os:
2630
- ubuntu-latest
2731
arch:
2832
- x64
2933
steps:
30-
- name: Set JULIA_DEBUG environment variable
34+
- name: Set JULIA_DEBUG environment variable if applicable
3135
if: ${{ runner.debug == '1' }}
3236
run: echo "JULIA_DEBUG=ModelPredictiveControl" >> $GITHUB_ENV
33-
- uses: actions/checkout@v2
34-
- uses: julia-actions/setup-julia@v1
37+
- uses: actions/checkout@v4
38+
- uses: julia-actions/setup-julia@v2
3539
with:
3640
version: ${{ matrix.version }}
3741
arch: ${{ matrix.arch }}
38-
- uses: julia-actions/cache@v1
42+
- uses: julia-actions/cache@v2
3943
- uses: julia-actions/julia-buildpkg@v1
4044
- uses: julia-actions/julia-runtest@v1
4145
- uses: julia-actions/julia-processcoverage@v1

src/estimator/mhe/execute.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ following fields:
7777
- `:Ŵ` or *`:What`* : optimal estimated process noise over ``N_k``, ``\mathbf{Ŵ}``
7878
- `:ϵ` or *`:epsilon`* : optimal slack variable, ``ϵ``
7979
- `:X̂` or *`:Xhat`* : optimal estimated states over ``N_k+1``, ``\mathbf{X̂}``
80-
- `:x̂` or *`:xhat`* : optimal estimated state for the next time step, ``\mathbf{x̂}_k(k+1)``
80+
- `:x̂` or *`:xhat`* : optimal estimated state, ``\mathbf{x̂}_k(k+p)``
8181
- `:V̂` or *`:Vhat`* : optimal estimated sensor noise over ``N_k``, ``\mathbf{V̂}``
8282
- `:P̄` or *`:Pbar`* : estimation error covariance at arrival, ``\mathbf{P̄}``
8383
- `:x̄` or *`:xbar`* : optimal estimation error at arrival, ``\mathbf{x̄}``
@@ -445,7 +445,7 @@ function correct_cov!(estim::MovingHorizonEstimator)
445445
invert_cov!(estim, estim.P̂arr_old)
446446
catch err
447447
if err isa PosDefException
448-
@warn("Arrival covariance is not positive definite: keeping the old one")
448+
@error("Arrival covariance is not positive definite: keeping the old one")
449449
else
450450
rethrow()
451451
end
@@ -465,7 +465,7 @@ function update_cov!(estim::MovingHorizonEstimator)
465465
invert_cov!(estim, estim.P̂arr_old)
466466
catch err
467467
if err isa PosDefException
468-
@warn("Arrival covariance is not positive definite: keeping the old one")
468+
@error("Arrival covariance is not positive definite: keeping the old one")
469469
else
470470
rethrow()
471471
end
@@ -479,7 +479,7 @@ function invert_cov!(estim::MovingHorizonEstimator, P̄)
479479
estim.invP̄ .= inv_cholesky!(estim.buffer.P̂, P̄)
480480
catch err
481481
if err isa PosDefException
482-
@warn("Arrival covariance is not invertible: keeping the old one")
482+
@error("Arrival covariance is not invertible: keeping the old one")
483483
else
484484
rethrow()
485485
end

test/test_state_estim.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -988,19 +988,19 @@ end
988988
P̂arr_old_copy = deepcopy(mhe.P̂arr_old)
989989
invP̄_copy = deepcopy(mhe.invP̄)
990990
@test_logs(
991-
(:warn, "Arrival covariance is not positive definite: keeping the old one"),
991+
(:error, "Arrival covariance is not positive definite: keeping the old one"),
992992
preparestate!(mhe, [50, 30], [5])
993993
)
994994
@test mhe.P̂arr_old P̂arr_old_copy
995995
@test mhe.invP̄ invP̄_copy
996996
@test_logs(
997-
(:warn, "Arrival covariance is not positive definite: keeping the old one"),
997+
(:error, "Arrival covariance is not positive definite: keeping the old one"),
998998
updatestate!(mhe, [10, 50], [50, 30], [5])
999999
)
10001000
@test mhe.P̂arr_old P̂arr_old_copy
10011001
@test mhe.invP̄ invP̄_copy
10021002
@test_logs(
1003-
(:warn, "Arrival covariance is not invertible: keeping the old one"),
1003+
(:error, "Arrival covariance is not invertible: keeping the old one"),
10041004
ModelPredictiveControl.invert_cov!(mhe, Hermitian(zeros(mhe.nx̂, mhe.nx̂),:L))
10051005
)
10061006
end

0 commit comments

Comments
 (0)