Skip to main content

servo

Function servo 

Source
pub async fn servo(
    spec: ServoSpec,
    stop_flag: Arc<AtomicBool>,
    reporter: Arc<CadenceReporter>,
    parent: Arc<ScopeKernel>,
    phase_kernel: Arc<ScopeKernel>,
    phase_component: Arc<RwLock<Component>>,
    phase_done: Arc<AtomicBool>,
) -> Result<(), String>
Expand description

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):

  1. pull the next coordinate, retarget each control axis to it (awaited, confirmed-apply);
  2. settle the windowed objective at that setting via start_settle (its verdict raises a throwaway per-setting flag, never the phase stop flag), reading the stabilized value from the settle register;
  3. step the optimizer and track the best.

On budget exhaustion (or when the phase ends first — phase_done), it publishes the best into spec.best and raises stop_flag to end the phase.