Example #1
0
        private void EIOTest()
        {
            UInt64 cmdIndex = 0;

            //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);
        }
Example #2
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);
        }