using Aitex.Core.RT.Device; using Aitex.Core.RT.Event; using Aitex.Sorter.Common; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase; namespace EFEM.RT.Tasks { public class SetClampTask : RobotImp, ITask { public SetClampTask() { //HasInfoMessage = false; } public bool Execute(out string result, params string[] args) { Hand arm = Hand.Blade2; if (!ParseMoveArm(args[0], out arm)) { EV.PostWarningLog("Server", $"{args[0]} not valid arm parameter"); result = PARAM_NG; return false; } if (!Check(DeviceName.Robot, out result)) { return false; } if (!Check(DeviceName.Robot, out result)) { return false; } if (!Check(DeviceName.Robot, out result)) { return false; } RobotBaseDevice _device = DEVICE.GetDevice(DeviceName.Robot); if (_device != null) { if (_device.IsError) { result = "HASERROR"; return false; } if(args[1].ToString()=="ON") _device.Grip((RobotArmEnum)arm); else if (args[1].ToString() == "OFF") _device.Release((RobotArmEnum)arm); result = string.Empty; return true; } result = "NOFUNC"; return false; } public bool? Monitor(out string result, params string[] args) { result = ""; if (args[0].StartsWith("ARM")) { string device = DeviceName.Robot; Hand arm = Hand.Blade2; if (!ParseMoveArm(args[0], out arm) || arm == Hand.Both) { result = PARAM_NG; return false; } RobotBaseDevice robot = DEVICE.GetDevice(device); if (robot.IsError) { return false; } if (robot.IsReady()) { //if (arm == Hand.Blade1) // result = robot.StateBlade1Gripped ? "ON" : "OFF"; //else if (arm == Hand.Blade2) // result = robot.StateBlade2Gripped ? "ON" : "OFF"; return true; } } else { return true; } return null; } } public class GetClampTask : RobotImp, ITask { public GetClampTask() { } public bool Execute(out string result, params string[] args) { result = "NOFUNC"; return false; } public bool? Monitor(out string result, params string[] args) { result = string.Empty; if (args[0].StartsWith("ARM")) { string device = DeviceName.Robot; Hand arm = Hand.Blade2; if (!ParseMoveArm(args[0], out arm) || arm == Hand.Both) { result = PARAM_NG; return false; } RobotBaseDevice robot = DEVICE.GetDevice(device); if (robot.IsError) { return false; } if (!robot.IsBusy) { //if (arm == Hand.Blade1) // result = robot. ? "ON" : "OFF"; //else if (arm == Hand.Blade2) // result = robot.StateBlade2Gripped ? "ON" : "OFF"; return true; } } else { return true; } return null; } } }