From 4e68925c911d9c12b5fadfd2bcaee82ed0243f2a Mon Sep 17 00:00:00 2001 From: Fredrik Bagge Carlson Date: Tue, 17 Dec 2024 13:04:01 +0100 Subject: [PATCH] switch from `has_ip` to `!has_oop` --- examples/example_quadtank.jl | 2 +- src/ekf.jl | 4 ++-- src/ukf.jl | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/example_quadtank.jl b/examples/example_quadtank.jl index 16311f4f..cfd106b5 100644 --- a/examples/example_quadtank.jl +++ b/examples/example_quadtank.jl @@ -61,7 +61,7 @@ function quadtank_params(h,u,p,t) ssqrt(x) = √(max(x, zero(x)) + 1e-3) # For numerical robustness at x = 0 - xd = SA[ + SA[ -a1/A1 * ssqrt(2g*h[1]) + a3/A1*ssqrt(2g*h[3]) + γ1*k1/A1 * u[1] -a2/A2 * ssqrt(2g*h[2]) + a4/A2*ssqrt(2g*h[4]) + γ2*k2/A2 * u[2] -a3/A3*ssqrt(2g*h[3]) + (1-γ2)*k2/A3 * u[2] diff --git a/src/ekf.jl b/src/ekf.jl index f375071f..cc681ce6 100644 --- a/src/ekf.jl +++ b/src/ekf.jl @@ -49,7 +49,7 @@ function ExtendedKalmanFilter(dynamics, measurement_model::AbstractMeasurementMo end function ExtendedKalmanFilter(dynamics, measurement, R1,R2,d0=SimpleMvNormal(Matrix(R1)); nu::Int, ny=size(R2,1), Cjac = nothing, kwargs...) - IPM = has_ip(measurement) + IPM = !has_oop(measurement) T = promote_type(eltype(R1), eltype(R2), eltype(d0)) nx = size(R1,1) measurement_model = EKFMeasurementModel{T, IPM}(measurement, R2; nx, ny, Cjac) @@ -58,7 +58,7 @@ end function ExtendedKalmanFilter(kf, dynamics, measurement; Ajac = nothing, Cjac = nothing) - IPD = has_ip(dynamics) + IPD = !has_oop(dynamics) if measurement isa AbstractMeasurementModel measurement_model = measurement IPM = isinplace(measurement_model) diff --git a/src/ukf.jl b/src/ukf.jl index 2f898ee9..094e8ae4 100644 --- a/src/ukf.jl +++ b/src/ukf.jl @@ -176,8 +176,8 @@ end function UnscentedKalmanFilter(dynamics,measurement,args...; kwargs...) - IPD = has_ip(dynamics) - IPM = has_ip(measurement) + IPD = !has_oop(dynamics) + IPM = !has_oop(measurement) AUGD = false AUGM = false UnscentedKalmanFilter{IPD,IPM,AUGD,AUGM}(dynamics,measurement,args...;kwargs...) @@ -191,6 +191,7 @@ dynamics(kf::AbstractUnscentedKalmanFilter) = kf.dynamics # x(k+1) x u p t @inline has_ip(fun) = hasmethod(fun, Tuple{AbstractArray,AbstractArray,AbstractArray,AbstractArray,Real}) +@inline has_oop(fun) = hasmethod(fun, Tuple{ AbstractArray,AbstractArray,AbstractArray,Real}) """