Challenge

Week 2- 2R Robotic Arm Challenge

Forward Kinematics Of 2R Robotic Manipulator Using MATLAB

Aim:

To make a code using Matlab software to run forward kinematics of 2R robotic manupulator and to get the results in ‘avi’ format

Objective:

The objective of coding is for the automation process, which increase the production with good accuracy

Application and use:

kinematics equation of a 2R robot is to compute the position of end effector from specified values for the joint parameters. If we know the geometry of the robot and all its joint points, we can do the math and figure out the position and orientation of any point on the robot. Robotic manipulators are capable of performing repetitive tasks at speeds and accuracies that far exceed those of human operators.

They are now widely used in manufacturing processes such as spot welding and painting. To perform their tasks accurately and reliably, manipulator hand (or end-effector) positions and velocities are controlled digitally.

Theoretical code explanation:

  • we are to construct a code that run a forward kinematics of two arm robotic manipulator usig Matlab.
  • %And to view the movements in a video format
  • Clear all is to clear workspace, close all is to close the program run and clc is to clear the command window
  • %input variables that required to run the code
  • Length(l1,l2,l3,l4..,) =length of the arm;
  • Theta (1,2,3,4..,) =degree parameters in different arm points
  • Command ‘ct’ is used to sequence and process the output figure with respect to time
  • We use for loop to repeat a set of commands with a desired limit
  • Here we use upper case THETA as variables and it won’t be treated as an array
  • To assign the functions for the variables x0,y0,x1,y1,x2,y2..,
  • Here we use addition to add two links Eg : x1+l2*cosd(THETA_1) this is to join two arms
  • Plot command is to plot the the values and get the the given values in figure window
  • Axis commend to fix the axis values in the figure plot [x,y]
  • Movie (movie) command to make the movements done by robotic manipulator and record it in a ‘AVI’ format
  • Videofile=videowriter(‘forward_kinematics.avi’); The avi will be saved in the name ‘forward_kinematics’
  • Open(videofile);
  • Writevideo(videofile,M);
  • Ciose(videofile);

Calculation:

Base point (x0,y0) =(0,0);

First point ((x0,x1),(y0,y1)) = l1

kinematic movement THETA1 in (cosd,sind)

x1=l1*cosd(THETA1),

y1=l1*sind(THETA1),

Second point((x1,x2),(y1,y2)) =l2

kinematic movement THETA2 in (cosd,sind)

X2=x1+l2*cosd(THETA2),

Y2=y1+l2*sind(THETA2),

Practical code in editor window:

clear all
close all
clc
%forward kinematics of a 2r robotic arm manupulator
%inputs
l1=1;
l2=0.5;
theta1=linspace(0,90,10);
theta2=linspace(0,90,10);
ct=1;
for i=1:length(theta1)
    THETA_1=theta1(i);
    for j=1:length(theta2)
    THETA_2=theta2(j);
    x0=0;
    y0=0;
    x1=l1*cosd(THETA_1);
    y1=l1*sind(THETA_1);
    x2=x1+l2*cosd(THETA_2);
    y2=y1+l2*sind(THETA_2);
    %plotting
    plot([x0,x1],[y0,y1],[x1,x2],[y1,y2],'linewidth',2);
    axis([-0.1 1.5 0 1.5])
    xlabel('x axis')
    ylabel('y axis')
    M(ct)=getframe(gcf);
    ct=ct+1;
    
    end
end
movie(M)
videofile=VideoWriter('forward_kinematics.avi');
open(videofile);
writeVideo(videofile,M);
close(videofile);

Result:

The result in ‘avi’ format that shows the movements of forward kinematic of robotic manipulator is done by using the software Matlab

The result video is presented in google drive link: https://drive.google.com/file/d/1MFLysD9bg3bOeRZwWEy_Wvi3ybGKK5eq/view?usp=sharing

Conclusion:

With the help of Matlab we did the code and result presentation through google drive link mentioned in result

We got the animation of forward kinematics of 2R robotic manipulator in ‘avi’ format sucessfully

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.