diff --git a/src/controller/execute.jl b/src/controller/execute.jl index 7ce81ceae..7f6da0cdf 100644 --- a/src/controller/execute.jl +++ b/src/controller/execute.jl @@ -58,12 +58,12 @@ julia> u = moveinput!(mpc, ry); round.(u, digits=3) """ function moveinput!( mpc::PredictiveController, - ry::Vector = mpc.estim.model.yop, - d ::Vector = mpc.buffer.empty; - lastu::Vector = (mpc.buffer.u .= mpc.lastu0 .+ mpc.estim.model.uop), - Dhat ::Vector = repeat!(mpc.buffer.D̂, d, mpc.Hp), - Rhaty::Vector = repeat!(mpc.buffer.Ŷ, ry, mpc.Hp), - Rhatu::Vector = mpc.Uop, + ry::AbstractVector = mpc.estim.model.yop, + d ::AbstractVector = mpc.buffer.empty; + lastu::AbstractVector = (mpc.buffer.u .= mpc.lastu0 .+ mpc.estim.model.uop), + Dhat ::AbstractVector = repeat!(mpc.buffer.D̂, d, mpc.Hp), + Rhaty::AbstractVector = repeat!(mpc.buffer.Ŷ, ry, mpc.Hp), + Rhatu::AbstractVector = mpc.Uop, D̂ = Dhat, R̂y = Rhaty, R̂u = Rhatu diff --git a/src/general.jl b/src/general.jl index 87f738e34..c43e138dc 100644 --- a/src/general.jl +++ b/src/general.jl @@ -174,7 +174,7 @@ function repeatdiag(A::Hermitian{NT, Diagonal{NT, Vector{NT}}}, n::Int) where {N end "In-place version of `repeat` but for vectors only." -function repeat!(Y::Vector, a::Vector, n::Int) +function repeat!(Y::AbstractVector, a::AbstractVector, n::Int) na = length(a) for i=0:n-1 # stop if Y is too short, another clearer error is thrown later in the code: diff --git a/src/predictive_control.jl b/src/predictive_control.jl index 33ea5e1d5..843978346 100644 --- a/src/predictive_control.jl +++ b/src/predictive_control.jl @@ -51,8 +51,8 @@ print_backends(::IO, ::PredictiveController) = nothing "Functor allowing callable `PredictiveController` object as an alias for `moveinput!`." function (mpc::PredictiveController)( - ry::Vector = mpc.estim.model.yop, - d ::Vector = mpc.estim.buffer.empty; + ry::AbstractVector = mpc.estim.model.yop, + d ::AbstractVector = mpc.estim.buffer.empty; kwargs... ) return moveinput!(mpc, ry, d; kwargs...)