Program Examples - Robot Pick and Place (P&P)

From SoftMC-Wiki
Revision as of 08:07, 11 January 2017 by Dany (talk | contribs)
Jump to: navigation, search

here is an example of doing Robot Pick and Place. we we use puma 6 axis robot in this example:


PnP.PRG:

'------------------------------------------------------------------------------
' File:        PnP.prg
' Purpose:     generating circle contour with a puma robot
' Version:     1.00
' Author:      Or KArni
' History:     11.JAN.2017	-	created
'------------------------------------------------------------------------------

dim shared jntZeroPosition as joint of xyzypr = {0,0,0,0,0,0}
dim shared locCircleCenter as location of xyzypr =#{1101.57 , 0 , -49.804 , 0 , 180 , 0}
dim shared locCircleStart as location of xyzypr = #{901.572 , 0 , -49.804 , 0 , 180 , 0}
program

	Sys.Vrate = 100.0
	with Puma
		Attach
			En = TRUE
			Sleep 100
			while NOT En
				Sleep 100
			end while
			call circularMotion
		Detach
	end with	

end program




sub circularMotion

	dim dVelSlow as double = 20.0

	Move PUMA locCircleStart Vcruise=dVelSlow
	call waitMotion
	Circle PUMA Angle=5*360 CircleCenter = locCircleCenter Vtran = PUMA.VmTran/2
	call waitMotion
	Move PUMA jntZeroPosition Vcruise=dVelSlow
	call waitMotion
	
end sub



sub waitMotion
	while puma.IsMoving
		Sleep 1
	end while
end sub