Difference between revisions of "Program Examples:CT without buffer"
(created) |
|||
Line 1: | Line 1: | ||
+ | {{Languages|Program_Examples:CT_without_buffer}} | ||
here is an example of how to use conveyor tracking without a buffer. i.e., item trigger only after NOI=0. | here is an example of how to use conveyor tracking without a buffer. i.e., item trigger only after NOI=0. | ||
the procedure includes a global flag that indicates that an item was detected on the conveyor. in real application, probe digital signal should be monitored instead of the global flag. | the procedure includes a global flag that indicates that an item was detected on the conveyor. in real application, probe digital signal should be monitored instead of the global flag. |
Latest revision as of 06:06, 17 July 2017
Language: | English • 中文(简体) |
---|
here is an example of how to use conveyor tracking without a buffer. i.e., item trigger only after NOI=0. the procedure includes a global flag that indicates that an item was detected on the conveyor. in real application, probe digital signal should be monitored instead of the global flag.
the following is config file for the conveyor
System.NumberAxes = 5
common shared SCARA as group Axnm=a1 Axnm=a2 Axnm=a3 Axnm=a4 Model=4 of xyzr
common shared LIN_CONV as moving frame of xyzr
Program
A5.AxisName = CONV
Load ETHERCAT.LIB
Load EC_USER.LIB
Load EC_CDHD.LIB
Load ECX_DIO8.LIB
Load EC_AI8ME.LIB
Load CPX_FB38.LIB
Load EC_HCNC.LIB
Load EK1100.LIB
Load TP_PARAM.LIB
Load TP_EC.LIB
Load TP.LIB
sys.DoubleFormat = 1
sys.NoMotion = 1
Sys.Name = "SCARA_CT"
Print "System is ready - " Sys.Name
End Program
the following is a setup file for the conveyor
'------------------------------------------------------------------------------
' File: conv_su.prg
' Purpose: setup file for shintech conveyor
' Version: 1.00
' Author: Eran Korkidi
' Created: 18.NOV.2015
'------------------------------------------------------------------------------
dim shared dConveyorGearRatio as double = 1.0
dim shared dConveyorPitchRatio as double = 1.0 ' one link = 12.5 mm, 20 sprockets
program
with CONV
Attach
En=0
Sleep 100
while En
Sleep 1
end while
Disp = 0.0
Sleep 40
Disp = Pfb
Sleep 40
vord = 100
Print "...."+ ElementName +" - kinematics/geometric setup"
Abs = 0
Axistype = 1
Direction = 1
if Simulated then
Positionfactor = 1E7
else
Positionfactor = dConveyorGearRatio * Pos_Units[Dadd]/360 / dConveyorPitchRatio
end if
Vfac = Positionfactor / 1E3
Afac = Positionfactor / 1E6
Jfac = positionfactor / 1E9
Vmax = 100
Vospd = 1.2 * Vmax
Vcruise = 0.5 * Vmax
Amax = 10 * Vmax
Dmax = Amax
Acc = Amax
Dec = Dmax
DecStop = 1.2 * Dmax
Jmax = 10.0 * Amax
Jerk = Jmax
Smooth = -1
prftype = -1
Pmax = 1
Pmin = -1
PmaxEn = FALSE
PminEn = FALSE
PositionErrorSettle = 0.1
PeMax = 10 'mm
PositionRollOverEnable = FALSE
if Simulated then
PositionErrorDelay = 1
else
PositionErrorDelay = 5.07
end if
BlendingMethod = 0
Detach
end with
end program ' <MyTask>.prg
And here is the task example, to trigger user need to assign
xSensorTrigger=1
to stop application xStopCT=1
'------------------------------------------------------------------------------
' File: SCARA.prg
' Purpose: handles SCARA in SPS 2015 candyStore
' Version: 1.00
' Author: Eran Korkidi
' History: 06.Oct.2015 - Eran Korkidi - Created
'------------------------------------------------------------------------------
common shared xStopCT as long = 00
common shared xSensorTrigger as long = 00
dim shared locPlaceHigh as location of xyzr
dim shared locPlaceLow as location of xyzr
dim shared closeGripperTime as long = 200
dim shared openGripperTime as long = 200
program
call CT_setup
Attach SCARA
while NOT xStopCT
Attach SCARA
SCARA.MasterFrame = LIN_CONV
if xSensorTrigger then
xSensorTrigger = 0
call executePick
call executePlace
end if
Sleep 1
end while
end program ' <MyTask>.prg
sub CT_setup
dim dSyncFactor as double = 0.5
Attach SCARA
SCARA.masterFrame = NONE
SCARA.velocitySyncTran = SCARA.VmTran * dSyncFactor
SCARA.accelerationSyncTran = SCARA.AmTran * dSyncFactor
SCARA.jerkSyncTran = SCARA.JmTran * dSyncFactor
SCARA.velocityDeSyncTran = SCARA.VmTran * dSyncFactor
SCARA.accelerationDeSyncTran = SCARA.AmTran * dSyncFactor
SCARA.jerkDeSyncTran = SCARA.JmTran * dSyncFactor
SCARA.velocitySyncRot = SCARA.VmRot * dSyncFactor
SCARA.accelerationSyncRot = SCARA.AmRot * dSyncFactor
SCARA.jerkSyncRot = SCARA.JmRot * dSyncFactor
SCARA.velocityDeSyncRot = SCARA.VmRot * dSyncFactor
SCARA.accelerationDeSyncRot = SCARA.AmRot * dSyncFactor
SCARA.jerkDeSyncRot = SCARA.JmRot * dSyncFactor
SCARA.masterFrame = NONE
SCARA.BlendingMethod = 1
SCARA.Cp = 15
SCARA.En = TRUE
Sleep 1000
Detach SCARA
locUpStream = #{0,0,0,0}
locDownStream = #{0,0,0,0}
LIN_CONV.Type = 0 ' linear
LIN_CONV.Ndof = 1
LIN_CONV.UpMaster[1] = 0.0
LIN_CONV.DownMaster[1] = tbd
LIN_CONV.UpStream[1] = locUpStream
LIN_CONV.DownStream[1] = locDownStream
LIN_CONV.MasterSource = CONV.Pcmd
LIN_CONV.VelocityMaxTrans = SCARA.VmTran * dSyncFactor
LIN_CONV.AccelerationMaxTrans = SCARA.AmTran * dSyncFactor
LIN_CONV.JerkMaxTrans = SCARA.JmTran * dSyncFactor
LIN_CONV.VelocityMaxRot = SCARA.VmRot * dSyncFactor
LIN_CONV.AccelerationMaxRot = SCARA.AmRot * dSyncFactor
LIN_CONV.JerkMaxRot = SCARA.JmRot * dSyncFactor
locPlaceLow = #{0,0,0,0}
locPlaceHigh = #{0,0,0,0}
end sub
sub closeGripper
'TBD
end sub
sub openGripper
'TBD
end sub
sub executePlace
Moves SCARA locPlaceHigh
Moves SCARA locPlaceLow
call waitMotionGroup
call openGripper
Sleep openGripperTime
Moves SCARA locPlaceHigh
Moves SCARA locUpStream
end sub
sub executePick
dim locFixedOffset as location of xyzr
dim locRelativeVertical as location of xyzr = {0, 0, -30.0, 0}
Trigger SCARA Ndof=1 Value=CONV.Pfb MasterFrame=LIN_CONV
SCARA.Slave = 5
Moves SCARA LIN_CONV.Zero Abs=1 Vrate=50 Arate=50 Drate=50 ' This is superimposed motion, therefore reduce the acc& vel, else acc overshoots occur
locFixedOffset = #{0,0,0,0} ' camera offset
Moves SCARA locFixedOffset Abs=0
while SCARA.IsMoving > 0
Sleep 1
end while
while NOT SCARA.Imfs
Sleep 1
end while
Moves SCARA locRelativeVertical Abs=0
while SCARA.IsMoving > 0
Sleep 1
end while
call closeGripper
Sleep closeGripperTime
Moves SCARA -locRelativeVertical Abs=0
while SCARA.IsMoving > 0
Sleep 1
end while
SCARA.Slave = 0
while SCARA.Imfs
Sleep 1
end while
call waitMotionGroup
end sub
sub executeEmptyBuffer
Attach SCARA
SCARA.MasterFrame = LIN_CONV
try
while TRUE
NextItem SCARA
end while
catch else
end try
if SCARA.Noi <> 0 then
Print "Buffer not empty: " ; systemGroup(i).Noi
end if
Detach SCARA
end sub