Example #1
0
        //public void UnloadAndLoad(TargetPosition target, RackGripper gripper)
        //{
        //    CheckGripperAvailable(gripper);
        //    MoveToTargetPosition(gripper, target);
        //    CloseGripper(gripper);
        //    MoveToPointTillEnd(Motion.MotorZ, target.ApproachHeight); //Up.
        //    ChangeGripper(target, ref gripper); //Switch gripper.
        //    MoveToPointTillEnd(Motion.MotorZ, target.ZPos); //Down.
        //    OpenGripper(gripper);
        //    MoveToPointTillEnd(Motion.MotorZ, target.ApproachHeight); //Up.
        //    YRetractFromBox();
        //}

        public void UnloadAndLoad(ShieldBox box, RackGripper gripper, bool closeBox)
        {
            OnInfoOccured(20025, "Try unload and load box: " + box.Id + " with " + gripper + ".");
            CheckGripperAvailable(gripper);
            if (box.IsClosed() == true)
            {
                throw new Exception("Box " + box.Id + " is not opened.");
            }
            MoveToTargetPosition(gripper, box.Position, false);
            CloseGripper(gripper);

            Motion.ToPoint(Motion.MotorZ, box.Position.ZPos + 50);
            Motion.WaitTillZBiggerThan(box.Position.ZPos + 30);
            ChangeGripper(box.Position, ref gripper); //Switch gripper.
            Motion.WaitTillEnd(Motion.MotorZ);

            CheckPhoneLost(gripper);

            //Slip in phone.
            Task.Run(() => {
                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();
                while (stopwatch.ElapsedMilliseconds < 5000)
                {
                    if (Motion.GetPosition(Motion.MotorZ) < box.Position.ZPos + SlipInHeight)
                    {
                        try
                        {
                            OpenGripper(gripper);
                        }
                        catch (Exception)
                        {
                            break;
                        }
                    }
                    Delay(5);
                }
            });

            MoveToPointTillEnd(Motion.MotorZ, box.Position.ZPos); //Down.
            OpenGripper(gripper);

            MoveToPointTillEnd(Motion.MotorZ, box.Position.ApproachHeight); //Up.

            if (closeBox)
            {
                CloseBoxAsync(box);
            }

            YRetractFromBox();
            OnInfoOccured(20025, "Finish unload and load box: " + box.Id + " with " + gripper + ".");
        }
Example #2
0
        public void Unload(RackGripper gripper, TargetPosition target)
        {
            ShieldBox box = ConverterTeachPosToShieldBox(target.TeachPos);

            if (box != null)
            {
                if (box.IsClosed())
                {
                    throw new Exception("Cant unload, box is not opened.");
                }
            }

            CheckGripperAvailable(gripper);
            MoveToTargetPosition(gripper, target, false);
            CloseGripper(gripper);
            MoveToPointTillEnd(Motion.MotorZ, target.ApproachHeight);
            YRetractFromBox();
        }
Example #3
0
        public void Load(RackGripper gripper, ShieldBox box, bool closeBox)
        {
            OnInfoOccured(20023, "Try loading phone to box:" + box.Id + " with " + gripper + ".");
            TargetPosition target = ConvertShieldBoxToTargetPosition(box);

            if (box.IsClosed() == true)
            {
                throw new Exception("Box " + box.Id + " is not opened");
            }

            MoveToTargetPosition(gripper, target, true);
            OpenGripper(gripper);
            MoveToPointTillEnd(Motion.MotorZ, target.ApproachHeight);
            if (closeBox)
            {
                CloseBoxAsync(box);
            }
            YRetractFromBox();

            OnInfoOccured(20023, "Finish loading phone to box:" + box.Id + ".");
        }
Example #4
0
        /// <summary>
        /// From current target position.
        /// </summary>
        /// <param name="gripper"></param>
        /// <param name="phone"></param>
        public void Unload(RackGripper gripper, Phone phone)
        {
            OnInfoOccured(20018, "Try unloading phone:" + phone.Id + " with " + gripper + ".");

            ShieldBox box = ConverterTeachPosToShieldBox(phone.CurrentTargetPosition.TeachPos);

            if (box != null)
            {
                if (box.IsClosed())
                {
                    throw new Exception("Cant unload, box is not opened.");
                }
            }
            TargetPosition pos = phone.CurrentTargetPosition;

            MoveToTargetPosition(gripper, pos, false);
            CloseGripper(gripper);
            MoveToPointTillEnd(Motion.MotorZ, pos.ApproachHeight);
            YRetractFromBox();
            CheckPhoneLost(gripper);
            OnInfoOccured(20018, "Finish unloading phone:" + phone.Id);
        }