Exemplo n.º 1
0
 public void Move()
 {
     Console.WriteLine("即将开始直线运动,距离:301mm");
     Thread.Sleep(3000);
     JKTYPE.CartesianPose movepose = new JKTYPE.CartesianPose();  //目标点在tcp坐标系下的位姿
     movepose.tran.x = 301;
     jakaAPI.linear_move(ref i, ref movepose, JKTYPE.MoveMode.INCR, true, 30);
 }
Exemplo n.º 2
0
 public void Move0()
 {
     Console.WriteLine("即将开始直线运动,距离:301mm");
     Thread.Sleep(3000);
     JKTYPE.CartesianPose movepose = new JKTYPE.CartesianPose();  //目标点在tcp坐标系下的位姿
     for (int i = 0; i < 10001; i++)
     {
         movepose.tran.z = 100;
         jakaAPI.linear_move(ref i, ref movepose, JKTYPE.MoveMode.INCR, true, 90);
         movepose.tran.z = -100;
         jakaAPI.linear_move(ref i, ref movepose, JKTYPE.MoveMode.INCR, true, 90);
     }
 }
Exemplo n.º 3
0
        private void DoSomething(JKTYPE.CartesianPose Position)
        {
            Console.WriteLine("{0}", Position.tran.x);
            //判断位置是否到达
            if (Position.tran.x - last > 10 || Position.tran.x - last < -10)
            {
                last = TcpPosition.tran.x;
                Console.WriteLine("############触发{0}##############", num);

                jakaAPI.set_digital_output(ref i, JKTYPE.IOType.IO_CABINET, 1, true);  //设置电控柜数字输出1为高电平
                Thread.Sleep(10);                                                      //等待10ms
                jakaAPI.set_digital_output(ref i, JKTYPE.IOType.IO_CABINET, 1, false); //设置电控柜数字输出1为低电平

                jakaAPI.set_analog_output(ref i, JKTYPE.IOType.IO_CABINET, 1, 65535);  //设置电控柜模拟输出1为65535
                Thread.Sleep(10);                                                      //等待10ms
                jakaAPI.set_analog_output(ref i, JKTYPE.IOType.IO_CABINET, 1, 0);      //设置电控柜数字输出1为0

                num++;
            }
        }
Exemplo n.º 4
0
        public void csvrun()
        {
            JKTYPE.JointValue home_pos = new JKTYPE.JointValue();
            home_pos.jVal = new double[] { 1.18, 1.85, -2.49, 2.76, 1.70, 0.50 };
            DataTable cvD1 = CSVFileHelper.ReadCSV("qwe.csv");
            int       i    = 0;
            int       a;

            a = jakaAPI.create_handler("192.168.2.18".ToCharArray(), ref i); //替换自己的ip
            Console.WriteLine($"机器人控制句柄{i}创建: {a}");
            jakaAPI.power_on(ref i);                                         //机器人上电
            jakaAPI.enable_robot(ref i);                                     //机器人上使能
            jakaAPI.set_rapidrate(ref i, 1);                                 //设置机器人运行倍率
            Console.WriteLine("home");
            jakaAPI.joint_move(ref i, ref home_pos, JKTYPE.MoveMode.ABS, true, 0.5);
            foreach (DataRow dr in cvD1.Rows)
            {
                int b;
                JKTYPE.CartesianPose pose = new JKTYPE.CartesianPose();
                pose.tran.x = double.Parse(dr[0].ToString());
                pose.tran.y = double.Parse(dr[1].ToString());
                pose.tran.z = 200.0;
                pose.rpy.rx = 3.14;
                pose.rpy.ry = 0;
                pose.rpy.rz = 0;
                Console.WriteLine(pose.tran.x);
                Console.WriteLine(pose.tran.y);
                JKTYPE.OptionalCond jc = new JKTYPE.OptionalCond();

                b = jakaAPI.linear_move_extend(ref i, ref pose, JKTYPE.MoveMode.ABS, false, 50, 100, 1, ref jc);


                Console.WriteLine(b);
                Console.WriteLine(pose.tran.x.GetType().Name);
            }
        }
Exemplo n.º 5
0
 public static extern int circular_move(ref int i, ref JKTYPE.CartesianPose end_pos, ref JKTYPE.CartesianPose mid_pos, JKTYPE.MoveMode move_mode, bool is_block, double speed, double acc, double tol, ref JKTYPE.OptionalCond option_cond);
Exemplo n.º 6
0
 public static extern int linear_move_extend(ref int i, ref JKTYPE.CartesianPose cart_pos, JKTYPE.MoveMode move_mode, bool is_block, double speed, double acc, double tol, ref JKTYPE.OptionalCond option_cond);
Exemplo n.º 7
0
 public static extern int kine_forward(ref int handle, ref JKTYPE.JointValue joint_pos, ref JKTYPE.CartesianPose cartesian_pose);
Exemplo n.º 8
0
 public static extern int kine_inverse(ref int handle, ref JKTYPE.JointValue ref_pos, ref JKTYPE.CartesianPose cartesian_pose, ref JKTYPE.JointValue joint_pos);
Exemplo n.º 9
0
 public static extern int get_tcp_position(ref int handle, ref JKTYPE.CartesianPose tcp_position);
Exemplo n.º 10
0
 public static extern int set_user_frame_data(ref int handle, int id, ref JKTYPE.CartesianPose user_frame, char[] name);
Exemplo n.º 11
0
 public static extern int set_tool_data(ref int handle, int id, ref JKTYPE.CartesianPose tcp, char[] name);
Exemplo n.º 12
0
 public static extern int servo_p(ref int handle, ref JKTYPE.CartesianPose cartesian_pose, JKTYPE.MoveMode move_mode);
Exemplo n.º 13
0
 public static extern int linear_move(ref int handle, ref JKTYPE.CartesianPose end_pos, JKTYPE.MoveMode move_mode, bool is_block, double speed);