MFRotationRoutine.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using Aitex.Core.RT.Routine;
  2. using Aitex.Sorter.Common;
  3. using MECF.Framework.Common.Equipment;
  4. using MECF.Framework.Common.Schedulers;
  5. using System.Collections.Generic;
  6. using Venus_Core;
  7. using Venus_RT.Devices;
  8. namespace Venus_RT.Modules.TM
  9. {
  10. internal class MFRotationRoutine : ModuleRoutineBase, IRoutine
  11. {
  12. private enum RotationStep
  13. {
  14. Rotation,
  15. End
  16. }
  17. private readonly JetTM _JetTM;
  18. private readonly ITransferRobot _robot;
  19. private ModuleName _targetModule;
  20. public MFRotationRoutine(JetTM tm, ITransferRobot robot) : base(ModuleName.TMRobot)
  21. {
  22. _JetTM = tm;
  23. _robot = robot;
  24. }
  25. public RState Start(params object[] objs)
  26. {
  27. var rotationItem = (Queue<MoveItem>)objs[0];
  28. _targetModule = rotationItem.Peek().DestinationModule;
  29. return Runner.Start(Module, $"Rotation to {_targetModule}");
  30. }
  31. public RState Monitor()
  32. {
  33. Runner.Run(RotationStep.Rotation, Rotation , WaitRotationDone, _timeout_20s)
  34. .End(RotationStep.End, NullFun, _delay_50ms);
  35. return Runner.Status;
  36. }
  37. private bool Rotation()
  38. {
  39. return _robot.Goto(_targetModule, 0, Hand.Both);
  40. }
  41. private bool WaitRotationDone()
  42. {
  43. return _robot.Status == RState.End;
  44. }
  45. public void Abort()
  46. {
  47. }
  48. }
  49. }