Project

2R Robotic Arm Simulator using Python

Youtube link: https://youtu.be/b9Jhyk6Zqbw

# forward kinematics animation
import matplotlib.pyplot as plt
import math as m
import numpy as np
import os 

# Inputs
l1 = 2
l2 = 1
x0 = 0
y0 = 0
theta1 = np.linspace(0,(m.pi/2),10)
theta2 = np.linspace(0,(m.pi/2),10)
count =1

os.makedirs(\'2r_robot_images\') 
os.chdir(\'C:/Users/Venki_LFC/Documents/Study/Python/2r_robot_images\')
for angles1 in theta1:
    for angles2 in theta2:
        
        x1 = l1*m.cos(angles1)
        y1 = l1*m.sin(angles1)

  
        x2 = x1+ l2*m.cos(angles2)
        y2 = y1+ l2*m.sin(angles2)

        
        filename = str(count)+\'.png\' 
        

        plt.figure() 
        plt.plot([x0,x1],[y0,y1])
        plt.plot([x1,x2],[y1,y2])
        plt.title(\'2R Robotic Arm\')
        plt.xlim([0,3]) 
        plt.ylim([0,3]) 
        plt.savefig(filename) 
        count = count+1   

os.chdir(\'C:/Users/Venki_LFC/Documents/Study/Python/\') 
  

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.