Goal
Know whether a compute_control call actually solved its QP when the controller runs inside a simulation/deployment loop, without stopping the loop.
In DiscreteComponents (Dyad components wrapping LinearMPC.jl) each tick calls compute_control from a clocked equation; an infeasible QP must not abort the whole simulation, but the caller wants to log or act on the solver status (hold the previous control, count failures, flag the run). The same holds for a Simulation-style loop written by hand.
What I tried
compute_control(mpc, x; check = true) (the default) asserts exitflag >= 1 and throws, so the loop dies.
compute_control(mpc, x; check = false) returns a control on failure (the solver's last iterate, as far as I can tell) but gives no indication that it failed.
- Reaching for
form_parameter + solve(mpc, θ) gives the exit flag, but both are internals that are not part of the documented API, so a wrapper built on them breaks silently when they change; compute_control is the only public entry point.
- The generated C (
mpc_compute_control) already returns the DAQP exit flag as its return value, so the C side has what the Julia side lacks.
Question
Is there an intended way to get the solver status of the last compute_control call (or the last exit flag / DAQP.flag2status entry) through the public API? If not, would a supported way to obtain it — whatever shape fits the package — be welcome? I'd be happy to help with a PR once the preferred form is clear.
Goal
Know whether a
compute_controlcall actually solved its QP when the controller runs inside a simulation/deployment loop, without stopping the loop.In DiscreteComponents (Dyad components wrapping LinearMPC.jl) each tick calls
compute_controlfrom a clocked equation; an infeasible QP must not abort the whole simulation, but the caller wants to log or act on the solver status (hold the previous control, count failures, flag the run). The same holds for aSimulation-style loop written by hand.What I tried
compute_control(mpc, x; check = true)(the default) assertsexitflag >= 1and throws, so the loop dies.compute_control(mpc, x; check = false)returns a control on failure (the solver's last iterate, as far as I can tell) but gives no indication that it failed.form_parameter+solve(mpc, θ)gives the exit flag, but both are internals that are not part of the documented API, so a wrapper built on them breaks silently when they change;compute_controlis the only public entry point.mpc_compute_control) already returns the DAQP exit flag as its return value, so the C side has what the Julia side lacks.Question
Is there an intended way to get the solver status of the last
compute_controlcall (or the last exit flag /DAQP.flag2statusentry) through the public API? If not, would a supported way to obtain it — whatever shape fits the package — be welcome? I'd be happy to help with a PR once the preferred form is clear.