Open 1-Bart-1 opened 3 hours ago
I would guess that you do something wrong in your package, how is this method defined? is it using RecipesBase.jl or directly overloading Plots.plot
?
plot(ci::ControlInterface)
@ KitePredictiveControl ~/Code/KitePredictiveControl.jl/src/KitePredictiveControl.jl:209
It could very well be that I am doing something wrong in my package. But changing the package plot
function to controlplot
does not solve the issue:
ERROR: LoadError: MethodError: no method matching plot(::ModelPredictiveControl.SimResult{Float64, ModelPredictiveControl.LinMPC{…}}; plotx::Bool, ploty::Bool, plotu::Bool, plotxwithx̂::Bool)
Closest candidates are:
plot(::Nothing, ::ModelPredictiveControl.SimResult{<:Real, <:ModelPredictiveControl.PredictiveController}) got unsupported keyword arguments "plotx", "ploty", "plotu", "plotxwithx̂"
@ ModelPredictiveControl ~/.julia/packages/ModelPredictiveControl/0rhFm/src/plot_sim.jl:325
plot(::Nothing, ::ModelPredictiveControl.SimResult{<:Real, <:ModelPredictiveControl.StateEstimator}) got unsupported keyword arguments "plotx", "ploty", "plotu", "plotxwithx̂"
@ ModelPredictiveControl ~/.julia/packages/ModelPredictiveControl/0rhFm/src/plot_sim.jl:324
plot(::Nothing, ::ModelPredictiveControl.SimResult{<:Real, <:ModelPredictiveControl.SimModel}) got unsupported keyword arguments "plotx", "ploty", "plotu", "plotxwithx̂"
@ ModelPredictiveControl ~/.julia/packages/ModelPredictiveControl/0rhFm/src/plot_sim.jl:323
Stacktrace:
[1] controlplot(ci::ControlInterface)
@ KitePredictiveControl ~/Code/KitePredictiveControl.jl/src/KitePredictiveControl.jl:210
[2] top-level scope
@ ~/Code/KitePredictiveControl.jl/examples/simple.jl:16
[3] include(fname::String)
@ Base.MainInclude ./client.jl:489
[4] top-level scope
@ REPL[1]:1
in expression starting at /home/bart/Code/KitePredictiveControl.jl/examples/simple.jl:12
Some type information was truncated. Use `show(err)` to see complete types.
The method is defined in module KitePredictiveControl
as:
function controlplot(ci::ControlInterface)
res = SimResult(ci.mpc, ci.U_data, ci.Y_data; ci.Ry_data, ci.X̂_data, ci.X_data)
# return ModelPredictiveControl.plot(res; plotx=true, ploty=ci.output_idxs, plotu=true, plotxwithx̂=ci.observed_idxs)
return ModelPredictiveControl.plot(res; plotx=true, ploty=true, plotu=true, plotxwithx̂=true)
end
It looks like this is the culprit https://github.com/JuliaControl/ModelPredictiveControl.jl/blob/38333015ea653e601ed1955bed2f1142dddc64a7/src/plot_sim.jl#L323
As a fix for you, I would try calling Plots.plot
instead of ModelPredictiveControl.plot
Thanks, that solved the issue. Maybe this should be documented to avoid future confusions?
see PR linekd above
Wow, that was fast :rocket:
I am using MPC.jl in a module. When running
ModelPredictiveControl.plot(res; plotx=true, ploty=true, plotu=true, plotxwithx̂=true)
I get the error:I don't know what could cause this. It worked before, but after some code reformatting, it stopped working.