main task robot 2 epson scara.txt
TRANSCRIPT
-
8/14/2019 Main Task Robot 2 EPSON Scara.txt
1/8
' PAR20 Cover Robot2 Line 1
'----- defining of variables -> they are stored in battery buffered memory and will not get losed if power fails !!! ------------------------Global Preserve Integer Vel, LimZAxis, Acc, Dec 'Global Real CycleTimeGlobal Preserve Real PickUpTimeGlobal Preserve Real GiveOffTimeGlobal Preserve Real GiveOffTime2Global Boolean In_Save_Pos, In_Wait_Pos' Vel = 60' PickUpTime = 0.1' GiveOffTime = 0.05' GiveOffTime2 = 0.05'--------------------------------------------------------------------------------------------------------------------------------------------
'------ MAIN Function -----------------------------------------------------------------------------------------------------------------------Function main ' Main function: start of program !!!!!!
Xqt main_UserInterface ' Multitasking: defines userinterface Touch Pendant TP Xqt main_Error ' Multitasking: defines error handling
Power High ' Power set to maximumArch 0, 10, 10 ' defines point to point movmeme
nt (JUMP) with 10mm vertical up and 10mm vertical down movementArch 1, 10, 10 ' defines point to point movmeme
nt (JUMP) with 10mm vertical up and 10mm vertical down movementWeight 1, 250 ' defines weight and inertia set
tings for robot -> robot will choose approbiate maximum accelerations for each joint
In_Save_Pos = 0In_Wait_Pos = 0
' Inertia 1 ' 1On EnableTablePunch ' Freigaben fr ersten Start noch von Posi
tionsabfrage abhngig machen !!!!!!!!!!
DoHalt main_UserInterface ' Multi-Tasking UIResume main_UserInterface
If Sw(SavePosition) = 1 And In_Save_Pos = 0 Then ' If Inp
ut "SavePosition" = On then jump to P_save waitSpeed 10Jump P_saveIf InPos Then ' In Save positi
on allow turning of hole punching indexing tableOn EnableTablePunch ' and switch vac
uum offOn VacuumOff
EndIfIn_Save_Pos = 1
-
8/14/2019 Main Task Robot 2 EPSON Scara.txt
2/8
In_Wait_Pos = 0GoTo End
EndIf
If Sw(SavePosition) = 0 And (In_Save_Pos = 1) Then ' If Input "SavePosition" = Off then jump to P_wait
Speed 10Jump P_waitIf InPos Then ' In Save positi
on allow turning of hole punching indexing tableOn EnableTablePunch ' and switch vac
uum offOff VacuumOff
EndIfIn_Save_Pos = 0In_Wait_Pos = 1GoTo End ' If Input "Save
Position" = Off jump to end -> do nothing!EndIf
If Sw(Start) = 0 Then GoTo End ' kein Startimpuls dann abbrechen
LimZ LimZAxis' Hhenbegrenzung je nach Artikel
Accel Acc, Dec' Beschleunigung max. 120Speed Vel
' Geschwindigkeit OverrideTmReset 0
' Reset Timer 0 fr ZykluszeitmessungGo P_start ! D0; Off VacuumOff; D0; Off EnableTablePunch
! 'zur Aufnahme fahren und Vakuum einschaltenWait PickUpTime
' Aufnahmezeit
' Trap 1, Sw(ThrowOff) = On GoTo EHandle ' Defines Trap:Abwurf
If Sw(ThrowOff) = 1 Then' Abwerfen
Jump P_throw_off C0 ! D10; On EnableTablePunch;D100; On VacuumOff ! 'Ja
ElseJump P_stop C0 ! D10; On EnableTablePunch !
'NeinEndIf
'Trap 1' Mglichkeit des Interruptes beenden
Wait GiveOffTime2On VacuumOffWait GiveOffTime
' Abgabezeit'If Sw(SavePosition) = 1 Then ' Warteposition b
er Aufnahme erhhen, falls Kollision mit Glas droht
If Sw(SavePosition) = 1 Then 'Warteposition ber Aufnahme erhhen, falls Kollision mit Glas droht
Jump P_save C1 ! D50; On StartTurner, 0.2 !
-
8/14/2019 Main Task Robot 2 EPSON Scara.txt
3/8
' Wender starten, wenn zurck zu GrundstellungElse
Jump P_wait C1 ! D50; On StartTurner, 0.2 !
'Nein: kurz oberhalb Aufnahmepunkt Presse !!evtl. hier schon Vakuum einschaltenEndIf
'falls es Verzgerungen beim Unterdruckaufbau gibt !!!!!!!
' falls es Verzgerungen beim Unterdruckaufbau gibt !!!!!!!On Acknowledge, 0.05CycleTime = Tmr(0) ' Zyklus
zeitGoTo End
End:
LoopFendFunction main_Error ' noch erweitern
DoIf Oport(3) = 1 Then ' Error aufgetreten
Off EnableTablePunchOn VacuumOffOff StartTurner
EndIfIf Not (Oport(0) = 1 Or Oport(1) = 1) Then ' Diesebeiden Bits mssen immer ein sein, falls nicht ist Controller evtl.
Off EnableTablePunch ' Spannungslos oder KabelfehlerOn VacuumOffOff StartTurner
EndIfLoop
Fend
Function main_UserInterfaceString a$Do
Cls #24Print #24, "- WALTEC Robot 2 -- Auto-Menu -----" 'Port-Nummer 24 definiert Touch Pendant
Print #24, "1= position setup"Print #24, "2= speed setup"Print #24, "3= timing setup"Print #24, "4= display actual values"Print #24, "5= save positions"Print #24, ""Print #24, "-------- actual values ----------- "Print #24, "t_cycle=", CycleTime, " s"
'Wichtig: Noch Bewegungsgrenzen definieren und berprfen ->' z.B: +-10mm um Aufnahmepunkt fr Z-Achsen
Input #24, a$If a$ = "1" Then
Cls #24Print #24, "menu position setup"Print #24, "1= change P_start"
-
8/14/2019 Main Task Robot 2 EPSON Scara.txt
4/8
Print #24, "2= change P_stop"Print #24, "3= change LimZ"Input #24, a$If a$ = "1" Then
L_P_start: Cls #24Print #24, "change position P_start"Print #24, "1= x+0.2mm ", "2=x-0.2mm "Print #24, "3= y+0.2mm ", "4=y-0.2mm "Print #24, "5= z+0.2mm ", "6=z-0.2mm "Print #24, "7= u+1grad ", "8=u-1grad "Input #24, a$If a$ = "1" Then
P_start = P_start +X(0.2) 'X-Achse + x mmElseIf a$ = "2" Then
P_start = P_start -X(0.2) 'X-Achse - x mmElseIf a$ = "3" Then
P_start = P_start +Y(0.2) 'Y-Achse + x mmElseIf a$ = "4" Then
P_start = P_start -Y(0.2) 'Y-Achse - x mmElseIf a$ = "5" Then
P_start = P_start +Z(0.2) 'Z-Achse + x mmElseIf a$ = "6" Then
P_start = P_start -Z(0.2) 'Z-Achse - x mmElseIf a$ = "7" Then
P_start = P_start +U(1) 'U-Achse + x gradElseIf a$ = "8" ThenP_start = P_start -U(1) 'U-Achse - x grad
ElseIf a$ = "0" ThenGoTo L_end
ElsePrint #24, "Wrong Input!"
EndIfCls #24Print #24, "actual position P_start:"Print #24, "x = ", CX(P_start)Print #24, "y = ", CY(P_start)Print #24, "z = ", CZ(P_start)
Print #24, "u = ", CU(P_start)GoTo L_P_startElseIf a$ = "2" Then
L_P_stop: Cls #24Print #24, "change position P_stop"Print #24, "1= x+0.2mm ", "2=x-0.2mm "Print #24, "3= y+0.2mm ", "4=y-0.2mm "Print #24, "5= z+0.2mm ", "6=z-0.2mm "Print #24, "7= u+1grad ", "8=u-1grad "Print #24, "0= quit"Input #24, a$If a$ = "1" Then
P_stop = P_stop +X(0.2) 'X-Achse + x mm
ElseIf a$ = "2" ThenP_stop = P_stop -X(0.2) 'X-Achse - x mmElseIf a$ = "3" Then
P_stop = P_stop +Y(0.2) 'Y-Achse + x mmElseIf a$ = "4" Then
P_stop = P_stop -Y(0.2) 'Y-Achse - x mmElseIf a$ = "5" Then
P_stop = P_stop +Z(0.2) 'Z-Achse + x mmElseIf a$ = "6" Then
P_stop = P_stop -Z(0.2) 'Z-Achse - x mm
-
8/14/2019 Main Task Robot 2 EPSON Scara.txt
5/8
ElseIf a$ = "7" ThenP_stop = P_stop +U(1) 'U-Achse + x grad
ElseIf a$ = "8" ThenP_stop = P_stop -U(1) 'U-Achse - x grad
ElseIf a$ = "q" ThenGoTo L_end
ElsePrint #24, "Wrong Input!"
EndIfPrint #24, "actual position P_stop:"Print #24, "x = ", CX(P_stop)Print #24, "y = ", CY(P_stop)Print #24, "z = ", CZ(P_stop)Print #24, "u = ", CU(P_stop)GoTo L_P_stop
ElseIf a$ = "3" ThenL_P_LimZ: Cls #24
Print #24, "change LimZ position "Print #24, "1= LimZ+1mm ", "2= LimZ-1mm "Print #24, "q= quit"Input #24, a$If a$ = "1" Then
LimZAxis = LimZAxis + 1 'LimZ + x mmElseIf a$ = "2" Then
LimZAxis = LimZAxis - 1 'LimZ - x mmElseIf a$ = "0" ThenGoTo L_end
ElsePrint #24, "Wrong Input!"
EndIfPrint #24, "actual LimZ position"Print #24, "LimZ = ", LimZAxisGoTo L_P_LimZ
ElsePrint #24, "Wrong Input!"
EndIfElseIf a$ = "2" Then
Cls #24Print #24, "menu speed setup"Print #24, "1= change speed"Print #24, "2= change acceleration"Print #24, "3= change deceleration"Input #24, a$If a$ = "1" Then
L_speed: Cls #24Print #24, "change speed"Print #24, "1= speed + 1% ", "2= speed - 1%"Input #24, a$If a$ = "1" Then
Vel = Vel + 1
If Vel = 100 Then Vel = 100ElseIf a$ = "2" Then
Vel = Vel - 1If Vel = 100 Then Vel = 100
ElseIf a$ = "0" ThenGoTo L_end
ElsePrint #24, "Wrong Input!"
-
8/14/2019 Main Task Robot 2 EPSON Scara.txt
6/8
EndIfPrint #24, "actual speed"Print #24, "speed = ", VelGoTo L_speed
ElseIf a$ = "2" ThenL_acc: Cls #24
Print #24, "change acceleration"Print #24, "1= Acc + 1% ", "2= Acc - 1%"Input #24, a$If a$ = "1" Then
Acc = Acc + 1If Acc = 100 Then Acc = 100
ElseIf a$ = "2" ThenAcc = Acc - 1If Acc = 100 Then Acc = 100
ElseIf a$ = "0" ThenGoTo L_end
ElsePrint #24, "Wrong Input!"
EndIfPrint #24, "actual acceleration"Print #24, "Acc = ", Acc
GoTo L_accElseIf a$ = "3" ThenL_dec: Cls #24
Print #24, "change deceleration"Print #24, "1= Dec + 1% ", "2= Dec - 1%"Input #24, a$If a$ = "1" Then
Dec = Dec + 1If Dec = 100 Then Dec = 100
ElseIf a$ = "2" ThenDec = Dec - 1If Dec = 100 Then Dec = 100ElseIf a$ = "0" ThenGoTo L_end
ElsePrint #24, "Wrong Input!"
EndIfPrint #24, "actual deceleration"Print #24, "Dec = ", DecGoTo L_dec
ElsePrint #24, "Wrong Input!"
EndIfElseIf a$ = "3" Then
Cls #24Print #24, "menu timing setup"Print #24, "1= change pickup time"Print #24, "2= change place time"Input #24, a$If a$ = "1" Then
L_pickup: Cls #24Print #24, "change pickup time"Print #24, "1= pickup time + 0.01s "Print #24, "2= pickup time - 0.01s "
-
8/14/2019 Main Task Robot 2 EPSON Scara.txt
7/8
Input #24, a$If a$ = "1" Then
If PickUpTime < 1 Then 'Zeitgrenzen prfenPickUpTime = PickUpTime + 0.01
ElsePickUpTime = 1Print #24, "T_pickup upper limit = 1 s !
"EndIf
ElseIf a$ = "2" ThenIf PickUpTime < 0.1 Then 'Zeitgrenzen prfe
nPickUpTime = 0.05 'Aufnahmezeit nicht kl
einer als 0.1 s zulassenPrint #24, "T_pickup lower limit = 0.05
s !"Else
PickUpTime = PickUpTime - 0.01EndIf
ElseIf a$ = "0" ThenGoTo L_end
ElsePrint #24, "Wrong Input!"
EndIf
Print #24, "actual pickup time"Print #24, "PickUpTime = ", PickUpTimeGoTo L_pickup
ElseIf a$ = "2" ThenL_place: Cls #24
Print #24, "change place time"Print #24, "1= place time + 0.01s "Print #24, "2= place time - 0.01s "Input #24, a$If a$ = "1" Then
If GiveOffTime < 1 Then 'Zeitgrenzen prfenGiveOffTime = GiveOffTime + 0.01
Else
GiveOffTime = 1Print #24, "place time upper limit = 1 s!"
EndIfElseIf a$ = "2" Then
If GiveOffTime < 0.1 Then 'Zeitgrenzen prfen
GiveOffTime = 0.05 'Aufnahmezeit nicht kleiner als 0.1 s zulassen
Print #24, "place time lower limit = 0.05 s !"
ElseGiveOffTime = GiveOffTime - 0.01
EndIfElseIf a$ = "0" ThenGoTo L_end
ElsePrint #24, "Wrong Input!"
EndIfPrint #24, "actual place time"Print #24, "GiveOffTime = ", GiveOffTimeGoTo L_place
Else
-
8/14/2019 Main Task Robot 2 EPSON Scara.txt
8/8
Print #24, "Wrong Input!"EndIf
ElseIf a$ = "4" ThenCls #24Print #24, "menu actual values"Print #24, "1= display positions"Print #24, "2= display speed, acc"Print #24, "3= display timing"Input #24, a$If a$ = "1" Then
Cls #24Print #24, "actual position P_start:"Print #24, "x = ", CX(P_start), " mm"Print #24, "y = ", CY(P_start), " mm"Print #24, "z = ", CZ(P_start), " mm"Print #24, "u = ", CU(P_start), " grad"Print #24, "actual position P_stop:"Print #24, "x = ", CX(P_stop), " mm"Print #24, "y = ", CY(P_stop), " mm"Print #24, "z = ", CZ(P_stop), " mm"Print #24, "u = ", CU(P_stop), " grad"
ElseIf a$ = "2" ThenCls #24Print #24, "actual speed"
Print #24, "speed = ", VelPrint #24, "acceleration = ", Acc, " %"Print #24, "deceleration = ", Dec, " %"
ElseIf a$ = "3" ThenCls #24Print #24, "actual timing"Print #24, "pickup time = ", PickUpTime, " s"Print #24, "place time = ", GiveOffTime, " s"Print #24, "cylce time = ", CycleTime, " s"
ElsePrint #24, "Wrong Input!"
EndIfWait 5
ElseIf a$ = "5" ThenPrint #24, "Save Points to File"SavePoints "Points.pts"
ElsePrint #24, "Wrong Input!"
EndIfL_end: a$ = ""
LoopFend