use dsfb_robotics::engine::DsfbRoboticsEngine;
use dsfb_robotics::platform::RobotContext;
use dsfb_robotics::Episode;
fn host_pipeline_callback(k: usize, residual: f64) -> f64 {
let _ = k;
residual
}
fn dsfb_augmentation_callback(
engine: &mut DsfbRoboticsEngine<8, 4>,
k: usize,
residual: f64,
) -> Episode {
let below_floor = !residual.is_finite();
let norm = if residual.is_finite() { residual.abs() } else { 0.0 };
engine.observe_one(norm, below_floor, RobotContext::ArmOperating, k)
}
fn main() {
let mut engine = DsfbRoboticsEngine::<8, 4>::new(0.15);
let mut review_log: Vec<Episode> = Vec::new();
let host_loop_residuals = [
0.02, 0.03, 0.05, 0.08, 0.12, 0.16, 0.21, 0.13, 0.08, 0.04,
];
for (k, &raw_residual) in host_loop_residuals.iter().enumerate() {
let _consumed = host_pipeline_callback(k, raw_residual);
let annotation = dsfb_augmentation_callback(&mut engine, k, raw_residual);
review_log.push(annotation);
}
println!("DSFB side-channel review log ({} episodes):", review_log.len());
for ep in &review_log {
println!(
" k={:>2} norm²={:.4} drift={:+.4} grammar={}",
ep.index, ep.residual_norm_sq, ep.drift, ep.grammar
);
}
}