language grl 0.1
module W2PathEvents
  const speed vj = joint(35 %)
  const speed vl = linear(120 mm/s)
  const zone z10 = z(10 mm)
  target home = joint_target { joints: [0 deg, 0 deg, 0 deg, 0 deg, 0 deg, 0 deg] }
  target pick = joint_target { joints: [11.459156 deg, -20.053523 deg, 25.783101 deg, 5.729578 deg, -11.459156 deg, 17.188734 deg] }
  target place = joint_target { joints: [-20.053523 deg, -14.323945 deg, 20.053523 deg, -14.323945 deg, 8.594367 deg, -22.918312 deg] }
  path generated_path {
    source {
      type: "cad_curve",
      id: "edge_032",
      sample_distance: 5 mm
    }
    defaults { speed: vj, zone: z10 }
    point p_home movej home zone fine
    event before p_pick io.do[10] = true
    point p_pick movej pick speed vj
    event after p_pick wait io.di[10] == true timeout 2 s on_timeout alarm "pick sensor timeout"
    point p_place movej place speed vj
    event at p_place distance 10 mm pulse io.do[11] duration 100 ms
  }
  proc main()
    run_path generated_path
  end
end
