2007年3月17日 星期六

Homework 3

作業三 b94611001 歐陽太閒
P3.1.1
%程式碼如下

%作業三P3.1.1 歐陽太閒
L1=32; %手臂長(cm)
L2=28; %手肘+手掌中心長
s=25; %肩頸距
h=30; %頭頂高
clf; %清除畫面
%藍線為肢體運動之對應位置,綠線和紅線分別為拳頭和肘關節軌跡
cosphi=(L1^2 - L2^2 + s^2 - h^2)/(2*(h*L2)+2*(L1*s));%計算夾角
costheta=(s^2+h^2-(L1^2+L2^2))/(2*L1*L2);
anglesl1= acos(abs(cosphi));
anglel1l2= (acos(abs(cosphi))+acos(abs(costheta)));

x=[0 -s,-s -s-L1*cos(anglesl1),-s-L1*cos(anglesl1) 0] %x-陣列
y=[0 0,0 L1*sin(anglesl1),L1*sin(anglesl1) h] %y-陣列
line(x,y); %繪製

for i=1:1:3 %嘗試上移
h=h+5;
cosphi=(L1^2 - L2^2 + s^2 - h^2)/(2*(h*L2)+2*(L1*s));
costheta=(s^2+h^2-(L1^2+L2^2))/(2*L1*L2);
anglesl1= acos(abs(cosphi));
anglel1l2= (acos(abs(cosphi))+acos(abs(costheta)));

x=[0 -s,-s -s+L1*cos(anglesl1),-s+L1*cos(anglesl1) 0]
y=[0 0,0 L1*sin(anglesl1),L1*sin(anglesl1) h]
line(x,y);
end
%繪製軌跡
%肘關節軌跡
i=[0:0.01:pi];
xt1=L1*cos(i)-s;
yt1=L1*sin(i);
track1= line(xt1,yt1);
set(track1, {'Color'},{'r'})
%拳頭軌跡
xt2=[0 0];
yt2=[0 h];
track2= line(xt2,yt2);
set(track2, {'Color'},{'g'})
%頭
i=[-pi:0.01:pi];
xt3=10*cos(i);
yt3=15*sin(i)+15;
track3= line(xt3,yt3);
set(track3, {'Color'},{'b'})
%標註
xlabel('x-axis');
ylabel('y-axis');
title('Homework P3.1 單位:cm 作者:歐陽太閒');
axis equal;%座標軸等距

%執行結果
x =
0 -25.0000 -25.0000 -25.3415 -25.3415 0
y =
0 0 0 31.9982 31.9982 30.0000
x =
0 -25.0000 -25.0000 -21.7640 -21.7640 0
y =
0 0 0 31.8360 31.8360 35.0000
x =
0 -25.0000 -25.0000 -18.8750 -18.8750 0
y =
0 0 0 31.4083 31.4083 40.0000
x =
0 -25.0000 -25.0000 -15.9903 -15.9903 0
y =
0 0 0 30.7055 30.7055 45.0000

%圖片
P3.1.1結果


P3.1.2

%程式碼
%作業三P3.1.2 歐陽太閒
L1=32; %手臂長(cm)
L2=28; %手肘+手掌中心長
s=20; %肩頸距
h=30; %頭頂高
clf; %清除畫面
%繪出肩頸
line([0 -s],[0 0]);
%頭
i=[-pi:0.01:pi];
xt3=10*cos(i);
yt3=15*sin(i)+15;
track3= line(xt3,yt3);
set(track3, {'Color'},{'b'});
%拳頭最大移動範圍,以60cm為半徑之圓
line([-s -s],[L1+L2 0]);
i=[-pi:0.01:pi];
xt1=(L1+L2)*cos(i)-s
yt1=(L1+L2)*sin(i)
fist= line(xt1,yt1);
set(fist, {'Color'},{'r'})
%標註
xlabel('x-axis');
ylabel('y-axis');
title('Homework P3.1.2 單位:cm 作者:歐陽太閒');
axis equal;%座標軸等距


%圖片-拳頭移動的最大範圍
P3.1.2結果

另外,可沿頭頂上方移動距
range=((L1+L2)^2+s^2)^(1/2)-h
結果:
range =
33.2456

P3.1.3
本作業根據之假設如下:
肩膀呈水平且不移動
假設手臂,手肘及頭頂中央均在一平面上運動
故可設肩肘關節皆為旋轉對(DOF=1),分析較為方便
假設手腕和手肘連結,不做運動
假設頭頸與肩高度差不變
假設肩,肘關節之旋轉有其上限
根據以上假設可將此作業視為一
三連桿與一滑塊機構(拳頭)(RRRP連桿組),而滑塊僅能依一個維度運動,可視為棱柱對,沿著頭頂上方垂直移動.
如此才能便於整體分析,而將其運動以數學型式表示,並且以MATLAB描繪之,而不需處理繁雜瑣碎的運動細節或者根據實驗結果慢慢繪製.

--
P3.2

1.旋轉對(Revolute pair, turning pair)
一個自由度,圓弧運動,面接觸的低對
生活中應用的非常多,幾乎大多數的可動機構上都會出現,
此種連接方式可靠而穩定,且製造維護相對容易,也常和其他接頭形式合併使用,例如門的鉸鏈,門閂,電扇,怪手,時鐘等.
鉸鏈
門閂
電扇
怪手
時鐘

2.低對(lower pairs)
物體之間以面或多面連接,因接觸面大而應力較小,傳統上較為穩定可靠,較不會因為應力產生影響結構的變形,為常見的連接方式.
主要有球面對(S,DOF=3),面型對(E,DOF=3),圓柱對(C,DOF=2),旋轉對(R,DOF=1),稜柱對(P,DOF=1),螺旋對(H,DOF=1)
例如常見的檯燈旋轉對

高對(higher pairs)
物體間以極小的面積連接,如點或線,因為應力相對較大,結構上較不安定,所以在過去在連接上較少見,不過近年來因為材料科學的進步,可以應用的場合和層面逐漸變多變廣.
主要有圓柱滾動,輪滾動,球體滾動或滑動等.
如辦公椅腳的滾輪.

而近年來也常出現同時使用各種不同的連接對的情況,稱為複合對,例如滾珠軸承(球狀高對和旋轉對)等,截取兩者的好處,而可獲得更高的效率
滾珠軸承

3.型式閉合結
利用連接對(結)的構形來限制另一桿的運動範圍
大多數的連接方式為此,結構簡單常見.
例如引擎的活塞

外力閉合結
利用外來力量(如重力等)保持兩桿接觸.
例如以下的抽屜是利用重力將其保持在滑軌上.
抽屜

--
P3.3

首先,根據達文西(Leonardo da Vinci,1452-1519)的人體圖
利用AutoCAD匯入後測量(如)得知人體之比例為:
身高:身長:手長:腿長:外切圓心和身長下端距:外切圓半徑:頸長=
[300 72 148.36 174 10.77 180 10]
肩頭角:68deg
腿胯角:32deg
故第二題之圓圈之直徑與人體之身高,臂長關聯為
360:300:148.36

故可依此撰寫一函數,繪成圖形
運作結果圖
執行命令為
acrobat(180);

%程式如下

function acrobato=acrobat(h)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%homework P3.3%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%作業三P3.1.1 歐陽太閒 b94611001

height=h; %身高
%由達文西人體圖測繪得的身高:身長:手長:腿長:外切圓心和身長下

端距:外切圓半徑比:頭
body=[300 72 148.36 174 10.77 180 10];
%角度
d2r=pi/180
%肩頭角
angleh=pi/2 - 68*d2r
%腿胯角
anglel=32*d2r
%利用身高推算各數值
bodyIns=(body./300).*h
bodyMatrix=[0, 0, -bodyIns(4)*cos(anglel), bodyIns(4)*cos

(anglel),0, -bodyIns(3)*cos(angleh), bodyIns(3)*cos

(angleh), 0;...
bodyIns(6)-bodyIns(5), bodyIns(6)-bodyIns(5)

+bodyIns(2), bodyIns(4)*sin(anglel)-bodyIns(5),...
bodyIns(4)*sin(anglel)-bodyIns(5), bodyIns(6)-

bodyIns(5)+bodyIns(2), bodyIns(6)-bodyIns(5)+bodyIns(2)

+bodyIns(3)*sin(angleh),...
bodyIns(6)-bodyIns(5)+bodyIns(2)+bodyIns(3)*sin

(angleh),bodyIns(6)+bodyIns(2)+bodyIns(5)+bodyIns(7);]
theta=-30
xtrans=bodyIns(6)*pi/6;
cirtrans=0;
clf;
for l=0:5
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%人體和外切圓繪製%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%畫圓
i=[-pi:0.01:pi];
xc1=(bodyIns(6))*cos(i)+cirtrans;
yc1=(bodyIns(6))*sin(i)+bodyIns(6);
circlet= line(xc1,yc1);
set(circlet, {'Color'},{'r'});
cirtrans= cirtrans+xtrans;
%身體座標
bodyMatrix2(1,:)=bodyMatrix(1,:)+l*xtrans; %平
bodyMatrix2(2,:)=bodyMatrix(2,:);
bodyArrx=[bodyMatrix2(1,1) bodyMatrix2(1,2)];%身x
bodyArry=[bodyMatrix2(2,1) bodyMatrix2(2,2)];%身y
drawB1= line(bodyArrx,bodyArry);
bodyArrx2=[bodyMatrix2(1,1) bodyMatrix2(1,3),bodyMatrix2

(1,1) bodyMatrix2(1,4)];%腿x
bodyArry2=[bodyMatrix2(2,1) bodyMatrix2(2,3),bodyMatrix2

(2,1) bodyMatrix2(2,4)];%腿y
drawB2= line(bodyArrx2,bodyArry2);
bodyArrx3=[bodyMatrix2(1,5) bodyMatrix2(1,6),bodyMatrix2

(1,5) bodyMatrix2(1,7)];%手x
bodyArry3=[bodyMatrix2(2,5) bodyMatrix2(2,6),bodyMatrix2

(2,5) bodyMatrix2(2,7)];%手y
drawB3= line(bodyArrx3,bodyArry3);
%頭
xh1=(bodyIns(7)*2)*cos(i)+l*xtrans+bodyMatrix(1,8);
yh1=(bodyIns(7)*2)*sin(i)+bodyMatrix(2,8);
head= line(xh1,yh1);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%人體和外切圓繪製結束

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%旋轉%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%
bodyMatrix(2,:) = bodyMatrix(2,:)-bodyIns(6);
%for p=1:1:7
% bodyMatrix(:,p)=tr*bodyMatrix(:,p);
% end
bodyMatrix=bodyMatrix';
ang=[theta]*d2r;
t=ang(1);
sint=sin(t);cost=cos(t);
tt(1,1)=cost;tt(1,2)=sint;
tt(2,1)=-sint;tt(2,2)=cost;
bodyMatrix=bodyMatrix*tt;
bodyMatrix=bodyMatrix';
bodyMatrix(2,:) = bodyMatrix(2,:)+bodyIns(6);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%旋轉結束%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end
%標註
xlabel('x-axis');
ylabel('y-axis');
title('Homework P3.3 單位:cm 作者:歐陽太閒');
axis equal;%座標軸等距
%homework P3.3結束
--
歐陽太閒作業三結束

2 則留言:

不留白老人 提到...

花很多時間,而且做得很好。有幾點意見做參考:
1. 人的拳頭做上下運動時,實際上動作應是手臂所引起,所以可以考慮以手臂之轉動角度即可,例如由30度至90度,此時手腕上的桊頭因為連動,且必須在頭頂中央線移動,故即可算出其對應角度。
2. 第三題之旋轉做得比較複雜。通常只要將人形之座標點出,並設法在原點處與外圓連接成為一線畫,再進行迴轉即可。
3.由於圓係滾動,故每迴轉一個角度,其弧長等於圓心往前移動的距離。座標的變化即可由此產生。

th86 提到...

謝謝老師的指教