/// <summary>
        /// StartDobot
        /// </summary>
        private void StartDobot()
        {
            int ret;

            // start connect
            if ((ret = DobotDll.ConnectDobot()) >= (int)DobotResult.DobotResult_Error_Min)
            {
                Msg("Connect error ,code:" + ret.ToString(), MsgInfoType.Error);
                return;
            }

            isConnectted = true;
            // reset and start
            //DobotDll.ResetDobot();
            DobotDll.SetCmdTimeout(500);
            DobotDll.SetEndType(EndType.EndTypePump);

            // Must set when sensor is not exist
            InitialPose initialPose;

            initialPose.joint2Angle = 45;
            initialPose.joint3Angle = 45;
            DobotDll.SetInitialPose(ref initialPose);


            JogStaticParams jsParam;

            jsParam.jointMaxVelocity      = 15;
            jsParam.jointMaxAcceleration  = 50;
            jsParam.servoMaxVelocity      = 30;
            jsParam.servoMaxAcceleration  = 10;
            jsParam.linearMaxVelocity     = 40;
            jsParam.linearMaxAcceleration = 40;
            DobotDll.SetJogStaticParams(ref jsParam);

            JogDynamicParams jdParam;

            jdParam.velocityRatio = 30;
            DobotDll.SetJogDynamicParams(ref jdParam);

            PlaybackStaticParams pbsParam;

            pbsParam.jointMaxVelocity      = 200;
            pbsParam.jointMaxAcceleration  = 200;
            pbsParam.servoMaxVelocity      = 200;
            pbsParam.servoMaxAcceleration  = 200;
            pbsParam.linearMaxVelocity     = 800;
            pbsParam.linearMaxAcceleration = 1000;
            pbsParam.pauseTime             = 100;
            pbsParam.jumpHeight            = 20;
            DobotDll.SetPlaybackStaticParams(ref pbsParam);

            PlaybackDynamicParams pbdParam;

            pbdParam.velocityRatio     = 30;
            pbdParam.accelerationRatio = 30;
            DobotDll.SetPlaybackDynamicParams(ref pbdParam);
        }
        private void blurSlider_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (!isConnectted)
            {
                return;
            }

            Slider obj = (Slider)sender;

            if (obj.Name == "sld")
            {
                JogDynamicParams jdParam;
                jdParam.velocityRatio = (float)sld.Value;
                DobotDll.SetJogDynamicParams(ref jdParam);
            }
            else if (obj.Name == "sld1" || obj.Name == "sldAcc") // playback
            {
                PlaybackDynamicParams pbdParam;
                pbdParam.velocityRatio     = (float)obj.Value;
                pbdParam.accelerationRatio = (float)obj.Value;
                DobotDll.SetPlaybackDynamicParams(ref pbdParam);
            }
        }
Пример #3
0
        private void StartDobot()
        {
            //ret ist eine normale Zahl, die einen Fehlercode repräsentiert
            int ret;

            //Überprüft ob eine Verbindung zum Roboter gefunden wurde.Wenn nicht, wird die Form sofort geschlossen und es erscheint eine Benachrichtigung
            if ((ret = DobotDll.ConnectDobot()) >= (int)DobotResult.DobotResult_Error_Min)
            {
                MessageBox.Show("Kein Roboter gefunden");
                this.Close();
                return;
            }

            //Ist eine Verbindung vorhanden wird die Form aufgerufen und der Status isconnectted auf true gesetzt
            else
            {
                this.Show();
                isConnectted = true;
            }



            //Time-out für die comands
            DobotDll.SetCmdTimeout(500);


            //Gibt die Stellung in Winkelpositionen zwischen "Oberarm" und "Unterarm" an, die max. angefahren werden kann
            InitialPose initialPose;

            initialPose.joint2Angle = 45;
            initialPose.joint3Angle = 45;
            DobotDll.SetInitialPose(ref initialPose);

            //Statische Paramter die Beschleunigung und Geschwidigkeit der Joints, der Servormotoren und des liniearen Abfahrens angeben, gilt für die Jogs (Anfahren über Winkelpositionen)
            JogStaticParams jsParam;

            jsParam.jointMaxVelocity      = 15;
            jsParam.jointMaxAcceleration  = 50;
            jsParam.servoMaxVelocity      = 30;
            jsParam.servoMaxAcceleration  = 10;
            jsParam.linearMaxVelocity     = 40;
            jsParam.linearMaxAcceleration = 40;
            DobotDll.SetJogStaticParams(ref jsParam);

            //Dynamischer Parameter, der die Beschleunigung angibt
            JogDynamicParams jdParam;

            jdParam.velocityRatio = 30;
            DobotDll.SetJogDynamicParams(ref jdParam);

            //Statische Paramter die Beschleunigung und Geschwidigkeit der Joints, der Servormotoren und des liniearen Abfahrens angeben, gilt für die Playbackcomands (Anfahren über Koordinaten)
            PlaybackStaticParams pbsParam;

            pbsParam.jointMaxVelocity      = 100;
            pbsParam.jointMaxAcceleration  = 100;
            pbsParam.servoMaxVelocity      = 100;
            pbsParam.servoMaxAcceleration  = 100;
            pbsParam.linearMaxVelocity     = 100;
            pbsParam.linearMaxAcceleration = 100;
            pbsParam.pauseTime             = 100;
            pbsParam.jumpHeight            = 20;
            DobotDll.SetPlaybackStaticParams(ref pbsParam);

            //Dynamischer Parameter, der die Beschleunigung und die Geschwindigkeit angibt
            PlaybackDynamicParams pbdParam;

            pbdParam.velocityRatio     = 30;
            pbdParam.accelerationRatio = 30;
            DobotDll.SetPlaybackDynamicParams(ref pbdParam);

            //Funktion zum Umrechnen der aufgenommenen Koordinaten
            Koordinaten_umrechnen();
        }