Program in MATLAB/OCTAVE to simulate the forward kinematics of a 2R Robotic Arm
Program in MATLAB/OCTAVE to simulate the forward kinematics of a 2R Robotic Arm.
Kinematics is a branch of classical mechanics that describes the motion of points, bodies (objects), and systems of bodies (groups of objects) without considering the forces that cause the motion.
Robots: a machine resembling a human being and able to replicate certain human movements and functions automatically.
Robotic arm considered a two arm link that move as per programed
Link one as specified length in program in meter
Link two as specified length in program in meter
Both link have manupulated with particular angles may be defined as THETA1,THETA2=theta1,theta2
Most of robotic arm used in industrial nd medical surgical, and much more in defence purpose....
Code description:
Robotic arm movement programed in OCTAVE software
As following code showed and robotic arm of 3d model also showed in figure with plot
close all % close all open window
clear all %clear all previous values
clc %clear all screen editor/ command window
%Define parameter and initial conditions
l1=3; %First arm length in meter
l2=1; %Second arm length in meter
ct=1; %Counter count default value set as one
theta1=linspace(0,180,10); %In between range can move arm
theta2=linspace(0,180,10); %In between range can move arm
%Loooping to get all value at end of the results
for i=1:length(theta1) %Assign value to i through no. iteration
THETA1=theta1(i); %Replacing the value to another variable
for j=1:length(theta2) %Assign value to j through no. iteration
THETA2=theta2(j); %Replacing the value to another variable
x0=0; %Starting point of first link arm (x0,y0)=(0,0)
y0=0;
x1=l1*cosd(THETA1); %Arm first end value through x-axis
y1=l1*sind(THETA1); %Arm first end value through y-axis
x2=x1+l2*cosd(THETA2); %Arm two end point value through along x-axis
y2=y1+l2*sind(THETA2); %Arm two end point value through along y-axis
%plotting displaying the results
line([x0 x1],[y0 y1],'linewidth',1,'color','y') %Show ploting results
line([x1 x2],[y1 y2],'linewidth',1,'color','g') %Show ploting results
xlabel=('Arm move along x-axis'); %Labeling of axis
ylabel=('Arm move along y-axis'); %Labeling of axis
pause(1); %Freeze frame as per time frame
M(ct)=getframe(gcf); %Capture current figure for each count
ct=ct+1; %Adding value in each count
end % First for loop close
end % Second for loop close
Movie(M) %Generate a movie from merging all frame in array
videofile=Videowriter('aaa.avi','uncompressed AVI'); %Mention file name
open(videofile) %After video made, open it.
writeVideo(videofile,M) %Write animation to the video file.
close(videofile %Close after animation is done of playing.
Note:
Inthese just not get any video as output then im screecast to used to shoot video by another software