Skip to main content

Module servo

Module servo 

Source
Expand description

SRD-86 §4–§6 — the Control-class actuation daemon.

Where a Coordinate-class axis is actuated by re-running the phase once per coordinate (executor::dispatch_optimization’s default loop), a Control-class axis is actuated by live-retargeting the phase’s dynamic control (SRD-23 concurrency / rate) on one continuous phase — no restart. The optimizer becomes a servoing daemon: pull the next setting → retarget the live control (confirmed-apply, awaited) → wait for the windowed objective to settle at that setting → read it → step. Repeat until the budget is spent, then stop the phase.

§Why an async task, not a cadence callback

The settle detector (super::settle) rides the sync metrics-cadence callback, but Control::set is async (confirmed-apply over async appliers). So the servo is a concurrent async future, tokio::join!’d with the activity loop inside run_phase. It reuses start_settle (which legitimately rides the sync callback) only to read the settled objective; the async retarget lives here, awaited directly so setting N is confirmed in effect before it is settled and read.

The live control is resolved off the phase component — where the fiber pool / rate limiter declared it in Activity::attach_component, which runs before the activity loop, so the handle always exists by the time the servo retargets.

Structs§

ControlAxis
One Control-class axis: its index in a coordinate tuple + the name of the live control ("concurrency" / "rate") it servos.
ServoBest
The best coordinate + objective value a servoing run found.
ServoOutcome
What a servoing run produced — read by the dispatch after the continuous phase returns. best is None if no setting ever yielded a value (e.g. the phase ended before the first settle).
ServoSpec
The servoing job, handed from dispatch_optimization to run_phase through ctx.optimize_servo. The result cell is written by servo and read by the dispatch after the continuous phase returns. (Clone only so the enclosing ExecCtx stays Clone; the spec is moved, not cloned, in use.)

Functions§

servo
Drive the optimizer over one continuous phase by live-retargeting its controls (SRD-86 Control-class actuation). Runs concurrent with the activity loop (tokio::join! in run_phase):