# Members

## The Actual Arm and the Design it drew: A Circle Inscribed in a Square

There really is a circle in a square. I swear. ## MatLab Code for Physical Model

%[thetaA, thetaB] = inverseKinematicsfunction(4.5, 3.75,6.5,-1.5);

% This script takes input from the user and uses it to test the function % gotoAngles

s=instrfind;  %Find any serial links (we can have only 1) delete(s);  %... and delete. %Create a new serial communications link s=serial('COM1','Baudrate',115200,'Terminator','CR'); fopen(s);  %... and open it

% set pulsewidth on channels 1 & 2to 1500 microseconds (over 200 mS) fprintf(s,'#1P1500#2P1500T200');

%Draw and animate the arm; numPts = 20;  %the number of points in the animation phi = linspace(0,2*pi,numPts);  %angle goes from 0 to 2*pi.

x0=6.5;  %Define center (x0,y0) of circle and radius (r) y0=0; r=1.06066;

% loop through all the values of phi for i=1:length(phi), x2=x0+r*cos(phi(i)); %x2 and y2 trace out a circle. y2=y0+r*sin(phi(i));

%First do inverse kinematics to find angles... la=4.5; lb=3.75; [theta_a, theta_b]= inverseKinematicsfunction(la, lb, x2, y2);

%Then do forward kinematics to find arm locations. %[xa ya xb yb] = forwardKinematics(la, lb, theta_a, theta_b);

pause(0.1);  %delay 1/10 second

gotoAngles(s,theta_a,theta_b-theta_a,750);

end

%Draw and animate the arm; numPts = 10;  %the number of points in the animation

x2=linspace(6.5+r,6.5+r,numPts)  %generate an array of x2 ... y2=linspace(r,-r,numPts)  %... and y2 values to define a line.

% loop through all the values of x2 and y2 for i=0:numPts, x2=6.5+r y2=r-(i*(2*r/numPts))

%First do inverse kinematics to find angles... la=4.5; lb=3.75;

[theta_a, theta_b]= inverseKinematicsfunction(la, lb, x2, y2);

pause(0.1);  %delay 1/10 second

gotoAngles(s,theta_a,theta_b-theta_a,750); end

%Draw the second side; numPts = 10;  %the number of points in the animation x2=linspace(6.5+r,6.5-r,numPts)  %generate an array of x2 ... y2=linspace(-r,-r,numPts)  %... and y2 values to define a line.

% loop through all the values of x2 and y2 for i=1:length(x2),

%First do inverse kinematics to find angles... la=4.5; lb=3.75;

[theta_a, theta_b]= inverseKinematicsfunction(la, lb, x2(i), y2(i));

pause(0.1);  %delay 1/10 second

gotoAngles(s,theta_a,theta_b-theta_a,750); end

%Draw the third side; numPts = 10;  %the number of points in the animation x2=linspace(6.5-r,6.5-r,numPts)  %generate an array of x2 ... y2=linspace(-r,r,numPts)  %... and y2 values to define a line.

% loop through all the values of x2 and y2 for i=1:length(x2),

%First do inverse kinematics to find angles... la=4.5; lb=3.75;

[theta_a, theta_b]= inverseKinematicsfunction(la, lb, x2(i), y2(i));

pause(0.1);  %delay 1/10 second

gotoAngles(s,theta_a,theta_b-theta_a,750); end

%Draw the fourth side; numPts = 10;  %the number of points in the animation x2=linspace(6.5-r,6.5+r,numPts)  %generate an array of x2 ... y2=linspace(r,r,numPts)  %... and y2 values to define a line.

% loop through all the values of x2 and y2 for i=1:length(x2),

%First do inverse kinematics to find angles... la=4.5; lb=3.75;

[theta_a, theta_b]= inverseKinematicsfunction(la, lb, x2(i), y2(i));

pause(0.1);  %delay 1/10 second

gotoAngles(s,theta_a,theta_b-theta_a,750); end