www.gusucode.com > matlab编程求解机器人的正逆解 采用遗传算法对机器人进行路径规划源码程序 > code/基本代码/Robot.m

    L1 = Link('d',0.25,'a',0,'alpha',pi/2);
L2 = Link('d',0.25,'a',0,'alpha',pi/2);
L3 = Link('d',0.25,'a',2.5,'alpha',0);
L4 = Link('d',0.25,'a',2.5,'alpha',0);
L5 = Link('d',0.25,'a',0,'alpha',pi/2);
L6 = Link('d',0.25,'a',0,'alpha',pi/2);
L7 = Link('d',2,'a',0,'alpha',pi/2);

t = 1:0.1:10;
theta1 = pi/2;
r = SerialLink([L1 L2 L3 L4 L5 L6 L7]);
theta = [theta1,pi/2,pi/2,0,pi/2,-pi/2,0];
r.plot(theta);