Cherry pick doc and general improvements commits from hessian_objective#200
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #200 +/- ##
==========================================
- Coverage 98.90% 98.81% -0.10%
==========================================
Files 25 25
Lines 4220 4223 +3
==========================================
- Hits 4174 4173 -1
- Misses 46 50 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
The MTK example in the manual no longer work. For now, I will pin MTK version in the doc environment and add compat admonition in the doc. @baggepinnen or @1-Bart-1 are you aware of any change in MTK recently that broke the MTK code ? The model is: using ModelPredictiveControl, ModelingToolkit
using ModelingToolkit: D_nounits as D, t_nounits as t, varmap_to_vars
@mtkmodel Pendulum begin
@parameters begin
g = 9.8
L = 0.4
K = 1.2
m = 0.3
end
@variables begin
θ(t) # state
ω(t) # state
τ(t) # input
y(t) # output
end
@equations begin
D(θ) ~ ω
D(ω) ~ -g/L*sin(θ) - K/m*ω + τ/m/L^2
y ~ θ * 180 / π
end
end
@named mtk_model = Pendulum()
mtk_model = complete(mtk_model)it crashes at this line: (_, f_ip), dvs, psym, io_sys = ModelingToolkit.generate_control_function(
model, inputs, split=false; outputs
)the error is: ERROR: The LHS cannot contain nondifferentiated variables. Please run `structural_simplify` or use the DAE form.
Got y(t) ~ 57.29577951308232θ(t)
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] check_operator_variables(eqs::Vector{Equation}, op::Type{Differential})
@ ModelingToolkit ~/.julia/packages/ModelingToolkit/Iruox/src/utils.jl:361
[3] generate_control_function(sys::ODESystem, inputs::Vector{…}, disturbance_inputs::Vector{…}; disturbance_argument::Bool, implicit_dae::Bool, simplify::Bool, eval_expression::Bool, eval_module::Module, kwargs::@Kwargs{…})
@ ModelingToolkit ~/.julia/packages/ModelingToolkit/Iruox/src/inputoutput.jl:233
[4] generate_f_h(model::ODESystem, inputs::Vector{Num}, outputs::Vector{Num})
@ Main ~/.julia/dev/ModelPredictiveControl/docs/src/manual/mtk.md:60
[5] top-level scope
@ ~/.julia/dev/ModelPredictiveControl/docs/src/manual/mtk.md:105
Some type information was truncated. Use `show(err)` to see complete types.Once again, a not-so-helpful error message since it is clearly mentionned in |
|
FYI, the exemple work in MTK v9.76.0. So the breaking change is in v9.77.0 |
|
I'm not sure what has changed in MTK, when MTK examples break it's usually only @AayushSabharwal who knows why |
Include calling
rethrow()instead ofrethrow(err)and minor corrections in doc and tests