内容
CLC清除关闭所有RDK = Robolink;path = RDK.getParam(“PATH_LIBRARY”);RDK。AddFile([路径,“Example-06。挑选并摆放两张桌子。]);流(“站内可用物品:\n”);disp (RDK。ItemList (1,1));程序= RDK。项目(“挑选和放置”, RDK.ITEM_TYPE_PROGRAM);program.RunProgram ();
站内可用项目:列1至列3{'示例1 - Pic…'}{'ABB IRB 1600-8/…'}{'ABB IRB 1600-8/…'}}列4至列8{'工具'}{'表1'}}{'方法'}{'目标b1'}}{'目标b2'}列9至列13{'目标b3'}{'目标b4'}{'目标b5'}{'基础'}{'球1'}列14至列18{'球2'}{'球3'}{'球4'}}{'球5'}{'表2'}19至列21{'基础'}{'拾取和放置'}{'替换物体'}
从站点检索对象并修改它们
机器人= RDK。项目(' abb irb 1600-8/1.45', RDK.ITEM_TYPE_ROBOT);流(“机器人选择:\ t % s \ n”robot.Name ());robot.setVisible (1);frameef = robot.Parent();流(“选定的机器人参考:\t%s\n”frameref.Name ());object = RDK。项目(“基地”, RDK.ITEM_TYPE_OBJECT);流(的对象选择:\ t % s \ n”object.Name ());球= RDK。项目(“球”);流(“球选择:\ t % s \ n”ball.Name ());frametable = RDK。项目(“表1”, RDK.ITEM_TYPE_FRAME);流(“表选择:\ t % s \ n”frametable.Name ());tool = RDK。项目(“工具”, RDK.ITEM_TYPE_TOOL);流(选择“工具:\ t % s \ n”tool.Name ());target1 = RDK。项目(“目标b1”, RDK.ITEM_TYPE_TARGET);流('选定目标1:\t%s\n'target1.Name ());target2 = RDK。项目(“目标b3”, RDK.ITEM_TYPE_TARGET);流('选定目标2:\t%s\n'target2.Name ());
机器人选择:ABB IRB 1600-8/1.45机器人参考选择:ABB IRB 1600-8/1.45基础对象选择:基础球选择:球1表选择:表1工具选择:工具目标1选择:目标b1目标2选择:目标b3
如何生成机器人程序
抽搐()而1项= RDK。项目(“宏”);如果item.Valid() == 0打破结束item.Delete ();结束Jhome = [0,0,0,0,0,30, 0];robot.setJoints (jhome);RDK.Render (0);http = tool.PoseTool();ref = RDK。AddFrame (“帧宏”, frameref);Hframe = transl(750,250,500) * roty(pi / 2) * rotz(pi);ref.setPose (Hframe);robot.setPoseFrame (ref);robot.setPoseTool (Htcp);Hhome = inv(Hframe) * robot.SolveFK(jhome) * http;prog = RDK。AddProgram (“掠夺宏”);target = RDK。AddTarget (“回家”, ref, robot);target.setAsJointTarget ();target.setJoints (jhome)prog.MoveJ(目标);angleY = 0;为Dy = 600:-100:100 targetname = sprintf“目标TY=%i RY=%i”;;;;;target = RDK。AddTarget (targetname, ref, robot);姿态= transl(0, dy, 0);pose(1:3, 1:3) = home(1:3, 1:3);pose = pose * roty(angleY * pi / 180);target.setPose(构成);prog.MoveL(目标);angleY = angleY + 20;结束RDK.Render (1);prog.RunProgram ();而robot.Busy()暂停(1);流(“等待机器人完成……\n”);结束流(“再次运行程序…\n”);prog.RunProgram ();
等待机器人完成…再次运行程序…
如何更改项所附加的父项
Htarget = target1.Pose();target1.setParentStatic (frameref);target1.setPose (Htarget);target2.setParent (frameref);children = frametable. children ();为i = 1:numel(children) name = children {i}.Name();Newname = [name,“修改”];visible = children {i}.Visible();我孩子的{}.setName(新名称);流(“我% s % \ n”, newname,可见);结束
方法修改1目标b2修改1目标b4修改1目标b5修改1基修改1球1修改1球2修改1球3修改1
如何将对象附加/分离到机器人工具上
attached = tool. attachclose ();如果attachedname = attachedname ();流(“附加:% s \ n”, attachedname);其他的流(“没有物体足够接近\n”);结束暂停(2);tool.DetachAll ();流(“分离所有对象\n”);
没有物体离得足够近
如何缩放对象以及如何检测碰撞
RDK。项目(“替换对象”RDK.ITEM_TYPE_PROGRAM) .RunProgram ();J1 = [-100, -50, -50, -50, -50, -50];J2 = [100,50,50,50,50,50,50];碰撞=机器人。MoveJ_Test(j1, j2, 1);disp(碰撞)pairs = RDK.Collisions();流(“对碰撞:%i\n”、双);对象。Scale([10,10,0.5]);P1 = [1000;0;8000);P2 = [1000;0;0);[collision, itempick, xyz] = RDK。Collision_Line (p1, p2);如果碰撞流('从p1到p2的行与%s\n相撞'itempicked.Name ());ball.Copy ();newball = RDK.Paste();newball.setPose(transl(xyz(1), xyz(2), xyz(3)));newball.Scale (0.5);newball。Recolor([1 0 0]);结束
1对碰撞:从p1到p2的1条线与修改后的碱基碰撞
如何在不创建程序的情况下以编程方式移动机器人
RDK。项目(“替换对象”RDK.ITEM_TYPE_PROGRAM) .RunProgram ();流(“按目标物品移动……\n”);robot.setPoseFrame (frametable);RDK.setSimulationSpeed (10);为I = 1:2机器人。setSpeed(10000、1000);robot.MoveJ (target1);机器人。setSpeed(100、200);robot.MoveL (target2);结束流(“通过关节移动……\n”);J1 = [0,0,0,0,0,0,0];J2 = [40, 30, -30, 0, 50, 0];为i = 1:2 robot.MoveJ(J1);robot.MoveL (J2);结束流(“按姿势移动……\n”);H1 = [-0.492404, -0.642788, -0.586824, -101.791308;-0.413176, 0.766044, -0.492404, 1265.638417;0.766044, 0.000000, -0.642788, 117.851733;0.000000, 0.000000, 0.000000, 1.000000];H2 = [-0.759717, -0.280123, -0.586823, -323.957442;0.060192, 0.868282, -0.492405, 358.739694;0.647462, -0.409410, -0.642787, 239.313006;0.000000, 0.000000, 0.000000, 1.000000];为i = 1:2 robot.MoveJ(H1);robot.MoveL (H2);结束
按目标项目移动…通过关节运动…通过姿势移动……
计算机器人的正运动学和逆运动学
流(“当前机器人关节:\n”);joint = robot. joint ();disp(关节);流('计算当前关节的姿态:\n');H_tcp_wrt_frame = robot.SolveFK(关节);disp (H_tcp_wrt_frame);流(“从姿态计算机器人关节:\n”);joints2 = robot.SolveIK(H_tcp_wrt_frame);disp (joints2);流('所选位置的所有解决方案:\n');joints3_all = robot.SolveIK_All(H_tcp_wrt_frame);disp (joints3_all);RDK.ShowSequence (joints3_all);暂停(1);Joints4 =机器人。SolveIK(H_tcp_wrt_frame * transl(0,0, -100));robot.setJoints (joints4);
当前机器人关节:-56.8091 -22.9201 33.5814 47.6220 54.6902 -104.7797当前关节的计算位姿:-0.5868 -0.2801 0.7597 305.0477 -0.4924 0.8683 -0.0602 -394.7465 -0.6428 -0.4094 -0.6475 978.1476 000 1.0000从位姿计算机器人关节:-56.8091 -22.9201 33.5814 47.6220 54.6902 -104.7797所有可用于选定位置的解:第1至第7列-56.8091 -56.8091 123.1909 123.1909 -56.8091 -56.8091 123.1909 -22.9201 -22.9201 -3.2918 -3.2918 -22.9201 -22.9201 -3.2918 33.5814 33.5814 -192.6814 -192.6814 33.5814 33.5814 -132.3780 -129.3428 50.6572 47.6220 -132.3780 -129.3428 54.6902 -54.6902 51.2124 -51.2124 54.6902 -54.6902 54.6902 51.2124 54.6902 54.6902 54.6902 75.2203 -284.7797 250.1869 10.0000 10.0000 10.0000 10.0000 10.0000 10.0000 10.0000 10.0000 0000 180.0000 226.2628 226.2628 360.0000 180.0000 354.9666第8列123.1909 -3.2918 -192.6814 50.6572 -51.2124 -289.8131 0 226.2628
示例添加目标到一个程序,并使用圆周运动
RDK = Robolink();机器人= RDK。项目(”, RDK.ITEM_TYPE_ROBOT);pose0 = robot.Pose();prog = RDK。AddProgram (“TestProgram”);target0 = RDK。AddTarget (“第一点”);target0.setAsCartesianTarget ();target0.setPose (pose0);prog.MoveL (target0);pos1 = pos0 * transl(50,0,0);pos2 = pos0 * transl(50,50,0);target1 = RDK。AddTarget (“第二点”);target1.setAsCartesianTarget ();target1.setPose (pose1);target2 = RDK。AddTarget (“第三点”);target2.setAsCartesianTarget ();target2.setPose (pose2);掠夺。MoveC (target1 target2)
铁路测试:
RDK = Robolink();机器人= RDK。项目(”, RDK.ITEM_TYPE_ROBOT);robot = robot. getlink (RDK.ITEM_TYPE_ROBOT);disp (robot.Name ());robot.setJointLimits ([-180;-180;-180;-180;-180;-180;0], [+ 180;+ 180; +180; +180; +180; +180; 5000]); [lower_limit, upper_limit] = robot.JointLimits(); disp(lower_limit) disp(upper_limit) joints = robot.JointsHome(); config = robot.JointsConfig(joints); disp(config) all_solutions = robot.SolveIK_All(robot.SolveFK(robot.Joints())); disp(all_solutions)
ABB IRB 1600-8/1.45 -180 -180 -180 -180 -180 -180 180 -180 180 180 180 180 180 180 180 180 180 180 180 180 180 180 180 180 0000列1到7 -64.9691 -64.9691 -64.9691 - 64.0309 - 115.0309 - 115.0309 -27.6557 -27.6557 76.9661 76.9661 -89.0434 -89.0434 1.3654 29.7138 29.7138 29.7138 150.2862 11.0876 11.0876 168.9124 46.2971 -133.7029 103.8452 -76.1548 -109.3352 70.6648 -130.9223 66.4849 -66.4849 135.3704 -135.3704 61.3200 -103.9353 76.0647 27.3638 -152.6362 -17.5214 162.4786 -110.2446 10.0000 10.000010.0000 10.0000 10.0000 10.0000 0.0000 0.0000 180.0000 131.2992 203.4274 180.0000 266.4139 180.0000列8 115.0309 1.3654 168.9124 49.0777 -61.3200 69.7554 10.0000 180.0000