예제 #1
0
        /// <summary>
        /// StartDobot
        /// </summary>
        private void StartDobot()
        {
            int ret = DobotDll.ConnectDobot("", 115200);

            // start connect
            if (ret != (int)DobotConnect.DobotConnect_NoError)
            {
                Console.WriteLine("Connect error", MsgInfoType.Error);
                return;
            }
            Console.WriteLine("Connect success", MsgInfoType.Info);

            isConnectted = true;
            DobotDll.SetCmdTimeout(3000);

            // Must set when sensor is not exist
            DobotDll.ResetPose(true, 45, 45);


            UInt64         cmdIndex = 0;
            JOGJointParams jsParam;

            jsParam.velocity     = new float[] { 200, 200, 200, 200 };
            jsParam.acceleration = new float[] { 200, 200, 200, 200 };
            DobotDll.SetJOGJointParams(ref jsParam, false, ref cmdIndex);

            JOGCommonParams jdParam;

            jdParam.velocityRatio     = 100;
            jdParam.accelerationRatio = 100;
            DobotDll.SetJOGCommonParams(ref jdParam, false, ref cmdIndex);

            PTPJointParams pbsParam;

            pbsParam.velocity     = new float[] { 200, 200, 200, 200 };
            pbsParam.acceleration = new float[] { 200, 200, 200, 200 };
            DobotDll.SetPTPJointParams(ref pbsParam, false, ref cmdIndex);

            PTPCoordinateParams cpbsParam;

            cpbsParam.xyzVelocity     = 100;
            cpbsParam.xyzAcceleration = 100;
            cpbsParam.rVelocity       = 100;
            cpbsParam.rAcceleration   = 100;
            DobotDll.SetPTPCoordinateParams(ref cpbsParam, false, ref cmdIndex);

            PTPJumpParams pjp;

            pjp.jumpHeight = 20;
            pjp.zLimit     = 100;
            DobotDll.SetPTPJumpParams(ref pjp, false, ref cmdIndex);

            PTPCommonParams pbdParam;

            pbdParam.velocityRatio     = 30;
            pbdParam.accelerationRatio = 30;
            DobotDll.SetPTPCommonParams(ref pbdParam, false, ref cmdIndex);
        }
예제 #2
0
        /// <summary>
        /// 初期パラメータ設定
        /// </summary>
        private void SetParam()
        {
            UInt64         cmdIndex = 0;
            JOGJointParams jsParam;

            jsParam.velocity     = new float[] { 200, 200, 200, 200 };
            jsParam.acceleration = new float[] { 200, 200, 200, 200 };
            DobotDll.SetJOGJointParams(ref jsParam, false, ref cmdIndex);

            JOGCommonParams jdParam;

            jdParam.velocityRatio     = 100;
            jdParam.accelerationRatio = 100;
            DobotDll.SetJOGCommonParams(ref jdParam, false, ref cmdIndex);

            PTPJointParams pbsParam;

            pbsParam.velocity     = new float[] { 200, 200, 200, 200 };
            pbsParam.acceleration = new float[] { 200, 200, 200, 200 };
            DobotDll.SetPTPJointParams(ref pbsParam, false, ref cmdIndex);

            PTPCoordinateParams cpbsParam;

            cpbsParam.xyzVelocity     = 100;
            cpbsParam.xyzAcceleration = 100;
            cpbsParam.rVelocity       = 100;
            cpbsParam.rAcceleration   = 100;
            DobotDll.SetPTPCoordinateParams(ref cpbsParam, false, ref cmdIndex);

            PTPJumpParams pjp;

            pjp.jumpHeight = 20;
            pjp.zLimit     = 100;
            DobotDll.SetPTPJumpParams(ref pjp, false, ref cmdIndex);

            PTPCommonParams pbdParam;

            pbdParam.velocityRatio     = 30;
            pbdParam.accelerationRatio = 30;
            DobotDll.SetPTPCommonParams(ref pbdParam, false, ref cmdIndex);
        }
예제 #3
0
        /// <summary>
        /// StartDobot
        /// </summary>
        private void StartDobot()
        {
            int ret = DobotDll.ConnectDobot("", 115200);

            // start connect
            if (ret != (int)DobotConnect.DobotConnect_NoError)
            {
                Msg("Connect error", MsgInfoType.Error);
                return;
            }
            Msg("Connect success", MsgInfoType.Info);

            isConnectted = true;
            DobotDll.SetCmdTimeout(3000);

            // Must set when sensor is not exist
            DobotDll.ResetPose(true, 45, 45);

            // Get name
            string deviceName = "Dobot Magician";

            DobotDll.SetDeviceName(deviceName);

            StringBuilder deviceSN = new StringBuilder(64);

            DobotDll.GetDeviceName(deviceSN, 64);

            UInt64         cmdIndex = 0;
            JOGJointParams jsParam;

            jsParam.velocity     = new float[] { 200, 200, 200, 200 };
            jsParam.acceleration = new float[] { 200, 200, 200, 200 };
            DobotDll.SetJOGJointParams(ref jsParam, false, ref cmdIndex);

            JOGCommonParams jdParam;

            jdParam.velocityRatio     = 100;
            jdParam.accelerationRatio = 100;
            DobotDll.SetJOGCommonParams(ref jdParam, false, ref cmdIndex);

            PTPJointParams pbsParam;

            pbsParam.velocity     = new float[] { 200, 200, 200, 200 };
            pbsParam.acceleration = new float[] { 200, 200, 200, 200 };
            DobotDll.SetPTPJointParams(ref pbsParam, false, ref cmdIndex);

            PTPCoordinateParams cpbsParam;

            cpbsParam.xyzVelocity     = 100;
            cpbsParam.xyzAcceleration = 100;
            cpbsParam.rVelocity       = 100;
            cpbsParam.rAcceleration   = 100;
            DobotDll.SetPTPCoordinateParams(ref cpbsParam, false, ref cmdIndex);

            PTPJumpParams pjp;

            pjp.jumpHeight = 20;
            pjp.zLimit     = 100;
            DobotDll.SetPTPJumpParams(ref pjp, false, ref cmdIndex);

            PTPCommonParams pbdParam;

            pbdParam.velocityRatio     = 30;
            pbdParam.accelerationRatio = 30;
            DobotDll.SetPTPCommonParams(ref pbdParam, false, ref cmdIndex);

            //EIO
            IOMultiplexing iom;

            iom.address   = 2;                             //io index
            iom.multiplex = (byte)IOFunction.IOFunctionDO; // ioType
            DobotDll.SetIOMultiplexing(ref iom, false, ref cmdIndex);

            IODO iod;

            iod.address = 2;
            iod.level   = 1; // set io index 2 to open
            DobotDll.SetIODO(ref iod, false, ref cmdIndex);

            // arc
            //ptp((byte)1, 67.99f, 216.4f, -27.99f, 0);
            //arc(154.92f, 182.41f, -62.89f, 0f, 216.07f, 85.54f, -8.34f, 0f);
        }
예제 #4
0
        private void dobotStuff()
        {
            PTPJointParams ptpParams;

            ptpParams.acceleration = new float[4] {
                200, 200, 200, 200
            };
            ptpParams.velocity = new float[4] {
                200, 200, 200, 200
            };

            PTPCoordinateParams ptpCParams;

            ptpCParams.rAcceleration   = 200;
            ptpCParams.rVelocity       = 200;
            ptpCParams.xyzAcceleration = 200;
            ptpCParams.xyzVelocity     = 200;

            PTPJumpParams ptpJParams;

            ptpJParams.jumpHeight = 10;
            ptpJParams.zLimit     = 200;

            PTPCommonParams ptpCmParams;

            ptpCmParams.accelerationRatio = 100;
            ptpCmParams.velocityRatio     = 100;

            WAITCmd wait;

            wait.timeout = 2000;
            UInt64 cmdIndex = 0;

            HOMECmd hmcmd = new HOMECmd();

            DobotDll.SetHOMECmd(ref hmcmd, false, ref cmdIndex);
            System.Threading.Thread.Sleep(20000);
            Pose pose = new Pose();

            DobotDll.GetPose(ref pose);
            Console.WriteLine(pose.x + ", " + pose.y + ", " + pose.z);
            DobotDll.SetPTPJointParams(ref ptpParams, false, ref cmdIndex);
            DobotDll.SetPTPCoordinateParams(ref ptpCParams, false, ref cmdIndex);
            DobotDll.SetPTPJumpParams(ref ptpJParams, false, ref cmdIndex);
            DobotDll.SetPTPCommonParams(ref ptpCmParams, false, ref cmdIndex);

            pickNewCard(cmdIndex, wait);

            placeCard(290, playerCards * cardDistance, cmdIndex);
            playerCards++;

            pickNewCard(cmdIndex, wait);

            placeCard(200, dealerCards * cardDistance, cmdIndex);
            dealerCards++;

            pickNewCard(cmdIndex, wait);

            placeCard(290, playerCards * cardDistance, cmdIndex);
            playerCards++;
        }