# Difference between revisions of "Robotic Arm: Team Stealth Squad"

Line 36: | Line 36: | ||

%Define the arm | %Define the arm | ||

la=4.5; lb=4.3025; | la=4.5; lb=4.3025; | ||

− | + | ||

%Draw and animate the arm; | %Draw and animate the arm; | ||

numPts = 20; %the number of points in the animation | numPts = 20; %the number of points in the animation | ||

phi = linspace(0,2*pi,numPts); %angle goes from 0 to 2*pi. | phi = linspace(0,2*pi,numPts); %angle goes from 0 to 2*pi. | ||

− | + | ||

clf % clear the figure. | clf % clear the figure. | ||

− | + | ||

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

y0=7; | y0=7; | ||

r=1; | r=1; | ||

− | + | ||

% loop through all the values of phi | % loop through all the values of phi | ||

for i=1:length(phi), | for i=1:length(phi), | ||

x2=x0+r*cos(phi(i)); %x2 and y2 trace out a circle. | x2=x0+r*cos(phi(i)); %x2 and y2 trace out a circle. | ||

y2=y0+r*sin(phi(i)); | y2=y0+r*sin(phi(i)); | ||

− | + | ||

%First do inverse kinematics to find angles... | %First do inverse kinematics to find angles... | ||

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

− | + | ||

%Then do forward kinematics to find arm locations. | %Then do forward kinematics to find arm locations. | ||

[xa ya xb yb] = forwardKinematics(la, lb, theta_a, theta_b); | [xa ya xb yb] = forwardKinematics(la, lb, theta_a, theta_b); |

## Revision as of 13:40, 17 November 2008

**Team Stealth Squad:**

## Contents

## Overview

Our team created a dual-jointed robotic arm that would hold a pencil and draw a circle within a square within another circle. To do this we used a variety of Lynxmotion parts from the Engineering Lab classroom. The arm is attached to a surface using a c-clamp and is moved using two servo motors. The motors are controlled through a circuit board run with Matlab code. After calibrating the motors we went about creating an arm using aluminum tubes, servo brackets, and hubs. We initially used long (4"-6")tubes for the "upper arm" segment of our robotic arm, however this caused poor distibution of mass and led to an unbalanced and shaky product. Our final construct used 2" tubes for both segments of our robotic arm. After constructing the arm our team began to work on making a SolidWorks Model and creating Matlab commands that would control the arm and run the functions which we wanted with appropriate scale, speed, and accuracy.

## Solid Works

- Our SolidWorks model shows the basic design and assembly of our robotic arm.

- Fastners, pencil, and c-clamp are not included.

- The SolidWorks file was created after completion of the physical arm.

- It is thus more of a model/simulation than a design aid.

## Matlab

### Simulation

%Define the arm la=4.5; lb=4.3025; %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. clf % clear the figure. x0=0; %Define center (x0,y0) of circle and radius (r) y0=7; r=1; % 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... [theta_a, theta_b]= InverseKinematics(la, lb, x2, y2); %Then do forward kinematics to find arm locations. [xa ya xb yb] = forwardKinematics(la, lb, theta_a, theta_b); subplot(1,2,1); %generate 1x2 plots, choose plot 1 plot([0 xa xb],[0 ya yb],'b','LineWidth',2); axis([-10 10 0 10]); subplot(1,2,2); %choose second plot plot(xb,yb,'ro') %plot red circle axis([-10 10 0 10]); hold on; %don't erase this plot. pause(0.1); %delay 1/10 second end

This code simulates our robotic arm drawing a circle in MatLab. The code is essentially the same as the simulation from MatLab Lab 1, only with the arm lengths changed to correspond with the arm lengths of our robot.