Usage
1. Basic Example
The following program is a sample to connect any trigger signal to the R-I/O connector of the controller, latch the robot position information while it is operating at the trigger input, and show the latched position information.
Function Main
Motor On
Power High
Speed 50; Accel 50, 50
SpeedS 500; AccelS 5000
Go P0 'Start position
SetLatch SETLATCH_PORT_CU_0,
SETLATCH_TRIGGERMODE_LEADINGEDGE, 4
LatchEnable On 'Latch enabled
Move P1 'Starts operation, inputs trigger while the operation
Wait LatchState = True 'Confirmed the latch is complete
P3 = LatchPos(WithoutToolArm, 1) 'Retrieves latch position 1
P4 = LatchPos(WithoutToolArm, 2) 'Retrieves latch position 2
P5 = LatchPos(WithoutToolArm, 3) 'Retrieves latch position 3
P6 = LatchPos(WithoutToolArm, 4) 'Retrieves latch position 4
LatchEnable Off 'Disable the latch
Print P3 'Displays latch position 1
Print P4 'Displays latch position 2
Print P5 'Displays latch position 3
Print P6 'Displays latch position 4
Fend
Example to omit parameters:
Function Main
Motor On
Power High
Speed 50; Accel 50, 50
SpeedS 500; AccelS 5000
Go P0 'Start position
SetLatch SETLATCH_PORT_CU_0,
SETLATCH_TRIGGERMODE_LEADINGEDGE
LatchEnable On 'Latch enabled
Move P1 'Starts operation, inputs trigger while the operation
Wait LatchState = True 'Confirmed the latch is complete
P3 = LatchPos 'Acquire the latched position
LatchEnable Off 'Disable the latch
Print P3 'Show the latched position
Fend
2. Example with Vision system
This is an example that uses the robot end effector to handle parts, passes above the external fixed upward camera acquisition point without stopping, and assembles the parts with an appropriate position correction.
This system has a transmission type sensor that outputs the trigger signal when the robot end effector handles a part and passes the camera acquisition point. Then, it connects the sensor output with both the R-I/O and the camera trigger input for external tuning and synchronizes the latched robot position information and the camera image. It calculates the part position error and offsets the position comparing the robot position information from the camera image to the robot position information from the real-time I/O.
In this case, the robot vision system must be calibrated as the upward fixed camera. Also, by registering the parts place position in advance, robot position information can be acquired for precise parts placement by RobotPlacePos result. Parts place position can be set in the CalRobotPlacePos property wizard.
For details on the camera trigger signal connection and the vision calibration, refer to the following manuals:
"Vison Guide 8.0"
The following program is a sample.
Function Main
Robot 1
Motor On
Power High
Speed 100
Accel 100, 100
Jump InitPos 'Moves to the initial point
Wait 1.0
SetLatch 24, SETLATCH_TRIGGERMODE_LEADINGEDGE 'Sets the latch condition
MemOff 0
Xqt PictureOnFly_Camera 'Starts the shooting task
Jump StartPos C0 'Moves to the part feed point
Wait 0.5
LatchEnable On 'Starts waiting the latch
MemOn 0 'Enables the shooting
Jump FrontPos C0 CP 'Moves close to the camera
Go PassingPos CP 'Passes over the camera
Go TargetPos :Z(-70) CP 'Moves over the assembly point
Wait MemSw(1) = On 'Waits until the image processing is complete
Wait LatchState = True 'Waits for position latch 'completion
LatchEnable Off 'Disables the position latch
Jump ExactTargetPos C0 LimZ (-70) 'Moves to the assembly point
Wait 0.5
Jump InitPos 'Moves to the initial point
Wait 0.5
Motor Off
Fend
Function to execute from work image capturing to work place acquisition
Function PictureOnFly_Camera
'Vision Result variable
Integer AcqStat 'Strobe imaging completion flag
Boolean Found 'Work detection status
Wait MemSw(0) = On 'Waits the imaging start flag
MemOff 1 'Clears the imaging completion flag
MemOff 0 'Clears the imaging start flag
AcqStat = 0 'Clears the imaging start flag
VRun PictureOnFly_i
Do Until AcqStat = 3 'Wait for strobe
VGet PictureOnFly_i.AcquireState, AcqStat
Loop
'Check the work detection
VGet PictureOnFly_i.Geom01.Found, Found
If Found = False Then
Print "Work NotFound"
Pause
EndIf
Wait LatchState = True 'Waits for the trigger
'Sets the image capturing position (trigger position) to the Vision
VSet PictureOnFly_i.RobotPos, LatchPos (WithoutToolArm)
'Acquires the robot position
VGet PictureOnFly_i.Geom01.RobotPlacePos, Found, ExactTargetPos
MemOn 1 'Changes the camera imaging flag
Fend