示例#1
0
        public void Pick(Gripper gripper)
        {
            if (_conveyor.ReadyForPicking)
            {
                _conveyor.ReadyForPicking = false;
            }
            else
            {
                throw new Exception("Phone is not ready.");
            }

            if (gripper == Gripper.One)
            {
                if (!_io.GetInput(Input.Gripper01Loose))
                {
                    throw new Exception("Gripper one is not opened.");
                }
            }
            else
            {
                if (!_io.GetInput(Input.Gripper02Loose))
                {
                    throw new Exception("Gripper two is not opened.");
                }
            }

            //If system is OK, gripper is free and opened, conveyor is ready
            //If the other gripper is holding a phone, then conveyor can not reload.
            MoveToTargetPosition(gripper, _motion.PickPosition);
            //Close cylinder.
            CloseGripper(gripper);
            _motion.ToPointWaitTillEnd(_motion.MotorZ, _motion.PickPosition.ApproachHeight);
            //Check.
        }
示例#2
0
        public void SetCylinder(Output output, Input input, bool sensorState = true, int timeout = 1000)
        {
            var stopwatch = new Stopwatch();

            stopwatch.Start();
            while (_io.GetInput(input) != sensorState)
            {
                if (stopwatch.ElapsedMilliseconds > timeout)
                {
                    throw new Exception("SetCylinder " + output + " timeout");
                }
                _io.SetOutput(output, true);
            }
        }