Difference between revisions of "Program Examples - Robot Helix motion"

From SoftMC-Wiki
Jump to: navigation, search
(Created page with "here is an example of doing Robot Helix movement. We use puma 6 axis robot in this example: File:Helix1.JPG Helix.PRG: <syntaxhighlight lang="vb"> '---------------------...")
 
Line 1: Line 1:
 
here is an example of doing Robot Helix movement. We use puma 6 axis robot in this example:
 
here is an example of doing Robot Helix movement. We use puma 6 axis robot in this example:
[[File:Helix1.JPG]]
+
[[File:Helix2.JPG]]
  
  

Revision as of 13:00, 12 January 2017

here is an example of doing Robot Helix movement. We use puma 6 axis robot in this example: File:Helix2.JPG


Helix.PRG:

'------------------------------------------------------------------------------
' File:        Helix.prg
' Purpose:     generating puma helix motion
' Version:     1.00
' Author:      Eran Korkidi
' History:     10.DEC.2015    -    created
'------------------------------------------------------------------------------

' module global "constants"


' module global variables
dim shared jntZeroPosition as joint of xyzypr = {0,0,0,0,0,0}
dim shared jntStartPosition as joint of xyzypr = {-45,45,0,0,45,0}

dim shared locHelixCenter as location of xyzypr = #{0 , 1200 , 250 , 0 , 180 , -90}
dim shared locHelixStart as location of xyzypr =  #{0 , 1000 , -50 , 0 , 180 , -90}

dim shared dVelSlow as double = 40.0
dim shared dVelFast as double = 80.0

program

    Sys.Vrate = 100.0
    with Puma
        Attach
            En = TRUE
            Sleep 100
            while NOT En
                Sleep 100
            end while
            Move jntZeroPosition Vcruise=dVelSlow
            call waitMotion
                call helixMotion
            Move jntZeroPosition Vcruise=dVelSlow
            call waitMotion
        Detach
    end with    

end program


sub helixMotion

    dim i as long

    PUMA.BlendingMethod = 1
    PUMA.Cp = 2
    Move PUMA jntZeroPosition Vcruise=dVelSlow
    call waitMotion
    Move PUMA locHelixStart Vcruise=dVelFast
    call waitMotion
    for i = 1 to 2
        Moves PUMA locHelixStart Vtran=PUMA.VmTran
        Circle PUMA Angle=3*360 CircleCenter = locHelixCenter Vtran = PUMA.VmTran
    next i
    Move PUMA jntZeroPosition Vcruise=dVelSlow
    call waitMotion
    
end sub

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