コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <see cref="Conveyor.Monitor"/>
        private void ConveyorManager()
        {
            while (true)
            {
                _conveyorWorkingManualResetEvent.WaitOne();

                try
                {
                    ConveyorIsBusy = true;
                    if (LatestPhone == null && Conveyor.PickBufferHasPhone)
                    {
                        if (OkToLetInNewPhone())
                        {
                            //if (ScannerOnline)
                            //{
                            //    if (Scanner.ScanSuccessful == false)
                            //    {
                            //        throw new Exception("Scan fail, please remove phone manually.");
                            //    }
                            //}
                            Conveyor.InposForPicking();

                            //Conveyor is still stop, so no new SN would enter, wrong SN would not happen.
                            AddNewPhone();
                        }
                    }

                    if (LatestPhone == null || Conveyor.PickBufferHasPhone == false || Conveyor.HasPlaceAPhone)
                    {
                        Conveyor.RunBeltPick();
                    }

                    if (LatestPhone != null && Conveyor.PickBufferHasPhone && Conveyor.HasPlaceAPhone == false)
                    {
                        Conveyor.StopBeltPick();
                        Delay(100);
                        Conveyor.ReadyForPicking();

                        _conveyorPickReadyManualResetEvent.Set();
                        _conveyorPickReadyManualResetEvent.WaitOne();
                    }
                }
                catch (Exception e)
                {
                    OnErrorOccured(40007, "Conveyor error:" + e.Message);
                    _conveyorWorkingManualResetEvent.Reset();
                }
                finally
                {
                    ConveyorIsBusy = false;
                }

                Delay(100);
            }
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// If a new phone went into pick position, it has to be picked before
        ///    place a pass phone, in <see cref="ArrangePhones"/> , it serve new
        ///    phone before wifi phone(second priority), and new phone will only come in
        ///    when there is empty enough Rf box.
        /// <param name="gripper"></param>
        public void Place(RackGripper gripper, Phone phone = null)
        {
            OnInfoOccured(20026, "Try placing with " + gripper + ".");
            if (Conveyor.HasPlaceAPhone == true)
            {
                throw new Exception("Last place movement has't finished.");
            }

            if (phone != null)
            {
                string footprint = string.Empty;
                foreach (var foot in phone.TargetPositionFootprint)
                {
                    footprint += (int)foot.TeachPos + ",";
                }
                OnProductionComplete(true, phone.SerialNumber, footprint, "");
            }

            RobotTakeControlOnConveyor();

            Conveyor.StopBeltPick();

            RackGripper theOtherGripper = RackGripper.None;

            if (Conveyor.PickPhoneSensor())
            {
                if (LatestPhone != null)
                {
                    theOtherGripper = gripper == RackGripper.One ? RackGripper.Two : RackGripper.One;
                    Pick(theOtherGripper, false);
                }
                else
                {
                    throw new Exception("When place, has an unknown phone.");
                }
            }

            if (Conveyor.PickPhoneSensor())
            {
                throw new Exception("When place, has an unknown phone in pick position.");
            }

            if (EcatIo.GetInput(Input.UpBlockPickForward) ||
                EcatIo.GetInput(Input.UpBlockPickBackward) || EcatIo.GetInput(Input.ClampTightPick))
            {
                throw new Exception("When place, cylinder on conveyor is up.");
            }

            CheckPhoneLost(gripper);

            TargetPosition placePosition = Motion.PickPosition;

            if (gripper == RackGripper.Two)
            {
                placePosition.XPos = placePosition.XPos + 1 + Motion.PickOffset.XPos;
            }
            else
            {
                placePosition.XPos = placePosition.XPos + 1;
            }

            placePosition.ZPos = placePosition.ZPos + 4;

            if (theOtherGripper != RackGripper.None)
            {
                Motion.ToPointX(placePosition.XPos);
                ToPointR(placePosition, gripper);
                //ToPointGripper(placePosition, gripper);
                ToPointGripperOnConveyorTillEnd(placePosition, gripper);
                //WaitTillEndGripper(placePosition, gripper);
                Motion.WaitTillEndX();
                Motion.WaitTillEnd(Motion.MotorR);
                MotorYOutThenBreakMotorZDown(placePosition, gripper, false);
            }
            else
            {
                MoveToTargetPosition(gripper, placePosition, true, false);
            }

            OpenGripper(gripper);

            if (theOtherGripper != RackGripper.None)
            {
                Steppers.ToPoint(theOtherGripper, Motion.PickPosition.APos);
            }

            MoveToPointTillEnd(Motion.MotorZ, Motion.PickPosition.ApproachHeight);
            MoveToPointTillEnd(Motion.MotorY, Motion.HomePosition.YPos);
            Conveyor.HasPlaceAPhone = true;

            if (theOtherGripper != RackGripper.None)
            {
                //Steppers.ToPoint(theOtherGripper, Motion.PickPosition.APos);
                Steppers.WaitTillEnd(theOtherGripper, Motion.PickPosition.APos);
            }

            RobotReleaseControlOnConveyor();
            OnInfoOccured(20026, "Finish placing with " + gripper + ".");
        }