matlab|matlab 机器人工具箱6-一个例子

本文主要参考清华大学出版社的《机器人仿真与编程技术》一书
【matlab|matlab 机器人工具箱6-一个例子】一个具体的例子

a1=sym('a1')l1=sym('l1')a2=sym('a2')l2=sym('l2')a3=sym('a3')l3=sym('l3')T01=trotz(a1)*transl(l1,0,0)T12=trotz(a2)*transl(l2,0,0)T23=trotz(a3)*transl(l3,0,0)T03=T01*T12*T23L(1)=Link([0 0 1 0])L(2)=Link([0 0 1 0])L(3)=Link([0 0 1 0])ThreeLink=SerialLink(L,'name','Planar3R')TL=[-1 0 0 0; 0 -1 0 1; 0 0 1 0; 0 0 0 1]Q0=[0 -pi/2 pi/2]QF=ThreeLink.ikine(TL,Q0,'mask',[1 1 0 0 0 1])% ThreeLink.plot(QF)TRAJ=jtraj(Q0,QF,(0:.05:1))ThreeLink.plot(TRAJ)

显示的一个动态的运动过程
TRAJ =0-1.57081.57080.0018-1.57081.56530.0134-1.57081.53050.0418-1.57081.44540.0910-1.57081.29790.1626-1.57081.08300.2562-1.57080.80230.3694-1.57080.46260.4986-1.57080.07490.6391-1.5708-0.34650.7854-1.5708-0.78540.9317-1.5708-1.22421.0722-1.5708-1.64571.2014-1.5708-2.03341.3146-1.5708-2.37311.4082-1.5708-2.65381.4798-1.5708-2.86871.5290-1.5708-3.01621.5574-1.5708-3.10131.5690-1.5708-3.13611.5708-1.5708-3.1416

刚开始的时候会报错:Number of robot DOF must be >= the same number of 1s in the mask matrix
参考了一个帖子https://www.ilovematlab.cn/thread-533863-1-1.html?s_tid=LandingPageTabqa加mask
QF=ThreeLink.ikine(TL,Q0,'mask',[1 1 0 0 0 1])
但是出来的结果效果和书上不一样,现在有待考究

    推荐阅读