// Mission continuity showcase — warehouse inventory scan with checkpoint resume
//
//   spanda continuity examples/showcase/continuity/warehouse.sd \
//     --failed ScannerAlpha --progress 72 --trigger robot_failed
//   spanda succession examples/showcase/continuity/warehouse.sd \
//     --failed ScannerAlpha --scope fleet

hardware RoverV1 {
    sensors [GPS, Camera, Lidar];
    actuators [DifferentialDrive];
    connectivity [WiFi];
}

mission_plan WarehouseInventoryScan {
    step navigate_to_aisle;
    step scan_shelf_a;
    step scan_shelf_b;
    step scan_shelf_c;
    step return_to_dock;
    constraint battery.level >= 20%;
}

fleet WarehouseFleet {
    ScannerAlpha;
    ScannerBeta;
    ScannerGamma;
}

recovery_policy ContinuityRecovery {
    on robot.failed {
        reassign mission;
        promote backup coordinator;
    }
}

continuity_policy WarehouseContinuity {
    on robot.failed {
        resume from checkpoint;
        reassign mission;
    }
}

operating_mode NormalMode { normal; }
operating_mode DegradedMode { degraded; }
operating_mode SafeMode { safe; }
operating_mode RecoveryMode { recovery; }

robot ScannerAlpha {
    sensor gps: GPS;
    sensor camera: Camera;
    sensor lidar: Lidar;
    actuator wheels: DifferentialDrive;
    safety { max_speed = 1.0 m/s; }
    behavior scan() { wheels.drive(0.3 m/s); }
}

robot ScannerBeta {
    sensor gps: GPS;
    sensor camera: Camera;
    sensor lidar: Lidar;
    actuator wheels: DifferentialDrive;
    safety { max_speed = 1.0 m/s; }
    behavior scan() { wheels.drive(0.3 m/s); }
}

robot ScannerGamma {
    sensor gps: GPS;
    sensor camera: Camera;
    sensor lidar: Lidar;
    actuator wheels: DifferentialDrive;
    safety { max_speed = 1.0 m/s; }
    behavior scan() { wheels.drive(0.3 m/s); }
}
