Skip to content

Consider adding controls support (PID, LQR, steady-state Kalman) #35

Description

@MitchellThompkins

constfilt exposes the full state-space substrate (discretization, `StateSpace`, consteig matrix ops) and is well-positioned to support basic control design. The motivating use case is embedded systems where the plant model is known at compile time and gains should live as source code alongside the model. Change inertia or sample rate and the gains recompute automatically.

Example use cases:

  • PID: DC motor speed control or thermal regulation with fixed tuning parameters and sample rate. Coefficients baked in at compile time with no offline toolchain.
  • LQR: reaction wheel attitude control on a CubeSat (3-axis rigid body dynamics fixed after mass properties are measured; Q/R weights from simulation) or a balancing robot (2-4 states characterized once, gains baked into firmware).
  • Steady-state Kalman: IMU orientation fusion where gyro/accel noise floors come from the datasheet and the plant dynamics are fixed.

The compile-time aspect is less about compute cost (DARE is cheap to run once at startup) and more about co-location: the gains live alongside the plant model in source, so a parameter change forces a recompile and the gains update automatically.

In scope:

  • PID/PI/PD: discrete PID is a 2nd-order IIR filter; the existing `Filter` class can execute it, just needs a coefficient convenience wrapper
  • LQR: DARE solver (Newton-Kleinman iteration uses only matrix multiply + LU solve, both already in consteig) + gain computation
  • Steady-state Kalman: dual of LQR, near-free once DARE exists

Open questions:

  • Library structure: extend constfilt, or a new `constctrl` that depends on constfilt for state-space + discretization
  • MIMO plant representation: `StateSpace<T,N>` is currently SISO; LQR needs N×M input matrix B

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