clear
clc
h = figure;
axis tight manual
filename = 'robot.gif';
%Schunk机械臂参数的输入
L1=0.35;
L2=0.305;
L3=0.3;
%DH参数建立
Joint1 = Link([ 0, 0, 0, 0, 0],'revolute', 'modified');
Joint2 = Link([ 0, L1, 0, -pi/2, 0], 'revolute','modified');
Joint3 = Link([ 0, 0, 0, pi/2, 0], 'revolute','modified');
Joint4 = Link([ 0, L2, 0, -pi/2, 0], 'revolute','modified');
Joint5 = Link([ 0, 0, 0, pi/2, 0],'revolute', 'modified');
Joint6 = Link([ 0, L3, 0, -pi/2, 0],'revolute', 'modified');
Joint7 = Link([ 0, 0, 0, pi/2, 0],'modified');
%机器人模型建立
robot = SerialLink([Joint1 Joint2 Joint3 Joint4 Joint5 Joint6 Joint7], 'name', '小驽马机械臂');
%8个圆上的目标点
R = 0.3;%半径
L = 0.6;%与机械臂的距离
target = [ R,L,0; R*cos(pi/4), L, R*sin(pi/4);0,L,R; -R*cos(pi/4), L, R*sin(pi/4); -R,L,0;-R*cos(pi/4