Example #1
0
        public override void run(double dt)
        {
            bool resulty = true;

            sumdt += dt;
            if (sumdt >= time || istimeout)
            {
                istimeout = true;
                isfinish  = true;
                return;
            }
            var device = new ActionDevice(node);

            switch (step)
            {
            case 0:
                resulty = device.MoveInjectY(y);
                if (resulty)
                {
                    step++;
                }
                break;

            case 1:
                for (int i = 0; i < 4; i++)
                {
                    if (ydone[i] == false)
                    {
                        ydone[i] = device.DoneInjectY(i);
                    }
                }
                isfinish = ydone[0] && ydone[1] && ydone[2] && ydone[3];
                break;
            }
        }
Example #2
0
        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
                {
                    step++;
                }
                break;

            case 1:
                act_movez.run(dt);
                if (act_movez.getIsFinish())
                {
                    step++;
                }
                break;

            case 2:
                resultz = hand.SwitchHand(true);
                if (resultz)
                {
                    step++;
                }
                break;

            case 3:
                act_movezb.run(dt);
                if (act_movezb.getIsFinish())
                {
                    step++;
                }
                break;

            case 4:
                isfinish = true;
                break;
            }
        }
Example #3
0
        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)
                {
                    resultx = device.InitX();
                }
                if (y)
                {
                    resulty = device.InitY();
                }
                if (z)
                {
                    resultz = device.InitZ();
                }
                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;
            }
        }
Example #4
0
        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;
            }
        }
Example #5
0
        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;
            }
        }
Example #6
0
        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;
            }
        }
Example #7
0
        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
                {
                    step++;
                }
                break;

            case 1:
                resultz = hand.Hand.IsOpen || (hand.Hand.IsOpen == false && hand.SwitchHand(true));
                if (resultz)
                {
                    step++;
                }
                break;

            case 2:
                act_movez.run(dt);
                if (act_movez.getIsFinish())
                {
                    step++;
                }
                break;

            case 3:
                act_movezl.run(dt);
                if (sumdt - lasttime > 50)
                {
                    lasttime = sumdt;
                    if (hand.CheckGel() == true)
                    {
                        resultz = hand.CanComm.SetCoilOff(hand.Hand.ZMotor.StartCoil.Addr);
                        if (resultz)
                        {
                            step++;
                        }
                    }
                }
                if (act_movezl.getIsFinish())
                {
                    ErrorSystem.WriteActError("抓手抓不到卡!", true);
                    istimeout = true;
                    isfinish  = true;
                    return;
                }
                break;

            case 4:
                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
                {
                    act_movecurz = MoveTo.create(node, time, -1, -1, curz);
                    act_movecurz.init();
                    step++;
                }
                break;

            case 5:
                act_movecurz.run(dt);
                if (act_movecurz.getIsFinish())
                {
                    step++;
                }
                break;

            case 6:
                resultz = hand.SwitchHand(false);
                if (resultz)
                {
                    step++;
                }
                break;

            case 7:
                act_movezb.run(dt);
                if (act_movezb.getIsFinish())
                {
                    step++;
                }
                break;

            case 8:
                isfinish = true;
                break;
            }
        }
Example #8
0
        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 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:
                act_movexy.run(dt);
                if (act_movexy.getIsFinish())
                {
                    step++;
                }
                break;

            case 2:
                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 3:
                for (int i = head_index; i < tipdata.count; i++)
                {
                    if (zdone[i] == false)
                    {
                        zdone[i] = device.DoneInjectZ(i);
                    }
                }
                if (zdone[0] && zdone[1] && zdone[2] && zdone[3])
                {
                    step++;
                }
                break;

            case 4:
                act_movezb.run(dt);
                if (act_movezb.getIsFinish())
                {
                    step++;
                }
                break;

            case 5:
                isfinish = true;
                break;
            }
        }