예제 #1
0
파일: Form1.cs 프로젝트: 313832370/URTest
 private void button10_Click(object sender, EventArgs e)
 {
     if (aRTClient.Status == RTClientStatus.Syncing)
     {
         aRTClient.sendScript(textBox6.Text);
     }
 }
예제 #2
0
    public void BtnLeftMove(int index)
    {
        for (int i = 0; i < 6; i++)
        {
            pd[i] = 0;
        }
        pd[index] = -10.0f / 180 * PI;
        string strPD = "[";

        for (int i = 0; i < 5; i++)
        {
            strPD += (Convert.ToString(pd[i]) + ",");
        }
        strPD += (Convert.ToString(pd[5]) + "]");
        aRTClient.sendScript("speedj(" + strPD + ",0.5,100)"); //发送脚本给机器人;
        Console.WriteLine("speedj(" + strPD + ",0.5,2)");
    }
예제 #3
0
        private void addButton_Click(object sender, RoutedEventArgs e)
        {
            if (selectedAxis == "")
            {
                MessageBox.Show("请先选择需要进行的操作!", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                switch (selectedAxis)
                {
                case "A1":
                    //MainWindow.myRobotData.a1Value = MainWindow.myRobotData.a1Value + 0.1;
                    String actionStr = "movej([d2r(" + (MainWindow.myRobotData.a1Value + 10) + "),"
                                       + "d2r(" + MainWindow.myRobotData.a2Value + "),"
                                       + "d2r(" + MainWindow.myRobotData.a3Value + "),"
                                       + "d2r(" + MainWindow.myRobotData.a4Value + "),"
                                       + "d2r(" + MainWindow.myRobotData.a5Value + "),"
                                       + "d2r(" + MainWindow.myRobotData.a6Value + ")"
                                       + "], a = 0.1, v = 0.1)";
                    aRTClient.sendScript(actionStr);
                    break;

                case "A2":
                    //MainWindow.myRobotData.a2Value = MainWindow.myRobotData.a2Value + 0.1;
                    actionStr = "movej([d2r(" + MainWindow.myRobotData.a1Value + "),"
                                + "d2r(" + (MainWindow.myRobotData.a2Value + 10) + "),"
                                + "d2r(" + MainWindow.myRobotData.a3Value + "),"
                                + "d2r(" + MainWindow.myRobotData.a4Value + "),"
                                + "d2r(" + MainWindow.myRobotData.a5Value + "),"
                                + "d2r(" + MainWindow.myRobotData.a6Value + ")"
                                + "], a = 0.1, v = 0.1)";
                    aRTClient.sendScript(actionStr);
                    break;

                case "A3":
                    //MainWindow.myRobotData.a3Value = MainWindow.myRobotData.a3Value + 0.1;
                    actionStr = "movej([d2r(" + MainWindow.myRobotData.a1Value + "),"
                                + "d2r(" + MainWindow.myRobotData.a2Value + "),"
                                + "d2r(" + (MainWindow.myRobotData.a3Value + 10) + "),"
                                + "d2r(" + MainWindow.myRobotData.a4Value + "),"
                                + "d2r(" + MainWindow.myRobotData.a5Value + "),"
                                + "d2r(" + MainWindow.myRobotData.a6Value + ")"
                                + "], a = 0.1, v = 0.1)";
                    aRTClient.sendScript(actionStr);
                    break;

                case "A4":
                    //MainWindow.myRobotData.a4Value = MainWindow.myRobotData.a4Value + 0.1;
                    actionStr = "movej([d2r(" + MainWindow.myRobotData.a1Value + "),"
                                + "d2r(" + MainWindow.myRobotData.a2Value + "),"
                                + "d2r(" + MainWindow.myRobotData.a3Value + "),"
                                + "d2r(" + (MainWindow.myRobotData.a4Value + 10) + "),"
                                + "d2r(" + MainWindow.myRobotData.a5Value + "),"
                                + "d2r(" + MainWindow.myRobotData.a6Value + ")"
                                + "], a = 0.1, v = 0.1)";
                    aRTClient.sendScript(actionStr);
                    break;

                case "A5":
                    //MainWindow.myRobotData.a5Value = MainWindow.myRobotData.a5Value + 0.1;
                    actionStr = "movej([d2r(" + MainWindow.myRobotData.a1Value + "),"
                                + "d2r(" + MainWindow.myRobotData.a2Value + "),"
                                + "d2r(" + MainWindow.myRobotData.a3Value + "),"
                                + "d2r(" + MainWindow.myRobotData.a4Value + "),"
                                + "d2r(" + (MainWindow.myRobotData.a5Value + 10) + "),"
                                + "d2r(" + MainWindow.myRobotData.a6Value + ")"
                                + "], a = 0.1, v = 0.1)";
                    aRTClient.sendScript(actionStr);
                    break;

                case "A6":
                    //MainWindow.myRobotData.a6Value = MainWindow.myRobotData.a6Value + 0.1;
                    actionStr = "movej([d2r(" + MainWindow.myRobotData.a1Value + "),"
                                + "d2r(" + MainWindow.myRobotData.a2Value + "),"
                                + "d2r(" + MainWindow.myRobotData.a3Value + "),"
                                + "d2r(" + MainWindow.myRobotData.a4Value + "),"
                                + "d2r(" + MainWindow.myRobotData.a5Value + "),"
                                + "d2r(" + (MainWindow.myRobotData.a6Value + 10) + ")"
                                + "], a = 0.1, v = 0.1)";
                    aRTClient.sendScript(actionStr);
                    break;

                case "F":
                    if (MainWindow.myRobotData.fixtureProgress < 100)
                    {
                        MainWindow.myRobotData.fixtureProgress = MainWindow.myRobotData.fixtureProgress + 1;
                    }
                    else
                    {
                        MessageBox.Show("已经张开至最大值", "警告", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                    break;

                case "P":
                    if (MainWindow.myRobotData.pawProgress < 100)
                    {
                        MainWindow.myRobotData.pawProgress = MainWindow.myRobotData.pawProgress + 1;
                    }
                    else
                    {
                        MessageBox.Show("已经张开至最大值", "警告", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                    break;
                }
            }
        }