Skip to content

Commit

Permalink
switch from has_ip to !has_oop
Browse files Browse the repository at this point in the history
  • Loading branch information
baggepinnen committed Dec 17, 2024
1 parent 7ea1163 commit 4e68925
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/example_quadtank.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions src/ekf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions src/ukf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand All @@ -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})


"""
Expand Down

0 comments on commit 4e68925

Please sign in to comment.