1 function drawHandiCub(x,hand,varargin)
3 if (size(varargin,2)>0)
8 rotmat=axis2dcm(x(end-3:end));
9 rotmat(1:3,4)=x(end-6:end-4);
11 fkiCub(1,hand,x(1:3)
',1,rotmat2*rotmat); 12 fkiCub(2,hand,x(4:6)',1,rotmat2*rotmat);
14 fkiCub(3,hand,x(7:8)
',1,rotmat2*rotmat); 15 pos3link1=fkiCub(3,hand,x(7:8)',0,rotmat2*rotmat,0);
17 pos3link1=fkiCub(3,hand,[0 0]
',0,rotmat2*rotmat,0); 19 ee=rotmat2*rotmat*[0 0 0 1]';
21 plot3(ee(1),ee(2),ee(3),
'*y',
'LineWidth',8.0);
23 rotmat3=rotmat2*rotmat;
26 quiver3(ee(1),ee(2),ee(3),rotmat3(1,1)/scale,rotmat3(2,1)/scale,rotmat3(3,1)/scale,
'r:',
'LineWidth', 2);
27 quiver3(ee(1),ee(2),ee(3),rotmat3(1,2)/scale,rotmat3(2,2)/scale,rotmat3(3,2)/scale,
'g:',
'LineWidth', 2);
28 quiver3(ee(1),ee(2),ee(3),rotmat3(1,3)/scale,rotmat3(2,3)/scale,rotmat3(3,3)/scale,
'b:',
'LineWidth', 2);
30 pos1link1=fkiCub(1,hand,x(1:3)
',0,rotmat2*rotmat,1); 31 pos2link1=fkiCub(2,hand,x(4:6)',0,rotmat2*rotmat,0);
33 plot3([pos1link1(1) pos2link1(1)], [pos1link1(2) pos2link1(2)], [pos1link1(3) pos2link1(3)],
'k');
34 plot3([pos3link1(1) pos2link1(1)], [pos3link1(2) pos2link1(2)], [pos3link1(3) pos2link1(3)],
'k');
35 plot3([ee(1) pos1link1(1)], [ee(2) pos1link1(2)], [ee(3) pos1link1(3)],
'k');
36 plot3([ee(1) pos3link1(1)], [ee(2) pos3link1(2)], [ee(3) pos3link1(3)],
'k');
38 fill3([pos1link1(1) ee(1) pos2link1(1)], [pos1link1(2) ee(2) pos2link1(2)], [pos1link1(3) ee(3) pos2link1(3)], [0 0 0]);
39 fill3([pos3link1(1) ee(1) pos2link1(1)], [pos3link1(2) ee(2) pos2link1(2)], [pos3link1(3) ee(3) pos2link1(3)], [0 0 0]);