A program in python to simulate the forward kinematics of a 2R Robotic Arm
link for youtube: https://youtu.be/j-6qQs_zUU4
Write a program in python to simulate the forward kinematics of a 2R Robotic Arm, as shown in the video.
Aim: simulate the forward kinematics of a 2R Robotic Arm
Problem statement : there is 2 link robotic arm which oscillates around theta1 and theta2.so we have to plot the animation of this.
Problem solution:
link length
l1=1
l2=0.5
no.of theta values
n_theta=10
start and end value for theta
theta_start=0
theta_end=(math.pi)/2
empty array for theta1 and theta2
theta1=[]
theta2=[]
running the for loop for creating theta1 and theta2 value
tmp=`theta+i*(thetaend-theta)/(n_theta-1)`
adding vaules in theta1 and theta2
x and y value for ground
x0=0
y0=0
to save image in standrad name (1 to 100)
ct=1
for t1 in theta1:
for t2 in theta2:
end of link1 nd start of link 2
x1=l1*math.cos(t1)
y1=l1*math.sin(t2)
end of link2 and manipulator
x2=x1+l2*math.cos(t1)
y2=x2+l2*math.sin(t2)
#saving file name in systematic way
filename=str(ct)+'.png'
animating the link 1 and link2 postions
results : it is clealy shown in animation that the link arm changes with the varying angle.