Appendix Group 14

Appendix A: Bill of Materials


Appendix B: Position of Cups Animation

Units are in mm.


Appendix C: Velocity Analysis of Links 3 and Links 4


Appendix D: Position and Velocity Analysis Code

% Variable initiation

clear

l=[135, 240, 145, 235];

a=l(4);

b=l(1);

c=l(2);

d=l(3);

theta1=90;

theta2=240:-1:60;

theta3n=[];

theta4n=[];

thetas=[];

thetacup=10;

linkcup=160;

cup1x=[];

cup1y=[];

cup2x=[];

cup2y=[];

%assume omega 2 is counstant at 1

omega2=1;

omega3=[];

omega4=[];

% -------------------------------------------------------------------------

% fourbarpos position analysis

counter=1;

for n=0:180

    thetas=fourbarpos(l,theta1,theta2(counter),-1);

    theta3n=[theta3n thetas(3)];

    theta4n=[theta4n thetas(4)];

    counter=counter+1;

end

% -------------------------------------------------------------------------

% Velocity Analysis

counter=1;

for n=0:180

    if n>=120 || n<=60

        omega2=0.25;

    else

        omega2=0.5;

    end    

    omega3=[omega3 a*omega2/(b*(sind(theta4n(counter)-theta2(counter)))/(sind(theta3n(counter)-theta4n(counter))))];

    omega4=[omega4 a*omega2/(c*(sind(theta2(counter)-theta3n(counter)))/(sind(theta4n(counter)-theta3n(counter))))];

    counter=counter+1;

end

% -------------------------------------------------------------------------

% Position of cup

counter=1;

for n=0:180

    cup1x=[cup1x a*cosd(theta2(counter))+linkcup*cosd(theta2(counter)+thetacup)];

    cup1y=[cup1y a*sind(theta2(counter))+linkcup*sind(theta2(counter)+thetacup)];

    counter=counter+1;

end

for n=0:180

    cup2x=[cup2x -cup1x(181-n)];

    cup2y=[cup2y cup1y(181-n)];

    counter=counter+1;

end

%% plotting

% relationship between link 2 and link 3

figure(1)

plot(theta2,theta3n)

title("Angle between link 2 and link 3")

xlabel("theta2")

ylabel("theta3")

grid()

%relationship between angle of link 2 and angular velocity of link 3

%(assume motor speed of 1 rad/sec

figure(2)

plot(theta2,omega3)

title("Angle of link 2 and Angular Velocity of link 3")

xlabel("theta2")

ylabel("omega3")

grid()

%relationship between angle of link 2 and angular velocity of link 4

figure(3)

plot(theta2,omega4)

title("Angle of link 2 and Angular Velocity of link 4")

xlabel("theta2")

ylabel("omega4")

grid()

%relationship of where the cups are

figure(4)

for i=1:5

    for k = 1:length(cup1x)

        clf(4);

        hold on;

        plot(cup2x(k),cup2y(k),'o','MarkerSize',5,'MarkerFaceColor','r');

        plot(cup1x(k),cup1y(k),'o','MarkerSize',5,'MarkerFaceColor','g');

        title("Position of each Cup")

        grid()

        xlim([-400,400])

        ylim([-400,400])

        drawnow; pause(0.001);

        hold off;    

    end

    pause(2)

end


Appendix E: Function fourbarpos() in Code

function [theta] = fourbarpos(l,theta1,theta2,configuration)

    a=l(2);

    b=l(3);

    c=l(4);

    d=l(1);

    k1=d/a;

    k2=d/c;

    k3=(a^2-b^2+c^2+d^2)/(2*a*c);

    k4=d/b;

    k5=(c^2-d^2-a^2-b^2)/(2*a*b);

    revisedtheta2=(theta2-theta1);

    A=cosd(revisedtheta2)-k1-k2*cosd(revisedtheta2)+k3;

    B=-2*sind(revisedtheta2);

    C=k1-(k2+1)*cosd(revisedtheta2)+k3;

    D=cosd(revisedtheta2)-k1+k4*cosd(revisedtheta2)+k5;

    E=-2*sind(revisedtheta2);

    F=k1+(k4-1)*cosd(revisedtheta2)+k5;

    if configuration==1

        theta4a=sqrt(B^2-4*A*C);

        theta4=2*atand((-B+theta4a)/(2*A));

        theta3a=sqrt(E^2-4*D*F);

        theta3=2*atand((-E+theta3a)/(2*D));

    else

        theta4a=sqrt(B^2-4*A*C);

        theta4=2*atand((-B-theta4a)/(2*A));

        theta3a=sqrt(E^2-4*D*F);

        theta3=2*atand((-E-theta3a)/(2*D));

    end

    theta=[theta1,theta2,theta3+theta1,theta4+theta1];

end