Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

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 related the input angle (bicep angle) to 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 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 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 was a good solution, but by testing the pair of link lengths in SolidWorks, it did not simulation the motion we wanted and 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 problem.

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');
           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;
    v2y = y2 - y3;
end

 

Exo-Ballers Homepage

  • No labels