Пример #1
0
        // Move robot's joints - Invalid clearance
        public static void CTUE00400()
        {
            BinPickingTask task = CTUC00100();

            // J7(linear rail), J1, J2, J3, J5, J6, J8(servo hand)
            List <double> jointValues = new List <double>()
            {
                -10.0, 0.0, 50.0, -100.0, 0.0, 0.0, 0.0
            };
            List <int> jointIndices = new List <int>()
            {
                0, 1, 2, 3, 4, 5, 6
            };

            try
            {
                task.MoveJoints(jointValues, jointIndices, -5.0, 0.2, "");
            }
            catch (ClientException ex)
            {
                if (!ex.ToString().Contains("Task Input Error"))
                {
                    throw new Exception("Test case CTUE00400 failed");
                }
            }
        }
Пример #2
0
        // Move robot's joints
        public static void CTUE00100()
        {
            BinPickingTask task = CTUC00100();

            // J7(linear rail), J1, J2, J3, J5, J6, J8(servo hand)
            //List<double> jointValues = new List<double>() { -10.0, 0.0, 50.0, -100.0, 0.0, 0.0, 0.0 };
            List <double> jointValues = new List <double>()
            {
                -800.0, 0.0, 35.0, 45.0, 0.0, 0.0, 0.0
            };
            List <int> jointIndices = new List <int>()
            {
                0, 1, 2, 3, 4, 5, 6
            };

            task.MoveJoints(jointValues, jointIndices, 20, 0.2, "");
        }
Пример #3
0
        // Move robot's joints - Invalid Joint Values
        public static void CTUE00200()
        {
            BinPickingTask task = CTUC00100();

            // J7 (index=0) cannot go positive.
            List <double> jointValues = new List <double>()
            {
                -10.0, 0.0, 70.0, -140.0, 0.0, 0.0, 0.0
            };
            List <int> jointIndices = new List <int>()
            {
                0, 1, 2, 3, 4, 5, 6
            };

            try
            {
                task.MoveJoints(jointValues, jointIndices, 30, 0.2, "");
            }
            catch (ClientException ex)
            {
                System.Console.WriteLine(ex.ToString());
            }
        }
Пример #4
0
        static void Main(string[] args)
        {
            if (true)
            {
                ControllerClient controllerClient2 = new ControllerClient("testuser", "mytestpass", "http://controller13");

                //controllerClient.Initialize("mujin:/irex2013/irex2013.WPJ", "mujincollada", "wincaps", "mujin:/irex2013.mujin.dae");

                //SceneResource scene2 = controllerClient2.GetScene("test.mujin.dae");

                // JSON creation
                //Dictionary<string, object> jsonMessage = controllerClient2.GetJsonMessage(HttpMethod.POST, "scene/?format=json", "{\"name\":\"newname\", \"reference_uri\":\"mujin:/plasticnut-center.mujin.dae\"}");

                // XML creation
                Dictionary <string, object> xmlMessage = controllerClient2.GetXMLMessage(HttpMethod.POST, "scene/?format=xml", "<request><name>newname3</name><reference_uri>mujin:/plasticnut-center.mujin.dae</reference_uri></request>");
            }

            // Default XML path:
            // string xmlFilepath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "..\\..\\samples\\getsceneinfo\\config\\connection.xml";

            // Custom XML path;
            string xmlFilepath = "C:\\connection2.xml";

            XmlDocument  document = new XmlDocument();
            StreamReader reader   = new StreamReader(xmlFilepath, Encoding.UTF8);

            document.Load(reader);

            string mujinIpAddress  = document.GetElementsByTagName("ipaddress")[0].InnerText;
            string scenePrimaryKey = document.GetElementsByTagName("scenepk")[0].InnerText;
            string username        = document.GetElementsByTagName("username")[0].InnerText;
            string password        = document.GetElementsByTagName("password")[0].InnerText;
            string taskName        = document.GetElementsByTagName("taskname")[0].InnerText;
            string taskType        = document.GetElementsByTagName("tasktype")[0].InnerText;
            string controllerip    = document.GetElementsByTagName("controllerip")[0].InnerText;
            int    controllerport  = int.Parse(document.GetElementsByTagName("controllerport")[0].InnerText);

            ControllerClient controllerClient = new ControllerClient(username, password, mujinIpAddress);

            //controllerClient.Initialize("mujin:/irex2013/irex2013.WPJ", "mujincollada", "wincaps", "mujin:/irex2013.mujin.dae");

            SceneResource  scene = controllerClient.GetScene(scenePrimaryKey);
            BinPickingTask task  = (BinPickingTask)scene.GetOrCreateTaskFromName(taskName, taskType, controllerip, controllerport);

            // Test1: GetJointValues
            RobotState robotState = task.GetJointValues();

            /*
             * // Test2: MoveJoints
             * robotState.jointValues[1] += 30;
             * robotState.jointValues[3] -= 30;
             * List<double> jointValues = new List<double>() { robotState.jointValues[1], robotState.jointValues[3] };
             * List<int> jointIndices = new List<int>(){1, 3};
             * task.MoveJoints(jointValues, jointIndices, 30, 0.2, "");
             */

            List <double> jointValues = new List <double>()
            {
                45
            };
            List <int> jointIndices = new List <int>()
            {
                6
            };

            task.MoveJoints(jointValues, jointIndices, 30, 0.2, "");

            jointValues = new List <double>()
            {
                0, 0, 0, 0, 0, 0, 0
            };
            jointIndices = new List <int>()
            {
                0, 1, 2, 3, 4, 5, 6
            };
            task.MoveJoints(jointValues, jointIndices, 30, 0.2, "");

            /*
             * // Test3: MoveToHandPosition
             * double[] basepos = robotState.tools["1Base"];
             * basepos[1] += 50;
             * basepos[3] -= 50;
             * task.MoveToHandPosition(new List<double>(basepos), GoalType.transform6d, "1Base", 0.2);
             */

            // Test4: PickAndMove
            //task.PickAndMove("container3", "camera3", "1Base", GoalType.translationdirection5d, new List<double>() { 1900, 240, 700, 0, 0, 1 }, 0.2);
        }