// Robotics — predictive maintenance signals (std.maintenance)
//
//   spanda check examples/robotics/predictive_maintenance.sd
//   spanda run examples/robotics/predictive_maintenance.sd

import std.maintenance;

robot IndustrialArm {
  sensor lidar: Lidar on "/scan";
  actuator wheels: DifferentialDrive;

  safety {
    max_speed = 0.5 m/s;
    stop_if lidar.nearest_distance < 0.3 m;
  }

  every 5s {
    let health = 0.92;
    if health < 0.7 {
      wheels.stop();
    }
  }

  behavior operate() {
    loop every 100ms {
      wheels.drive(linear: 0.1 m/s, angular: 0.0 rad/s);
    }
  }
}
