Exemplo n.º 1
0
 private void pickNewCard(UInt64 cmdIndex, WAITCmd wait)
 {
     moveDobot(220, 140, 50, cmdIndex);
     moveDobot(220, 140, -55, cmdIndex);
     DobotDll.SetEndEffectorSuctionCup(true, true, true, ref cmdIndex);
     moveDobot(220, 140, 50, cmdIndex);
     DobotDll.SetWAITCmd(ref wait, true, ref cmdIndex);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Point To Point Move
        /// </summary>
        /// <param name="style"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="z"></param>
        /// <param name="r"></param>
        /// <returns></returns>
        private UInt64 ptp(byte style, float x, float y, float z, float r)
        {
            PTPCmd pdbCmd;
            UInt64 cmdIndex = 0;

            pdbCmd.ptpMode = style;
            pdbCmd.x       = x;
            pdbCmd.y       = y;
            pdbCmd.z       = z;
            pdbCmd.rHead   = r;
            while (true)
            {
                int ret = DobotDll.SetPTPCmd(ref pdbCmd, true, ref cmdIndex);
                if (ret == 0)
                {
                    break;
                }
            }

            while (true)
            {
                UInt64 retIndex = 0;
                int    ind      = DobotDll.GetQueuedCmdCurrentIndex(ref retIndex);
                if (ind == 0 && cmdIndex <= retIndex)
                {
                    break;
                }
            }

            float   waitTime = 500;
            WAITCmd waitcmd;

            waitcmd.timeout = (uint)waitTime;
            DobotDll.SetWAITCmd(ref waitcmd, false, ref cmdIndex);

            return(cmdIndex);
        }
Exemplo n.º 3
0
        // event handle
        private void ProcessEvt(object sender, EventArgs e)
        {
            if (!isConnectted)
            {
                return;
            }

            Button obj      = (Button)sender;
            String con      = obj.Content.ToString();
            UInt64 cmdIndex = 0;

            float x, y, z, r, gripper, pTime;

            if (!float.TryParse(X.Text, out x) || !float.TryParse(Y.Text, out y) || !float.TryParse(Z.Text, out z) || !float.TryParse(rHead.Text, out r) ||
                !float.TryParse(isGripper.Text, out gripper) || !float.TryParse(pauseTime.Text, out pTime))
            {
                Msg("Please input float formate", MsgInfoType.Error);
                return;
            }
            Msg("", MsgInfoType.Info);

            switch (con)
            {
            case "SendPlaybackCmd":
            {
                obj.IsEnabled = false;
                cmdIndex      = ptp((byte)modeStyle.SelectedIndex, x, y, z, r);
                while (true)
                {
                    UInt64 retIndex = 0;
                    int    ind      = DobotDll.GetQueuedCmdCurrentIndex(ref retIndex);
                    if (ind == 0 && cmdIndex <= retIndex)
                    {
                        obj.IsEnabled = true;
                        break;
                    }
                }

                float waitTime = 0;
                if (float.TryParse(pauseTime.Text, out waitTime) && waitTime > 0)
                {
                    WAITCmd waitcmd;
                    waitcmd.timeout = (uint)waitTime;
                    DobotDll.SetWAITCmd(ref waitcmd, false, ref cmdIndex);
                }
            } break;

            case "SendCPCmd":
            {
                cmdIndex = cp((byte)ContinuousPathMode.CPAbsoluteMode, x, y, z, 100);
                while (true)
                {
                    UInt64 retIndex = 0;
                    int    ind      = DobotDll.GetQueuedCmdCurrentIndex(ref retIndex);
                    if (ind == 0 && cmdIndex <= retIndex)
                    {
                        obj.IsEnabled = true;
                        break;
                    }
                }
            } break;

            default:
                break;
            }
        }