Challenge

Week 2- 2R Robotic Arm Challenge

AIM:To simulate the 'forward kinematics ' of a 2r robotic arm usong metalab

OBJECTIVE:

  • write a program to simulate the 'forward kinematics ' of a 2r robotic arm .
  • animating and creating movie from the plot obtined from programme.

THEORY:A manipulator /end movement determines the workspace where the robotic arm ca be applicable ,our aim is to animate the robotic arm with subsequent motion between the two -comprising links

inputs:(x0 y0)=startong point of link 1

(x1 y1)= ed point of link 1

(x2 y2)=emd point of link 2

l1=lenth of link attached to base

l2=lentgh of lik between the first link and end of actuator

theta1=angle made by link 1 with x axis

theta2=angle made by ink 2 with x axis

EXPLANATION :

  • first we define length of robotic arm-l1 and
  • set value for theta 1 and theta 2 are assiged in array by linspace command
  • ploting all coordinate values
  • all fig. assigned by variable M one at time using ct followed by termination or loop
  • lastly creating movie so movie command used
  • videowriter command used for write a video and save in avi format by using 'avi'
  • open command use for open that video
  • finally close video, use close command.

Matalab code:

close all
clear all
clc
%input
l1=1;
l2=0.5;
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);
        %cordinate
        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.03)
        M(ct)= getframe(gcf);
        ct= ct+1;

    end
    
        
end
%making video file

movie(M)

videofile= VideoWriter('forward_kinematics.avi');
open(videofile)
writeVideo(videofile,M)
close(videofile)

       

ERROR: no error faced while pogramming

ANIMATION LINK:here is a animation link of forward 2r arm

https://youtu.be/VWZzoZMg6tw

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.