8) Appendix Group 13
Our BOM and various supporting codes are found in here.
Bill of Materials:
- ½” Hex Shaft (x2)
- ½” Hex Bushings (x4, 3D Printed)
- Pinion Gear (x1, 3D Printed)
- 4:1 Step Gears (x2, 3D Printed)
- 5:1 Step Gears (x2, 3D Printed)
- 100 RPM Greartisan DC motor (x1)
- 8-32 bolts and locknuts (x14 of each)
- Chassis Panels (laser-cut)
- Fourbar Linkages (x12 total, laser-cut)
- Acrylic Spacers (x12)
Code
Main Code
l = [4, 1, 4.2, 1.5];
theta_2 = -1:1:360;
omega_2 = 100;
% gear ratio
omega_output = omega_2/20;
len = length(theta_2);
% position analysis matrices
xRockerPos = zeros(1,len);
yRockerPos = zeros(1,len);
xArmPos = zeros(1,len);
yArmPos = zeros(1,len);
xHookPos = zeros(1,len);
yHookPos = zeros(1,len);
% mechanical advantage matrix
MA = zeros(1,len);
% velocity analysis matrices
RockerVelo = zeros(1,len);
HookVelo = zeros(1,len);
for i = 1:1:len
% disp(i);
[theta_3,theta_4] = fourbarpos(l,0,theta_2(i),-1);
% disp(theta_3);
% disp(theta_4);
xRockerPos(i) = l(4)*sind(theta_4-90);
yRockerPos(i) = l(4)*cosd(theta_4-90);
xArmPos(i) = (l(2)*cosd(theta_2(i)))+(l(3)+3.08)*cosd(theta_3);
yArmPos(i) = (l(2)*sind(theta_2(i)))+(l(3)+3.08)*sind(theta_3);
xHookPos(i) = (l(2)*cosd(theta_2(i)))+(l(3)+3.08)*cosd(theta_3)+((3.688)*cosd(theta_3-90));
yHookPos(i) = (l(2)*sind(theta_2(i)))+(l(3)+3.08)*sind(theta_3)+((3.688)*sind(theta_3-90));
MA(i) = FinalProject_MA_Function(l,0,theta_2(i));
[omega_3,omega_4] = fourbarvelo(l,0,theta_2(i), theta_3, theta_4, omega_output);
RockerVelo(i) = omega_4*l(4);
HookVelo(i) = omega_3*sqrt((xHookPos(i)^2)+(yHookPos(i)^2));
end
% figure(1)
% plot3(xRockerPos,yRockerPos,theta_2);
% title('Rocker Motion');
% xlabel('X-Position of Rocker (in)');
% ylabel('Y-Position of Rocker (in)');
% zlabel('Theta_2');
% grid on
% figure(2)
% plot3(xArmPos,yArmPos,theta_2);
% title('Arm Tip Motion');
% xlabel('X-Position of Arm End (in)');
% ylabel('Y-Position of Arm End (in)');
% zlabel('Theta_2');
% grid on
figure(3)
plot3(xHookPos,yHookPos,theta_2);
title('Hook Tip Motion');
xlabel('X-Position of Hook Tip (in)');
ylabel('Y-Position of Hook Tip (in)');
zlabel('Theta_2');
grid on
% view(0,90) % XY
% pause
% view(0,0) % XZ
% pause
% view(90,0) % YZ
figure(4)
plot(theta_2,MA)
title('Mechanical Advantage vs. Theta_2');
xlabel('Theta_2');
ylabel('Mechanical Advantage');
grid on
% figure(5)
% plot(theta_2,RockerVelo);
% title('Rocker Velocity vs. Theta_2');
% xlabel('Theta_2');
% ylabel('Rocker Velocity (in/s)');
% grid on
figure(6)
plot(theta_2,HookVelo);
title('Hook Velocity vs. Theta_2');
xlabel('Theta_2');
ylabel('Hook Velocity (in/s)');
grid on
“fourbarpos” Function
function [theta_3, theta_4] = fourbarpos(l,theta_1,theta_2,delta)
% define bar lengths
a = l(2);
b = l(3);
c = l(4);
d = l(1);
% theta_1_r = deg2rad(theta_1);
% theta_2_r = deg2rad(theta_2);
% define K values
K1 = d/a;
K2 = d/c;
K3 = ((a^2)-(b^2)+(c^2)+(d^2))/(2*a*c);
% calculate A B C
A = cosd(theta_2) - K1 - (K2*cosd(theta_2)) + K3;
B = (-2)*sind(theta_2);
C = K1 - ((K2+1)*cosd(theta_2)) + K3;
% calculate theta_4
theta_4 = 2*atand((-B+(delta*sqrt((B^2)-(4*A*C))))/(2*A));
% calculate theta_3
theta_3 = asind(((c*sind(theta_4))-(a*sind(theta_2)))/b);
% display angle values
% fprintf("Angle 3 = %.3f\n", theta_3);
% fprintf("Angle 4 = %.3f\n", theta_4);
“fourbarvelo” Function
function [omega_3, omega_4] = fourbarvelo(l,theta_1,theta_2, theta_3, theta_4, omega_2)
a = l(1);
b = l(2);
c = l(3);
d = l(4);
omega_3 = omega_2*(a/b)*((sind(theta_4-theta_2))/(sind(theta_3-theta_4)));
omega_4 = omega_2*(a/c)*((sind(theta_2-theta_3))/(sind(theta_4-theta_3)));
% fprintf("Omega 3 = %.3f\n", omega_3);
% fprintf("Omega 4 = %.3f\n", omega_4);
“FinalProject_MA_Function” Function
function [MA] = FinalProject_MA_Function(l,theta_1,theta_2)
% define bar lengths
a = l(1);
b = l(2);
c = l(3);
d = l(4);
% find MA for each angle step
L_BD = sqrt((b^2) + (a^2) - (2*b*a*cosd(theta_2)));
gamma = acosd(-((L_BD^2) - (c^2) - (d^2))/(2*c*d));
beta_1 = acosd(-((a^2) - (b^2) - (L_BD^2))/(2*b*L_BD));
beta_2 = acosd(-((d^2) - (c^2) - (L_BD^2))/(2*c*L_BD));
beta = beta_1 + beta_2;
MA = (d*sind(gamma))/(b*sind(beta));