Skip to content

Getting the solver status of compute_control without asserting #115

Description

@baggepinnen

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions