2007年4月10日 星期二

第五週作業

P5-1-1


L1=30;
L2=23;
L3=12;

r1=L1/6;
r2=L1/12;
r3=L2/10;

arm1x=[ r1 r1*cosd(240)+r1 r1*cosd(210)+r1 0 r1*cosd(150)+r1 r1*cosd(120)+r1 r1 11*r2 11*r2+r2*cosd(60) 11*r2+r2*cosd(30) L1 11*r2 L1 11*r2+r2*cosd(-30) 11*r2+r2*cosd(-60) 11*r2 r1];
arm1y=[-r1 r1*sind(240) r1*sind(210) 0 r1*sind(150) r1*sind(120) r1 r2 r2*sind(60) r2*sind(30) 0 0 0 r2*sind(-30) r2*sind(-60) -r2 -r1];
arm2x=[10*r2 11*r2+r2*cosd(150) 11*r2+r2*cosd(120) 11*r2 L1+L2-3*r2 L1+L2-3*r2+r2*cosd(60) L1+L2-3*r2+r2*cosd(30) L1+L2-2*r2 L1+L2-3*r2+r2*cosd(-30) L1+L2-3*r2+r2*cosd(-60) L1+L2-3*r2 11*r2 11*r2+r2*cosd(240) 11*r2+r2*cosd(210) 10*r2];
arm2y=[0 r2*sind(150) r2*sind(120) r2 r2 r2*sind(60) r2*sind(30) 0 r2*sind(-30) r2*sind(-60) -r2 -r2 r2*sind(240) r2*sind(210) 0 ];
palmx=[L1+L2-2*r2 L1+L2-r2 L1+L2+L3-2*r2 L1+L2-r2 L1+L2-2*r2];
palmy=[0 r3 0 -r3 0 ];

line(arm1x,arm1y);
line(arm2x,arm2y,'color','r');
line(palmx,palmy,'color','k');
axis equal;






P5-1-2


function body(L1,L2,L3,theta1,theta2,theta3);
%function body(L1,L2,L3,theta1,theta2,theta3)
%輸入:
% L1:上臂長,L2:下臂長,L3:手掌長
% theta1為上手臂之水平角度(順時針),theta2為下手臂對上手臂的角度(逆時針),theta3為手掌對下手臂之夾角


arm1x=[ r1 r1*cosd(240)+r1 r1*cosd(210)+r1 0 r1*cosd(150)+r1 r1*cosd(120)+r1 r1 11*r2 11*r2+r2*cosd(60) 11*r2+r2*cosd(30) L1 11*r2 L1 11*r2+r2*cosd(-30) 11*r2+r2*cosd(-60) 11*r2 r1];
arm1y=[-r1 r1*sind(240) r1*sind(210) 0 r1*sind(150) r1*sind(120) r1 r2 r2*sind(60) r2*sind(30) 0 0 0 r2*sind(-30) r2*sind(-60) -r2 -r1];
arm2x=[10*r2 11*r2+r2*cosd(150) 11*r2+r2*cosd(120) 11*r2 L1+L2-3*r2 L1+L2-3*r2+r2*cosd(60) L1+L2-3*r2+r2*cosd(30) L1+L2-2*r2 L1+L2-3*r2+r2*cosd(-30) L1+L2-3*r2+r2*cosd(-60) L1+L2-3*r2 11*r2 11*r2+r2*cosd(240) 11*r2+r2*cosd(210) 10*r2];
arm2y=[0 r2*sind(150) r2*sind(120) r2 r2 r2*sind(60) r2*sind(30) 0 r2*sind(-30) r2*sind(-60) -r2 -r2 r2*sind(240) r2*sind(210) 0 ];
palmx=[L1+L2-2*r2 L1+L2-r2 L1+L2+L3-2*r2 L1+L2-r2 L1+L2-2*r2];
palmy=[0 r3 0 -r3 0 ];

line(arm1x,arm1y);
line(arm2x,arm2y,'color','r');
line(palmx,palmy,'color','k');
axis equal

clf

x1=(arm1x-r1)*cosd(-theta1)-arm1y*sind(-theta1);
y1=(arm1x-r1)*sind(-theta1)+arm1y*cosd(-theta1);
%將上臂連桿以座標原點順時針旋轉
theta2=180+theta1-theta2;
x2=x1(12)+(arm2x-11*r2)*cosd(-theta2)-arm2y*sind(-theta2);
y2=y1(12)+(arm2x-11*r2)*sind(-theta2)+arm2y*cosd(-theta2);
%將上、下臂以手肘為旋轉點,下臂逆時針旋轉
theta3=180+theta2-theta3;
x3=x2(8)+(palmx-L1-L2+2*r2)*cosd(-theta3)-palmy*sind(-theta3);
y3=y2(8)+(palmx-L1-L2+2*r2)*sind(-theta3)+palmy*cosd(-theta3);
%手掌以手腕為旋轉點,逆時針旋轉
line(x2,y2,'color','r');
line(x3,y3,'color','k');
axis equal;
axis([-30 30 -30 30]);


P5-1-3

body(30,23,12,90,-45,-30);







P5-1-4

L1=30;
L2=23;
L3=12;

r1=L1/6;
r2=L1/12;
r3=L2/10;

arm1x=[ r1 r1*cosd(240)+r1 r1*cosd(210)+r1 0 r1*cosd(150)+r1 r1*cosd(120)+r1 r1 11*r2 11*r2+r2*cosd(60) 11*r2+r2*cosd(30) L1 11*r2 L1 11*r2+r2*cosd(-30) 11*r2+r2*cosd(-60) 11*r2 r1];
arm1y=[-r1 r1*sind(240) r1*sind(210) 0 r1*sind(150) r1*sind(120) r1 r2 r2*sind(60) r2*sind(30) 0 0 0 r2*sind(-30) r2*sind(-60) -r2 -r1];
arm2x=[10*r2 11*r2+r2*cosd(150) 11*r2+r2*cosd(120) 11*r2 L1+L2-3*r2 L1+L2-3*r2+r2*cosd(60) L1+L2-3*r2+r2*cosd(30) L1+L2-2*r2 L1+L2-3*r2+r2*cosd(-30) L1+L2-3*r2+r2*cosd(-60) L1+L2-3*r2 11*r2 11*r2+r2*cosd(240) 11*r2+r2*cosd(210) 10*r2];
arm2y=[0 r2*sind(150) r2*sind(120) r2 r2 r2*sind(60) r2*sind(30) 0 r2*sind(-30) r2*sind(-60) -r2 -r2 r2*sind(240) r2*sind(210) 0 ];
palmx=[L1+L2-2*r2 L1+L2-r2 L1+L2+L3-2*r2 L1+L2-r2 L1+L2-2*r2];
palmy=[0 r3 0 -r3 0 ];

line(arm1x,arm1y);
line(arm2x,arm2y,'color','r');
line(palmx,palmy,'color','k');
axis equal;

clf

theta1=linspace(-90,-75,10);
theta2=linspace(-45,-35,10);
theta3=linspace(-30,-10,10);

for n=1:10;
x1=(arm1x-r1)*cosd(-theta1(n))-arm1y*sind(-theta1(n));
y1=(arm1x-r1)*sind(-theta1(n))+arm1y*cosd(-theta1(n));
theta2(n)=180+theta1(n)-theta2(n);
x2=x1(12)+(arm2x-11*r2)*cosd(-theta2(n))-arm2y*sind(-theta2(n));
y2=y1(12)+(arm2x-11*r2)*sind(-theta2(n))+arm2y*cosd(-theta2(n));
theta3(n)=180+theta2(n)-theta3(n);
x3=x2(8)+(palmx-L1-L2+2*r2)*cosd(-theta3(n))-palmy*sind(-theta3(n));
y3=y2(8)+(palmx-L1-L2+2*r2)*sind(-theta3(n))+palmy*cosd(-theta3(n));
line(x1,y1);
line(x2,y2,'color','r');
line(x3,y3,'color','k');
axis equal;
axis([-30 30 -30 30]);
pause(1);
clf;
end;

手臂連桿的轉動





P5-2-1

手指分為三節
將手腕視為一桿,一端為定點,
加上手指的連結點,總桿數是4
所以自由度為3;




P5-2-2

function palm(P);
%function palm(P)
%輸入手掌長度P來觀察手指的旋轉運動
%L1 L2 L3分別為指尖、第二指節、第三指節
%R1 R2 R3分別為其半徑

axis equal;
P=17;
L1=P*2/17;
L2=P*2.5/17;
L3=P*5/17;
R1=L1*0.5/2;
R2=L2*0.6/2.5;
R3=L3*0.8/5;

%右手手指順時針旋轉的極限
fbx=[0.05*cosd(270:-5:-90),R3*cosd(270) R3*cosd(225) R3*cosd(180) R2*cosd(180) R2*cosd(135) R2*cosd(90) R2*cosd(45) R2*cosd(0) R3*cosd(0) R3*cosd(-45) R3*cosd(-90)];
fby=[0.05*sind(270:-5:-90),R3*sind(270) R3*sind(225) R3*sind(180) L3-R2+R2*sind(180) L3-R2+R2*sind(135) L3-R2+R2*sind(90) L3-R2+R2*sind(45) L3-R2+R2*sind(0) R3*sind(0) R3*sind(-45) R3*sind(-90)];
fmx=[0.05*cosd(270:-5:-90) R2*cosd(270) R2*cosd(225) R2*cosd(180) R1*cosd(180) R1*cosd(135) R1*cosd(90) R1*cosd(45) R1*cosd(0) R2*cosd(0) R2*cosd(-45) R2*cosd(-90)];
fmy=[0.05*sind(270:-5:-90) R2*sind(270) R2*sind(225) R2*sind(180) L2-R1+R1*sind(180) L2-R1+R1*sind(135) L2-R1+R1*sind(90) L2-R1+R1*sind(45) L2-R1+R1*sind(0) R2*sind(0) R2*sind(-45) R2*sind(-90)];
ftx=[0.05*cosd(270:-5:-90) R1*cosd(270) R1*cosd(225) R1*cosd(180) R1*cosd(180) R1*cosd(180) R1*cosd(135) R1*cosd(90) R1*cosd(45) R1*cosd(0) R1*cosd(0) R1*cosd(-45) R1*cosd(-90)];
fty=[0.05*sind(270:-5:-90) R1*sind(270) R1*sind(225) R1*sind(180) L1+R1*sind(180) L1+R1*sind(180) L1+R1*sind(135) L1+R1*sind(90) L1+R1*sind(45) L1+R1*sind(0) R1*sind(0) R1*sind(-45) R1*sind(-90)];

line(fbx,fby);
fmyY=fmy+L3-R2;
line(fmx,fmyY,'color','r');
ftyY=fty+L3+L2-R1-R2;
line(ftx,ftyY,'color','k');

%右手手指逆時針旋轉的極限
fb=line(fbx,fby);
rotate(fb,[0 0 1],90,[0 0 0]);
fmx=fmx+(L3-R2)*cosd(180);
fmy=fmy+(L3-R2)*sind(180);
fm=line(fmx,fmy,'color','r');
rotate(fm,[0 0 1],210,[(L3-R2)*cosd(180) 0 0]);
ftx=ftx+(L3-R2)*cosd(180)+(L2-R1)*cosd(-60);
fty=fty+(L3-R2)*sind(180)+(L2-R1)*sind(-60);
ft=line(ftx,fty,'color','k');
rotate(ft,[0 0 1],-100,[(L3-R2)*cosd(180)+(L2-R1)*cosd(-60) (L3-R2)*sind(180)+(L2-R1)*sind(-60) 0]);






P5-2-3

將球丟離開手中速度為V
因為手指相對於手掌,其實只有做張開的動作
也就是,以連接手指各關節為圓心做伸展運動
假設此時為等速的展開
可視為只有法線加速度去改變方向
所以切線方向速度固定為V

沒有留言: