You are on page 1of 9

KJSCE/IT/LY/SEMVIII/ROB/2019-20

(Autonomous College Affiliated to University of Mumbai)


KJSCE/IT/LY/SEMVIII/ROB/2019-20

Batch: B4 Roll No.: 1614109 Experiment No.:6


___________________________________________________________________________

Aim: To simulate Workspace of Cartesian co-ordinate robot arm.


___________________________________________________________________________

Resources Used: C/C++/JAVA/MATLAB


___________________________________________________________________________

Theory:
Cartesian Robot (3P)

A Cartesian coordinate robot has three principal prismatic axes (X, Y and Z) that are at right
angles to each other. Cartesian coordinate robots with the horizontal member supported at
both ends are sometimes called Gantry robots. They are often quite large. Gantry robots
usually hang upside down. Like gantry cranes, they are suspended from an X or X/Y axis
beam.

Both Cartesian and Gantry robots have a rectangular work envelope. Because of the highly
rigidity, the Cartesian/Gantry Robots are very accurate and repeatable but they lacks
flexibility as they cannot reach around objects. Due to their mechanical structure, these robots
are very easy to program and visualize. It is used primarily to position a wide variety of end-
effectors such as: Automatic screwdrivers, Automatic drills, Dispensing heads, Welding
heads, Water jet cutting heads and Grippers.

----------------------------------------------------------------------------------------------------------------
Results: (Program printout with output / Document printout as per the format)

CODE:
import pygame
from pygame.locals import *

from OpenGL.GL import *


from OpenGL.GLU import *

a,b,c=0,0,0

a=int(input("Enter the xjoint length"))


b=int(input("Enter the yjoint length"))
c=int(input("Enter the zjoint length"))

aMin=int(input("Enter the minimum horizontal Reach"))


bMin=int(input("Enter the minimum vertical Reach"))
cMin=int(input("Enter the minimum z Reach"))

#tuples for representation

roboVertices=(
(0,0,0),
(0,(b+bMin)/2,0),
(0,(b+bMin)/2,(c+cMin)/2),
(Autonomous College Affiliated to University of Mumbai)
KJSCE/IT/LY/SEMVIII/ROB/2019-20

((a+aMin)/2,(b+bMin)/2,(c+cMin)/2),
)

vertices1=(#keep in order
(0,0,0),
(0,b,0),
(a,b,0),
(a,0,0),
(0,0,c),
(0,b,c),
(a,b,c),
(a,0,c),
)
#tuples for representation
vertices2=(#keep in order
(0,0,0),
(0,bMin,0),
(aMin,bMin,0),
(aMin,0,0),
(0,0,cMin),
(0,bMin,cMin),
(aMin,bMin,cMin),
(aMin,0,cMin),
)

roboEdges=(
(0,1),
(1,2),
(2,3),
)

edges=(
#each node will have 3 connections
#total 12
(0,1),
(1,2),
(2,3),
(3,0),
(4,5),
(5,6),
(6,7),
(4,7),
(0,4),
(1,5),
(2,6),
(3,7),
)

def CubeWSE():

#what we're going to do


glBegin(GL_LINES)
#making cubes
for edge in edges:
for vertex in edge:#there will be 2 vertices per edge
(Autonomous College Affiliated to University of Mumbai)
KJSCE/IT/LY/SEMVIII/ROB/2019-20

glColor3fv((0,0,1))
glVertex3fv(vertices1[vertex])#specifies a vertex and does something with it

for edge in edges:


for vertex in edge:#there will be 2 vertices per edge
glColor3fv((0,1,0))
glVertex3fv(vertices2[vertex])#specifies a vertex and does something with it

#making robot arm:


for edge in roboEdges:
for vertex in edge:
glColor3fv((1,0,0))
glVertex3fv(roboVertices[vertex])

glEnd()

def main():
pygame.init()#start pygame
display=(800,600)
pygame.display.set_mode(display,DOUBLEBUF|OPENGL)#details of display size and type of data to
show ie opengl
#doublebuf is dispaly framerate

gluPerspective(45,display[0]/display[1],0.1,50.0)#fov,aspect ratio(h/w), clipping plane, how much to view


from
glTranslatef(0,0,-10)#where to start viewing from
glRotatef(30,1,1,0)#angle of camera

while True:
for event in pygame.event.get():
if event.type==pygame.QUIT:
pygame.quit()
quit()

if event.type==pygame.KEYDOWN:
if event.key==pygame.K_LEFT:
glTranslatef(-0.5,0,0)#neg on x
if event.key==pygame.K_RIGHT:
glTranslatef(0.5,0,0)
if event.key==pygame.K_UP:
glTranslatef(0,1,0)
if event.key==pygame.K_DOWN:
glTranslatef(0,-1,0)
if event.type==pygame.MOUSEBUTTONDOWN:
if event.button==4:#scroll up
glTranslatef(0,0,0.5)
if event.button==5:#scroll down
glTranslatef(0,0,-0.5)
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)#clear the slate and draw on top of it
CubeWSE()
pygame.display.flip()#pdate doesnt wokr so we use this
pygame.time.wait(10)

main()

(Autonomous College Affiliated to University of Mumbai)


KJSCE/IT/LY/SEMVIII/ROB/2019-20

RESULT:

Yellow=MAXIMUM REACH
Green=ROBOT JOINTS
Pink=MINIMUM REACH

WE CAN ALSO NAVIGATE IN THE VIEW USING ARROW KEYS:


LEFT-RIGHT:

(Autonomous College Affiliated to University of Mumbai)


KJSCE/IT/LY/SEMVIII/ROB/2019-20

UP_DOWN:

(Autonomous College Affiliated to University of Mumbai)


KJSCE/IT/LY/SEMVIII/ROB/2019-20

(Autonomous College Affiliated to University of Mumbai)


KJSCE/IT/LY/SEMVIII/ROB/2019-20

AND WE CAN ZOOM USING SCROLLWHEEL:

(Autonomous College Affiliated to University of Mumbai)


KJSCE/IT/LY/SEMVIII/ROB/2019-20

___________________________________________________________________________

Outcomes:
Understand basics of robotic dynamics, path planning and Task planning
___________________________________________________________________________

Conclusion:

In this experiment we have understood the motion of a robot in a simulation and have
generated the workspace of Cartesian robot.

___________________________________________________________________________

Grade: AA / AB / BB / BC / CC / CD /DD

Signature of faculty in-charge with date


_______________________________________________________________________
References:

Books/ Journals/ Websites:


● Robert Shilling, Fundamentals of Robotics-Analysis and control, Prentice Hall of India

(Autonomous College Affiliated to University of Mumbai)

You might also like