Team 24 - Appendix
Bill of Materials
Kinematics Analysis MATLAB Code
% Kinematics for a 6-bar dart-throwing mechanism
options = optimoptions('fsolve');
options.MaxFunctionEvaluations = 3000;
% Variables
a = 100; %mm
b = 106.2004; %mm
c = 73.5197; %mm
d = 147.9; %mm
e = 168.5669; %mm
f = 114.3607; %mm
g = 150.0372; %mm
h = 183.9870; %mm
i = 149.2967; %mm
k = 218.8758; %mm
alpha = deg2rad(52.0939); %deg2rad
beta = deg2rad(165.8153); %deg2rad
gamma = deg2rad(7.36); %deg2rad
theta_1 = deg2rad(354.902); %deg2rad
omega_1 = 0; %rad/s
steps = 720;
% Test for "home position"
theta_2 = deg2rad(88.7044); %deg2rad
F = @(x) [x(6) - x(3) + alpha;
x(4) - x(1) - beta + pi;
a*cos(theta_2)+b*cos(x(1))-c*cos(x(2))-d*cos(x(3))-e*cos(theta_1);
a*sin(theta_2)+b*sin(x(1))-c*sin(x(2))-d*sin(x(3))-e*sin(theta_1);
d*cos(x(3))+c*cos(x(2))+f*cos(x(4))-g*cos(x(5))-h*cos(x(6));
d*sin(x(3))+c*sin(x(2))+f*sin(x(4))-g*sin(x(5))-h*sin(x(6))];
x0 = [pi/4 pi 3*pi/4 pi/4 3*pi/4 pi/4];
solution = fsolve(F,x0,options);
angle = [theta_1, theta_2, solution];
angles_deg = rad2deg(angle);
% Pre-allocation
angles = zeros(steps,8);
velocities = zeros(steps,8);
v_p = zeros(steps,1);
for i = 1:steps+1
disp(i)
theta_2 = 2*pi-(i-1)*2*pi/steps;
Fx = @(x) [x(6) - x(3) + alpha;
x(4) - x(1) - beta + pi;
a*cos(theta_2)+b*cos(x(1))-c*cos(x(2))-d*cos(x(3))-e*cos(theta_1);
a*sin(theta_2)+b*sin(x(1))-c*sin(x(2))-d*sin(x(3))-e*sin(theta_1);
d*cos(x(3))+c*cos(x(2))+f*cos(x(4))-g*cos(x(5))-h*cos(x(6));
d*sin(x(3))+c*sin(x(2))+f*sin(x(4))-g*sin(x(5))-h*sin(x(6))];
if i == 1
x0 = [pi/2 5*pi/4 pi/2 pi/2 pi pi/4];
else
x0 = solutionx;
end
solutionx = fsolve(Fx,x0,options);
angles(i,:) = [theta_1, theta_2, solutionx];
end
angles = flip(angles,1);
for i = 1:steps+1
disp(i)
omega_2 = 1;
Fv = @(x) [x(6) - x(3);
x(4) - x(1);
a*omega_2*cos(angles(i,2))+b*x(1)*cos(angles(i,3))-c*x(2)*cos(angles(i,4))-d*x(3)*cos(angles(i,5));
-a*omega_2*sin(angles(i,2))-b*x(1)*sin(angles(i,3))+c*x(2)*sin(angles(i,4))+d*x(3)*sin(angles(i,5));
d*x(3)*cos(angles(i,5))+c*x(2)*cos(angles(i,4))+f*x(4)*cos(angles(i,6))-g*x(5)*cos(angles(i,7))-h*x(6)*cos(angles(i,8));
-d*x(3)*sin(angles(i,5))-c*x(2)*sin(angles(i,4))-f*x(4)*sin(angles(i,6))+g*x(5)*sin(angles(i,7))+h*x(6)*sin(angles(i,8))];
if i == 1
x0 = [0 0 0 0 0 0];
else
x0 = solutionv;
end
solutionv = fsolve(Fv,x0,options);
velocities(i,:) = [omega_1, omega_2, solutionv];
v_p(i) = sqrt((a*velocities(i,2)*cos(angles(i,2))+k*velocities(i,3)*cos(angles(i,3)-gamma))^2 + (-a*velocities(i,2)*sin(angles(i,2))-k*velocities(i,3)*sin(angles(i,3)-gamma))^2);
end
% Plot angles vs theta_2
hold on
plot(rad2deg(angles(:,2)),rad2deg(angles(:,3)),'-k')
plot(rad2deg(angles(:,2)),rad2deg(angles(:,4)),'-r')
plot(rad2deg(angles(:,2)),rad2deg(angles(:,5)),'-y')
plot(rad2deg(angles(:,2)),rad2deg(angles(:,6)),'-g')
plot(rad2deg(angles(:,2)),rad2deg(angles(:,7)),'-b')
plot(rad2deg(angles(:,2)),rad2deg(angles(:,8)),'-c')
legend(['\theta_3'; '\theta_4'; '\theta_5'; '\theta_6'; '\theta_7'; '\theta_8'])
xlim([0 360])
title('Link angles vs. Input angle')
xlabel('\theta_2 (deg)')
ylabel('Link angles (deg)')
hold off
% Plot angular velocities vs theta_2
figure
hold on
plot(rad2deg(angles(:,2)),velocities(:,3),'-k')
plot(rad2deg(angles(:,2)),velocities(:,4),'-r')
plot(rad2deg(angles(:,2)),velocities(:,5),'-y')
plot(rad2deg(angles(:,2)),velocities(:,6),'-g')
plot(rad2deg(angles(:,2)),velocities(:,7),'-b')
plot(rad2deg(angles(:,2)),velocities(:,8),'-c')
legend(['\omega_3'; '\omega_4'; '\omega_5'; '\omega_6'; '\omega_7'; '\omega_8'])
xlim([0 360])
title('Angular velocities vs. Input angle')
xlabel('\theta_2 (deg)')
ylabel('Angular velocities (rad/s)')
hold off
% Plot output velocity vs theta_2
figure
hold on
plot(rad2deg(angles(:,2)),v_p,'-r')
xlim([0 360])
title('Output speed vs. Input angle')
xlabel('\theta_2 (deg)')
ylabel('Output speed (mm/s)')
hold off
Welcome to the University Wiki Service! Please use your IID (yourEID@eid.utexas.edu) when prompted for your email address during login or click here to enter your EID. If you are experiencing any issues loading content on pages, please try these steps to clear your browser cache.