public override void run(double dt) { bool resultx = true; bool resulty = true; bool resultz = true; sumdt += dt; if (sumdt >= time || istimeout) { istimeout = true; isfinish = true; return; } var device = new ActionDevice(node); switch (step) { case 0: if (x >= 0) { resultx = device.MoveX((int)x); } if (y >= 0) { resulty = device.MoveY((int)y); } if (z >= 0) { resultz = device.MoveZ((int)z); } if (resultx && resulty && resultz) { step++; } break; case 1: if (xdone == false) { xdone = device.DoneX(); } if (ydone == false) { ydone = device.DoneY(); } if (zdone == false) { zdone = device.DoneZ(); } isfinish = xdone && ydone && zdone; break; } }
public override void run(double dt) { bool resultz = true; sumdt += dt; if (sumdt >= time || istimeout) { istimeout = true; isfinish = true; return; } var device = new ActionDevice(node); var hand = (MachineHandDevice)node; switch (step) { case 0: if (hand.CheckGel() == true) { ErrorSystem.WriteActError("抓手有卡!", true); istimeout = true; isfinish = true; return; } else { if (hand.CanComm.SetRegister(hand.Hand.ZMotor.Speed.Addr, hand.Hand.ZMotor.Speed.SetValue)) { step++; } } break; case 1: resultz = hand.Hand.IsOpen || (hand.Hand.IsOpen == false && hand.SwitchHand(true)); if (resultz) { step++; } break; case 2: resultz = device.MoveZ((int)z, true); if (resultz) { step++; } break; case 3: if (device.DoneZ()) { step++; } break; case 4: resultz = device.MoveZ((int)zl, false); if (resultz) { step++; } break; case 5: if (sumdt - lasttime > 50) { lasttime = sumdt; if (hand.CheckGel() == true) { resultz = hand.CanComm.SetCoilOff(hand.Hand.ZMotor.StartCoil.Addr); if (resultz) { step++; } } } break; case 6: bool is_timeout = false; hand.CanComm.ReadRegister(hand.Hand.ZMotor.RealDistance.Addr); curz = hand.CanComm.GetIntBlock(hand.Hand.ZMotor.RealDistance.Addr, 1000, out is_timeout) + (int)zc; if (is_timeout) { ErrorSystem.WriteActError("抓手超时", true); istimeout = true; isfinish = true; return; } else { step++; } break; case 7: resultz = device.MoveZ((int)curz, true); if (resultz) { step++; } break; case 8: resultz = hand.SwitchHand(false); if (resultz) { step++; } break; case 9: resultz = device.MoveZ((int)zb, true); if (resultz) { step++; } break; case 10: isfinish = device.DoneZ(); break; } }
public override void run(double dt) { bool resultz = true; bool resultx = true; bool resulty = true; sumdt += dt; if (sumdt >= time || istimeout) { istimeout = true; isfinish = true; return; } var device = new ActionDevice(node); var inject = (InjectorDevice)node; switch (step) { case 0: //是否已有吸头 //针头数据检测(针头序号+装针个数不能大于通道个数) int inject_count = inject.GetSeleteced().Count(); if (head_index + tipdata.count <= inject_count) { step++; } else { istimeout = true; isfinish = true; } break; case 1: resultx = device.MoveX(tipdata.x); resulty = device.MoveY(tipdata.y); if (resultx && resulty) { step++; } break; case 2: if (xdone == false) { xdone = device.DoneX(); } if (ydone == false) { ydone = device.DoneY(); } if (xdone && ydone) { step = 7; } break; case 3: int[] z_tem = { -1, -1, -1, -1 }; for (int i = head_index; i < tipdata.count; i++) { z_tem[i] = z; } resultz = device.MoveInjectZ(z_tem, true); if (resultz) { step++; } break; case 4: for (int i = head_index; i < tipdata.count; i++) { if (zdone[i] == false) { xdone = device.DoneInjectZ(i); } } if (zdone[0] && zdone[1] && zdone[2] && zdone[3]) { step++; } break; case 5: resultz = device.MoveZ(0, true); if (resultz) { step++; } break; case 6: if (device.DoneZ()) { step++; } break; case 7: isfinish = true; break; } }
public override void run(double dt) { bool resultz = true; sumdt += dt; if (sumdt >= time || istimeout) { istimeout = true; isfinish = true; return; } var device = new ActionDevice(node); var hand = (MachineHandDevice)node; switch (step) { case 0: if (hand.CheckGel() == false) { ErrorSystem.WriteActError("抓手无卡!", true); istimeout = true; isfinish = true; return; } else { if (hand.CanComm.SetRegister(hand.Hand.ZMotor.Speed.Addr, hand.Hand.ZMotor.Speed.SetValue)) { step++; } } break; case 1: resultz = device.MoveZ((int)z); if (resultz) { step++; } break; case 2: if (device.DoneZ()) { step++; } break; case 3: resultz = hand.SwitchHand(true); if (resultz) { step++; } break; case 4: resultz = device.MoveZ((int)zb); if (resultz) { step++; } break; case 5: isfinish = device.DoneZ(); break; } }