Challenge

Week 2- 2R Robotic Arm Challenge

Aim - To operate robotics arm using matlab program animation

Mathamatical formula-

Starting Point- x=0 ,y=0

Midpoint x1=l1*cosd(THETA1)

y1=l1*sind(THETA1)

Endpoint x2=x1+l2*cosd(THETA2)

y2=y1+l2*sind(THETA2)

Formula discription-

cosd,sind=In this formula d use for degree input

x=0,y=0 starting point of robotics arm link 1

x1,y1 end point of robotics arm link1

x2,y2 end point of robotics arm link2

Theta1=Input degree of robotics arm link 1

Theta2=Input degree of robotics arm link

Linspace=using this command to find out same 10 values between 0 to 90 degree

for loop= It use for determin seperate degree of rotation between THETA1 & THETA2

i=1:length(theta1)=this command shows no of rotations & duration for i value,THETA1=theta(i)

j=1:length(theta2)=this command shows no of rotations & duration for j value,THETA2=theta(j)

axis=is this command shows to limitaions of animation screen

pause(0.3)=duration period of robotics arm

M(ct)=M is array ,ct shows each frame in the programme

getframe(gcf)=gcf =get current frame of program

nter

*this error overcome by using plot command

line command is not suited for this type of situvations because its showing many lines and so lenthly

ct=ct+1 to increment the counter 1 by 1

* this error solved by using four element axis value

*this error overcome by using (') in robotics _arm _avi

clear all
close all
clc

%inputs
theta1=linspace(0,90,10);
theta2=linspace(0,90,10);
ct=1;
for i=1:length(theta1)
    THETA1=theta1(i);
   for j=1:length(theta2)
       THETA2=theta2(j);
    l1=1;
    l2=0.5;
    %co-ordinates
     x0=0;
     y0=0;

      x1=l1*cosd(THETA1);
      y1=l1*sind(THETA1);

      x2= x1+l2*cosd(THETA2);
      y2= y1+l2*sind(THETA2);

  %plotting
   plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',3);
   axis([-0.1 1.5 0 1.5])
   pause(0.3)
   M(ct)=getframe(gcf);
   ct=ct+1;

   end
end
Movie9(M)
videofile=videowriter('robotics_arm_step2.avi','Uncompressed avi');
open(videofile)
writevideo(videofile,m)
close(videofile)

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.