From The motion capture data was used with a trend fit algorithm to come up with equations that represented each joint angle (shoulder, elbow, and wrist) with respect to time. Originally, we tried to optimize the link lengths with the CAD program SolidWorks. By performing a motion study to plot the motion capture data and then a design study to replicate this data, we thought we would be able to figure out the desired link lengths. However, to the best of our knowledge (based upon attempting this process), the program is not setup to optimize numerous parameters over a range of time. In other words, we could have optimized each link length at a given time interval. However, the program could not optimize these parameters at every moment throughout the range of motion of the basketball shot.
Instead, from the motion capture data, we developed equations that related each joint angle with each other. We used the vector loop equation of the six-bar mechanism to create equations the that related the input angle (bicep angle) to both the elbow angle and the wrist angle. With these equations, we wrote a script in Matlab to calculate the joint angle with varied link lengths. We had three constants in the equation, the input angle, the link length of the link that attached to the bicep, and the link length of the forearm. With six for-loops, we solved for the output angles and compared them to the desired angles. With this information we generated an error for each pair of link lengths. From the pairs that had the least error we found a solution that best matched the motion we wanted.
The program had some flaws though. There were some pair pairs of link lengths that did not have valid solutions for the entire range of motion, but more closely match the desired data and several points. To solve this, we had to weight weigh different points in the desired motion with an error function that had a higher error in points in the motion that we wanted to match more and lower error in parts of the motion we did not wish to match as match. A specific problem we had was with the bottom four-bar being a parallelogram. According to the program with this was a good solution, but by testing the pair of link lengths in SolidWorks, it did not simulation simulate the motion we wanted and at the end or beginning of the path. This is when we saw we needed an error function to weight the data.Originally, we tried to optimize the link lengths with the CAD program SolidWorks. By preforming a motion study and a design study, we thought we would be able to figure out the desired link lengths. But because of a lack a resources and a lack of time, we would unable to use SolidWorks to solve our problemweigh the data.
To improve upon this process, several things can be done. Because we used six for-loops, we were unable to have a large range of potential link lengths. If we implementation a simple form of machine learning, we could use a larger range of link lengths, and have a more precise answer. This method would also lower the calculation time. The script we wrote took about two hours to run. We could also develop a better error function to weight the data. Due to limited amount of time, we were unable to generate an error function for the desired motion. We could also use the curve fitting functions the Matlab provides to better improve our method.
...
function dataArray = plotData(filename)
hold all;
last = 0;
temp = 1;
i = 1;
plotAll = 0;
plotAngle = 1;
lastAngle = 90;
dataArray = zeros(45000/8,1);
data = xlsread(filename);
while i < 45000
if plotAll == 1
x = data(i,2);
y = data(i,3);
plot(x,y,'g');
dataArray(1,temp) = x;
dataArray(2,temp) = y;
temp = temp + 1;
x = data(i+1,2);
y = data(i+1,3);
plot(x,y,'r');
dataArray(1,temp) = x;
dataArray(2,temp) = y;
temp = temp + 1;
x = data(i+4,2);
y = data(i+4,3);
plot(x,y,'y');
dataArray(1,temp) = x;
dataArray(2,temp) = y;
temp = temp + 1;
x = data(i+5,2);
y = data(i+5,3);
plot(x,y,'b');
dataArray(1,temp) = x;
dataArray(2,temp) = y;
temp = temp + 1;
x = data(i+6,2);
y = data(i+6,3);
plot(x,y,'k');
dataArray(1,temp) = x;
dataArray(2,temp) = y;
temp = temp + 1;
x = data(i+6,2);
y = data(i+6,3);
%plot(x,y);
dataArray(1,temp) = x;
dataArray(2,temp) = y;
temp = temp + 1;
i = i + 8;
end
if plotAngle == 1
% elbow angle
angle = getAngle(data,i+4,i+6,i+5,i+1);
plot(i,angle,'g');
% shoulder angle
angle = getAngle2(data,i+4,i+6);
angle = 180 - angle;
if angle < 0
angle = angle + 360;
end
plot(i,angle,'b');
%wrist angle
angle = getAngle(data,i+4,i+1,i+4,i+0);
angle = 180 - angle;
plot(i,angle,'r');
%error = abs(lastAngle - angle);
%if error > 30
%angle = lastAngle;
%end
%dataArray(temp,1) = real(angle);
%lastAngle = angle;
%temp = temp +1;
i = i + 8;
end
end
%xlswrite('angleDataE.xlsx',dataArray);
end
function angle = getAngle(data, point1, point2, point3, point4)
x1 = data(point1,2);
y1 = data(point1,3);
x2 = data(point2,2);
y2 = data(point2,3);
x3 = data(point3,2);
y3 = data(point3,3);
x4 = data(point4,2);
y4 = data(point4,3);
v1x = x1 - x2; % first vector components
v1y = y1- y2;
v2x = x4 - x3; % second vector componets
v2y = y4- y3;
mag1 = sqrt((v1x^2) + (v1y^2));
mag2 = sqrt((v2x^2) + (v1y^2));
dot = (v1x*v2x) + (v1y*v2y);
angle = acosd(dot/(mag1*mag2));
end
function angle = getAngle2(data, point1, point2)
x1 = data(point1,2);
y1 = data(point1,3);
x2 = data(point2,2);
y2 = data(point2,3);
vectorX = x2 - x1;
vectorY = y2 - y1;
angle = atan2d(vectorY,vectorX);
if angle < 0
angle = angle + 360;
end
end
function angle = getAngle3(data, point1, point2, point3)
x1 = data(point1,2);
y1 = data(point1,3);
x2 = data(point2,2);
y2 = data(point2,3);
x3 = data(point3,2);
y3 = data(point3,3);
v1x = x2 - x1;
v1y = y2 - y1;
v2x = x2 - x3;
...
-loops, we were unable to have a large range of potential link lengths. If we implementation a simple form of machine learning, we could use a larger range of link lengths, and have a more precise answer. This method would also lower the calculation time. The script we wrote took about two hours to run. We could also develop a better error function to weight the data. Due to limited amount of time, we were unable to generate an error function for the desired motion. We could also use the curve fitting functions the Matlab provides to better improve our method.
%shouder equation y=-0.000000000008647*t^5 + 0.00000002114*t^4 + -0.00001727*t^3 + 0.004471*t^2 + 0.1979 *t + -90.14
% start at 0-800
% elbow equation y = -1E-12x6 + 4E-09x5 - 6E-06x4 + 0.0047x3 - 1.7678x2 + 264.4x
% start at 620 - 974 180 at 695 - 925
% start at 400 - 1300
function matchData()
a = 10;
b2 = 10;
dataArray = zeros(1000,7);
temp = 1;
err = 0;
errSum2 = 0;
d = 2.5;
c = 9;
b = 2.5;
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);
for sigma = 30:1:60
for a2 = 0.5:0.2:3
for e = 8:0.25:9.75
for f = 0.5:0.2:3
for t = 0:1:500
theta2 = -0.000000000008647*(t^5) + 0.00000002114*(t^4) - 0.00001727*(t^3) + 0.004471*(t^2) + 0.1979*t - 90.14;
I = cosd(theta2);
%A = I-K1-K2*I+K3;
B = -2*sind(theta2);
%C = K1-(K2-1)*I+K3;
D = I-K1+K4*I+K5;
F = K1+(K4-1)*I+K5;
% G = (B^2)-(4*A*C);
H = (B^2) - (4*D*F);
theta3 = 2*atan2d(-B-sqrt(H),2*D);
%theta3 = angleBound(theta3);
theta6 = theta3 - sigma;
K1B = a2/b2;
%K2 = a2/e;
%K3 = ((b2^2)-(f^2)+(e^2)+(a2^2))/(2*b2*e);
K4B = a2/f;
K5B = ((e^2)-(a2^2)-(b2^2)-(f^2))/(2*b2*f);
I = cosd(theta6);
%A = I-K1-K2*I+K3;
B = -2*sind(theta6);
%C = K1-(K2-1)*I+K3;
D = I-K1B+K4B*I+K5B;
F = K1B+(K4B-1)*I+K5B;
% G = (B^2)-(4*A*C);
H = (B^2) - (4*D*F);
if H < 0;
errSum2 = errSum2 + 1;
else
theta7 = 2*atan2d(-B+sqrt(H),2*D);
%theta7 = angleBound(theta7);
if t < 40
dTheta7 = 16.5;
elseif t >= 40
dTheta7 = -0.000000004037*t + 0.000006638*t + -0.003932*t + 0.9682*t + - 16.07;
end
err = err + abs(theta7-dTheta7);
end
end
dataArray(temp,1) = a2;
dataArray(temp,2) = e;
dataArray(temp,3) = f;
dataArray(temp,4) = sigma;
dataArray(temp,5) = err;
dataArray(temp,6) = errSum2;
temp = temp + 1;
err = 0;
errSum2 = 0;
end
end
end
xlswrite('matchDataSixBarSome31.xlsx',dataArray);
end
end
Exo-Ballers Homepage