## To simulate forward kinematics of 2R robotic arm

Introduction:

Forward kinematics refers to the use of the kinematic equations of a robot to compute the position of the end-effector from specified values for the joint parameters.

Code:

Programe to simulate forward kinematics of 2R robotic arm.

%forward kinematics of 2R robotic arm

clear all
close all
clc

% Input
theta1=linspace(0,90,4);
theta2=linspace(0,90,4);
l1=1;
l2=0.5;
THETA1=45;
THETA2=20;

ct=1
for i=1:length(theta1)
THETA1=theta1(i);
for j=1:length(theta2)
THETA2=theta2(j);
x0=0;
y0=0;

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

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

% Plot
plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',3);
pause(0.6);
axis([-0.1 1 0 1.5])

%q(ct)=getframe(gcf);
text=sprintf("forward_kinematics%d.png",ct+1);
saveas(1,text)
ct=ct+1;

end
end



Explanation of code:

1. In our programe we have considered two links in robotic arm for simulation (x0,y0)&(x1,y1) are start and end possition of link 1 and (x1,y1) & (x2,y2) are start and end possition of link2.

theta is an array of angle whereas THETA is instantaneous value of angle.

3.Plot the possition of link 1 and link 2 by stating respective co-ordinates.

4.Here in this case  we are using octave hence used command sprintf to save file name.

5.To make gif file in octave download and instal image magick and open command prompt window type cd to change directory then type dir to check directory.

6.Now type magick *.png output.gif

means all the files with .png extension will convert to .gif file with file name 'output'.

Error:

1.Image obtained as output are ovelaping.

2.All the images of link 1 and link 2 are obtained in single images.

Steps taken to overcome error:

1.use hold on to get separate images.

2.use pause to pause the code for some interval and will get separate images after specific interval of time.

### Simulation of Flow through a pipe in OpenFoam part 1 Piyush Misar · 2020-02-20 08:37:36

Objective: Write a program in Matlab that can generate the computational mesh automatically for any wedge angle and grading schemes. Simulate the velocity profile of fully developed flow at different positions along the length of the pipe.   Theory: Hydrod Read more

### FVM Literature Review Piyush Misar · 2020-02-13 09:29:38

Aim: Describe the need for interpolation schemes and flux limiters in FVM.    Theory: Finite volume method (FVM):   The Finite volume method (FVM) is a method for representing and evaluating partial differential equation. In the form of algebraic equa Read more

### BlockMesh Drill down challenge in OpenFoam Piyush Misar · 2020-02-06 09:15:06

Aim:     To simulate the flow through a backward facing step using the icoFOAM solver.Create multiple meshes and compare the results obtained from each mesh. Objective: How does the velocity magnitude profile change as a function of mesh grading fact Read more

### Solving the steady and unsteady 2D heat conduction problem Piyush Misar · 2019-12-12 08:31:45

Objective:  Write a programe to Solve the 2D heat conduction equation by using Transient solver and a Steady state solver using Iterative technique. Theory: 2 D Temperature Heat Conduction Equation: Transient form,        &nb Read more

### 1 D linear convection Piyush Misar · 2019-12-04 08:35:33

Objective:    Write the program to solve 1 D linear convection problem. Given: Assume that the domain length is L = 1m. The initial velocity profile is a step function. It is equal to 2m/s between x= 0.1 and 0.3 and 1m/s everywhere else. Constant Veloci Read more

### Data analysis in python Piyush Misar · 2019-11-01 08:50:24

Objective: Data visualizer Your script should take column numbers as the input and plot the respective columns as separate images Each file should be saved by the name of the column The plot labels should be extracted from the file. If, I request for a plot betwee Read more

### Breaking Ice with Air cushion Vehicle - Find minimum pressure with Newton-Raphson method Piyush Misar · 2019-10-25 10:40:31

Objective:  Write a code to solve given equation by using Newton Raphson method. 1.Use relaxation factor of 1 and explain your results. 2.How will you choose the optimum relaxation factor for this case? and what is the optimum relaxation factor for thi Read more

### Solving second order ODE in python Piyush Misar · 2019-10-15 09:37:35

Objective:   Write a program to simulate the transient behaviour of a simple pendulum and to create an animation of it\'s motion. Introduction:      A simple pendulum is defined to have an object that has a small mass, also known as the pendu Read more

### Otto cycle simulator using Python Piyush Misar · 2019-10-14 00:05:54

Objective: 1.Write a programe to plot P-V diagram for Otto cycle. 2.Calculate Thermal efficiency for otto cycle.   Introduction:     Otto cycle is gas power cycle on which Spark ignition engine works.It consist of four processes Process 1-2: Is Read more

### 2R Robotic Arm Simulator Piyush Misar · 2019-10-10 07:35:59

Objective:   Write a Program to simulate forward kinematics of a 2R Robotic Arm. Introduction:                       A robotic arm  is a type of mec Read more