ruvnet/RuView · error

calibration failed: {e}

Error message

calibration failed: {e}

What it means

Raised by finalise_and_save when CalibrationRecorder::finalize() returns Err. finalize() (wifi-densepose-signal/src/ruvsense/calibration.rs:532) converts accumulated Welford statistics into a BaselineCalibration and its only failure mode is CalibrationError::InsufficientFrames, returned when fewer than config.min_frames CSI frames were recorded. The {e} payload states the recorded vs required frame counts.

Source

Thrown at v2/crates/wifi-densepose-cli/src/calibrate.rs:214

        "no"
    };
    eprintln!(
        "[calibrate] {}/{} frames | z_med={:.2} z_max={:.2} | motion: {}",
        frames, target, score.amplitude_z_median, score.amplitude_z_max, motion_str
    );
}

// ---------------------------------------------------------------------------
// Finalise + persist
// ---------------------------------------------------------------------------

fn finalise_and_save(recorder: CalibrationRecorder, output: &str) -> Result<()> {
    let frames = recorder.frames_recorded();
    eprintln!("[calibrate] finalising baseline from {frames} frames…");

    let baseline: BaselineCalibration = recorder
        .finalize()
        .map_err(|e| anyhow::anyhow!("calibration failed: {e}"))?;

    let bytes = baseline.to_bytes();
    std::fs::write(output, &bytes)
        .map_err(|e| anyhow::anyhow!("cannot write {output}: {e}"))?;

    eprintln!(
        "[calibrate] baseline saved to {output} ({} bytes)",
        bytes.len()
    );
    eprintln!(
        "[calibrate] summary: frames={} tier={:?} subcarriers={}",
        baseline.frame_count,
        baseline.tier,
        baseline.subcarriers.len(),
    );
    Ok(())
}

View on GitHub (pinned to 4685618388)

Solutions

  1. Confirm the node streams CSI to the port the CLI listens on and that the log line '[calibrate] finalising baseline from N frames…' shows N at or above min_frames
  2. Extend the capture duration (or raise the node frame rate) so at least min_frames frames accumulate before finalization
  3. Lower CalibrationConfig::min_frames if a shorter baseline is acceptable for your tier
  4. Watch the live deviation output during recording; motion_flagged frames mean the room was not empty — restart the capture

Example fix

// before
let baseline: BaselineCalibration = recorder
    .finalize()
    .map_err(|e| anyhow::anyhow!("calibration failed: {e}"))?;

// after
if (recorder.frames_recorded() as usize) < config.min_frames {
    eprintln!(
        "[calibrate] only {} frames — need {}; capture longer",
        recorder.frames_recorded(),
        config.min_frames
    );
}
let baseline: BaselineCalibration = recorder
    .finalize()
    .map_err(|e| anyhow::anyhow!("calibration failed: {e}"))?;
Defensive patterns

Strategy: validation

Validate before calling

use wifi_densepose_signal::ruvsense::calibration::{CalibrationConfig, CalibrationRecorder};

fn ready_to_finalize(recorder: &CalibrationRecorder, cfg: &CalibrationConfig) -> bool {
    (recorder.frames_recorded() as usize) >= cfg.min_frames
}

Try / catch

match recorder.finalize() {
    Ok(baseline) => { /* persist */ }
    Err(CalibrationError::InsufficientFrames { got, need }) => {
        eprintln!("need {need} frames, recorded {got} — keep the room empty and capture longer");
    }
    Err(e) => return Err(anyhow::anyhow!("calibration failed: {e}")),
}

Prevention

When it happens

Trigger: Running the calibrate command with a capture window too short for min_frames; the CSI node streaming nothing or intermittently (wrong UDP port, node down) so frames_recorded() stays below config.min_frames when finalise_and_save is reached.

Common situations: Fresh setups where firmware is not yet streaming to the CLI's UDP port; operator shortens the capture duration below what the node frame rate needs; Wi-Fi dropouts mid-capture; min_frames raised in CalibrationConfig without lengthening the capture.

Related errors


AI-assisted analysis of ruvnet/RuView@4685618388 (2026-08-16). Data as JSON: /api/errors/2a1192a6a2441c53. Report an issue: GitHub.