Exemple #1
0
        public void OpenGripper(RackGripper gripper, int timeout = 1000)
        {
            EcatIo.SetOutput(gripper == RackGripper.One ? Output.GripperOne : Output.GripperTwo, true);
            Stopwatch sw = new Stopwatch();

            sw.Start();
            Input sensor    = gripper == RackGripper.One ? Input.Gripper01Loose : Input.Gripper02Loose;
            int   failCount = 0;

            while (!EcatIo.GetInput(sensor))
            {
                if (sw.ElapsedMilliseconds > timeout)
                {
                    throw new Exception("Open gripper timeout");
                }
                Thread.Sleep(10);
                if (failCount > 20)
                {
                    EcatIo.SetOutput(gripper == RackGripper.One ? Output.GripperOne : Output.GripperTwo, true);
                    failCount = 0;
                }
            }
        }
Exemple #2
0
        public void CloseGripper(RackGripper gripper, int timeout = 1000)
        {
            EcatIo.SetOutput(gripper == RackGripper.One ? Output.GripperOne : Output.GripperTwo, false);
            Stopwatch sw = new Stopwatch();

            sw.Start();
            Input sensor    = gripper == RackGripper.One ? Input.Gripper01Tight : Input.Gripper02Tight;
            int   failCount = 0;

            while (!EcatIo.GetInput(sensor))
            {
                if (sw.ElapsedMilliseconds > timeout)
                {
                    throw new Exception("Close gripper " + gripper + " timeout");
                }
                Thread.Sleep(10);
                failCount++;
                if (failCount > 20)
                {
                    EcatIo.SetOutput(gripper == RackGripper.One ? Output.GripperOne : Output.GripperTwo, false);
                    failCount = 0;
                }
            }
        }
Exemple #3
0
        public void ReadyThePhone(int timeout = 3000)
        {
            //RobotTakeControlOnConveyor();

            Conveyor.Clamp(false);
            Conveyor.UpBlockSeparate(false);
            Conveyor.UpBlockPick(false);
            Conveyor.SideBlockSeparate(false);
            Conveyor.ConveyorMovingForward = !Conveyor.ConveyorMovingForward;
            Conveyor.UpBlockSeparate(false);
            Conveyor.UpBlockPick(false);
            Conveyor.SideBlockSeparate(false);
            Conveyor.ConveyorMovingForward = !Conveyor.ConveyorMovingForward;
            EcatIo.SetOutput(Output.ClampPick, true);
            Stopwatch sw = new Stopwatch();

            sw.Start();
            while (!EcatIo.GetInput(Input.ClampTightPick))
            {
                if (sw.ElapsedMilliseconds > timeout)
                {
                    throw new Exception("ReadyThePhone timeout");
                }
                Thread.Sleep(10);
            }

            EcatIo.SetOutput(Output.SideBlockPick, true);
            sw.Restart();
            while (EcatIo.GetInput(Input.SideBlockPick))
            {
                if (sw.ElapsedMilliseconds > timeout)
                {
                    throw new Exception("ReadyThePhone timeout");
                }
                Thread.Sleep(10);
            }

            Thread.Sleep(500);

            EcatIo.SetOutput(Output.SideBlockPick, false);
            sw.Restart();
            while (!EcatIo.GetInput(Input.SideBlockPick))
            {
                if (sw.ElapsedMilliseconds > timeout)
                {
                    throw new Exception("ReadyThePhone timeout");
                }
                Thread.Sleep(10);
            }

            EcatIo.SetOutput(Output.ClampPick, false);
            sw = new Stopwatch();
            sw.Restart();
            while (!EcatIo.GetInput(Input.ClampLoosePick))
            {
                if (sw.ElapsedMilliseconds > timeout)
                {
                    throw new Exception("ReadyThePhone timeout");
                }
                Thread.Sleep(10);
            }
        }