0% found this document useful (0 votes)
46 views32 pages

3D Vision-Guided Robotics Guide

This operation program guide provides instructions for using and editing the operation program for 3D vision-guided robotics, specifically for FANUC controllers. It outlines the necessary preparations, program configurations, and actions required for robot operations, including gripping and placing targets. The guide emphasizes safety precautions and the importance of correctly editing specific programs to ensure the robot functions as intended.

Uploaded by

Daniel Aguilar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views32 pages

3D Vision-Guided Robotics Guide

This operation program guide provides instructions for using and editing the operation program for 3D vision-guided robotics, specifically for FANUC controllers. It outlines the necessary preparations, program configurations, and actions required for robot operations, including gripping and placing targets. The guide emphasizes safety precautions and the importance of correctly editing specific programs to ensure the robot functions as intended.

Uploaded by

Daniel Aguilar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

A39GB

3D VISION-GUIDED
ROBOTICS 1 Operation Program
Overview
OPERATION PROGRAM GUIDE
Editing the Operation
FANUC CORPORATION EDITION
2 Program

This manual contains explanations of how to use and the


details of the operation program so as to support usage
during actual operation of the operation program.
3 Other Common Edits

4 Operation Program Details

■ Robot controllers: R-30iB, R-30iBPlus, R-30iB Mate, R-30iB Mate Plus (* For the latest information, see the

company's website.)

■ Language used: TP Program

■ Communication method: Ethernet


Introduction

Introduction

This manual contains explanations of how to use and the details of the operation program so as to support usage
during actual operation of the operation program.

Notation Contents

Hereafter, the CV-X Series controller is referred to as the Chapter 1 Operation Program Overview
vision controller. What's more, every instance of the term
program refers to robot programs. 1-1 What Is the Operation Program?
1-2 Operation Program Configuration
The company names and product names noted in this 1-3 Operation Program Action
manual are registered trademarks or trademarks of their
respective companies. The TM mark and ® mark have been
omitted in this manual. Chapter 2 Editing the Operation Program

Symbols 2-1 Advance Preparation


2-2 Programs That Must Be Edited
2-3 Performing Actions Within the Operation Program Until
The following symbols are used in this manual to enable the All the Targets Are Extracted
recognition of important information at a glance. Be sure to
2-4 Executing Programs Other Than the Operation Program
read this section carefully.
After One Target Is Extracted

DANGER
Indicates a hazardous situation which, if not
avoided, will result in death or serious injury.
Chapter 3 Other Common Edits
Indicates a hazardous situation which, if not
WARNING 3-1 Executing Commands From the Robot
avoided, could result in death or serious injury.
3-2 Determining Whether All the Targets Have Been
Extracted
Indicates a hazardous situation which, if not 3-3 Continually Extracting the Same Target
CAUTION
avoided, could result in minor or moderate injury. 3-4 Collisions With the Robotʼs Point Cloud With the
Automatic Position Trigger Setting
Indicates a situation which, if not avoided, could 3-5 Usage With a 2D Camera
NOTICE
result in product damage as well as property damage.

Important Indicates precautions and limitations that must be Chapter 4 Operation Program Details
followed during operation.
4-1 KEY_SET_PARAM.TP
4-2 KEY_ACT_AT_GRIP_POS.TP
Indicates additional information on proper operation.
Point
4-3 KEY_ACT_AT_PLACE_POS.TP
4-4 KEY_ACT_AT_DEPART_DEST.TP
Reference Indicates tips for better understanding or useful 4-5 KEY_ACT_AT_APPROACH_POS.TP
information. 4-6 KEY_ACT_AT_EACH_POS.TP
4-7 KEY_OPERATION.TP
Indicates items and pages in this manual to be referenced. 4-8 KEY_ISSUE_TRIGGER.TP

Precautions
Glossary
The purpose of this product is to assist in setting up the
robot actions. This product does not guarantee the safe
actions of the robot. This section summarizes the meaning of terminology used
in this manual.
Furthermore, the movement path of the robot that is If there are any other unknown terms regarding the vision
output by this product can result in actions different than controller, check the userʼs manual (3D Vision-guided
what are expected. Robotics Edition).

Users of this product must read and understand the “Safety  Segment
Information” section and assume the responsibility that This is the movement path of the robot from one point
appropriate measures are taken to ensure the safe actions that has a roil to another (such as from the grip
of the end product that incorporates the robot, regardless position to the depart position).
of the normal or abnormal actions of this product.
 Path
Except in the case of an intentional act or the gross This is the robotʼs movement path that is formed by
negligence of KEYENCE, KEYENCE assumes no responsibility combining all the segments generated by the path
whatsoever for any direct or indirect damage or loss to the generation.
user or a third party of this product regardless of the reason
for the claim.

| 2 - 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
Operation Program Overview

1. Operation Program Overview

1-1 What Is the Operation Program?


This program moves the robot according to the path generated by the 3D vision-guided robotics.
The yellow and pink arrows in the following figure indicate the action of the operation program.

Position above
the box

Image capture
standby position

Depart position
Approach position

Place position
Grip position

1-2 Operation Program Configuration


The operation program is composed of the following program group.
Programs other than KEY_OPERATION.TP are called within KEY_OPERATION.TP, so only KEY_OPERATION.TP is executed.
Generally speaking, you can use the operation program just by editing the programs whose editing is indicated as required.
However, programs whose editing is indicated as arbitrary may also be edited depending on how the operation program is used.
For details, see chapter 2.

Program Role Editing

KEY_OPERATION.TP Operation program execution If needed


Parameter specification
KEY_SET_PARAM.TP (Result reception register number, path generation tool number, Required
label number, retry count)
KEY_ISSUE_TRIGGER.TP Trigger issuance If needed

KEY_ACT_AT_START_POS.TP Action at the action start position If needed

KEY_ACT_AT_APPROACH_POS.TP Action at the approach position If needed


Action at the grip position
KEY_ACT_AT_GRIP_POS.TP (Example: inner diameter chuck open signal ON/suction Required
signal ON)
KEY_ACT_AT_DEPART_DEST.TP Action at the depart position If needed
Action at the place position
KEY_ACT_AT_PLACE_POS.TP (Example: inner diameter chuck open signal OFF/suction Required
signal OFF)
KEY_ACT_AT_EACH_POS.TP Action at the end point of each segment If needed

KEY_MOVE_ALONG_PATH.TP Definitions of functions for robot actions Not required

- 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
3 |
Operation Program Overview

1-3 Operation Program Action


The path is generated from the path generation in the vision controller in accordance with the registered grip “Lift up” and “Pull
close” operations.
According to the generated path, the operation program is executed as shown in the following figure.

“Lift up”

This is the action that picks up the target.


You have to write the action to grip the target in KEY_ACT_AT_GRIP_POS.TP and the action to release the target in
KEY_ACT_AT_PLACE_POS.TP.

■ “Lift up” path

Preprocessing

Trigger issuance KEY_OPERATION.TP


KEY_ISSUE_TRIGGER.TP

Position above KEY_MOVE_ALONG_PATH.TP


the box

Image capture
standby position Postprocessing

Depart position
Approach position

Trigger issuance

Grip position Place position


KEY_ACT_AT_GRIP_POS.TP KEY_ACT_AT_PLACE_POS.TP

| 4 - 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
Operation Program Overview

■ “Lift up” time chart

Main program KEY_OPERATION.TP KEY_MOVE_ALONG_PATH.TP

Preprocessing

Start of operation program
Execution of → Start
KEY_OPERATION.TP

Move to the image capture start
position.

Trigger issuance
KEY_ISSUE_TRIGGER.TP

Execution of
→ Start
KEY_MOVE_ALONG_PATH.TP

Move to the position above the box.

Move to the approach position.

Move to the grip position.
Execution of
KEY_ACT_AT_GRIP_POS.TP

Movement to the depart position

Move to the place position.
Execution of
KEY_ACT_AT_PLACE_POS.TP

Trigger issuance

Move to the position above the box.

End of operation program ← End ← End

Postprocessing

- 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
5 |
Operation Program Overview

“Pull close”

This action is used to pull a target to a different position in the field of view so as to change the position of a target that cannot
be picked up as-is.
After pulling the target, the robot does not move to the place position but instead returns to the image capture standby position.
You have to write the action to grip the target in KEY_ACT_AT_GRIP_POS.TP and the action to release the target in
KEY_ACT_AT_DEPART_DEST.TP.

■ “Pull close” path

Preprocessing

Trigger issuance KEY_OPERATION.TP


KEY_ISSUE_TRIGGER.TP

Position above KEY_MOVE_ALONG_PATH.TP


the box

Image capture
standby position

Approach position

Depart position
KEY_ACT_AT_DEPART_DEST.TP

Grip position
KEY_ACT_AT_GRIP_POS.TP

| 6 - 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
Operation Program Overview

■ “Pull close” time chart

Main program KEY_OPERATION.TP KEY_MOVE_ALONG_PATH.TP

Preprocessing

Start of operation program
Execution of → Start
KEY_OPERATION.TP

Move to the image capture start
position.

Trigger issuance
KEY_ISSUE_TRIGGER.TP

Execution of
→ Start
KEY_MOVE_ALONG_PATH.TP

Move to the position above the box.



Move to the approach position.

Move to the grip position.
Execution of
KEY_ACT_AT_GRIP_POS.TP

Move to the depart position.
Execution of
KEY_ACT_AT_DEPART_DEST.TP

Move to the image capture standby
position.

Trigger issuance

Continue to move to the position above the box for lifting up.

- 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
7 |
Editing the Operation Program

2. Editing the Operation Program

2-1 Advance Preparation


Follow the procedure below to edit the operation program.

Configure the settings up to chapter 4 in the “3D Vision-guided Robotics Startup Manual.”

According to the procedure in chapter 5 of the "3D Vision-guided Robotics Startup Manual," start
KEY_OPERATION.TP to check that the operation program starts.

Refer to “2-2 Programs That Must Be Edited” and edit the following programs.

A) KEY_SET_PARAM.TP
Specify parameters such as the retry count.

B) KEY_ACT_AT_GRIP_POS.TP
Specify the action, such as the turning ON of the suction signal, at the grip position.

C) KEY_ACT_AT_PLACE_POS.TP
Specify the action, such as the turning OFF of the suction signal, at the place position.

D) KEY_ACT_AT_DEPART_DEST.TP
Specify the action, such as the turning OFF of the suction signal, at the depart position during the
"Pull close" operation.

Configure the vision controller settings and edit the operation program to match this application.

A) To perform actions within the operation program until all the targets are extracted, see
section 2-3.
Example) The robot does not perform any movement other than those specified with the path
generation tool

B) To execute a program other than the operation program after one target is extracted, see
section 2-4.
Example) Path generation is only performed for the area around the box. A different program is
used for the movement before and after this area.

| 8 - 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
Editing the Operation Program

2-2 Programs That Must Be Edited


This section explains where to edit the programs that must be edited.

KEY_SET_PARAM.TP

In this program, edit the red text to specify the parameters.

Actual program Explanation


!******************************* ;
!* Please type in the values *;
!******************************* ;
(Omitted)
!Start index of consecutive ;
!registers ;
!for vision outputs;
R[170]=20 ; Result reception register index specification
;
!Path planning tool id ;
R[171]=101 ; Path generation tool number specification
;
!Path label ;
R[172]=0 ; Path generation tool path label number
specification
;
!Start index of consecutive ;
!position registers ;
!for waypoint coordinates;
R[173]=10 ; Result reception position register index
specification
* Within the operation program, an amount
of memory specified by the number of
segments × the number of waypoints
starting from the specified address is used
for the registers. Configure the settings so
that the range does not overlap registers
used by other programs.
;
!Maximum number ;
!of times of retry ;
R[174]=0 ; Retry count upper limit specification
* The retry count is the number of times to
capture images again when the number of
detections is 0.
;
!R180-195 are used ;
!by this sample ;
!operation status ;
(Omitted)
R[195]=0 ;

KEY_ACT_AT_GRIP_POS.TP

In this program, write the action at the grip position in the part outlined with a red frame.

Actual program Explanation


!******************************* ;
!* Please type in action *;
!* at grip position. *;
!******************************* ;
; Write the action at the grip position.
; Example) For a suction hand, turn the suction
signal ON.
;

- 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
9 |
Editing the Operation Program

KEY_ACT_AT_PLACE_POS.TP

In this program, write the action at the place position in the part outlined with a red frame.

Actual program Explanation


!******************************* ;
!* Please type in action *;
!* at grip position. *;
!******************************* ;
; Write the action at the place position.
; Example) For a suction hand, turn the suction
signal OFF.
;

KEY_ACT_AT_DEPART_DEST.TP

In this program, when you have registered the “Pull close” grip operation, write the action at the depart position in the
part outlined with a red frame.

Actual program Explanation


!******************************* ;
!* Please type in action at *;
!* depart destination position.* ;
!******************************* ;
R[180]=AR[1]+2000 ;
JMP LBL[R[180]] ;
LBL[2000] ;
! for lifting an object. ;
;
JMP LBL[2999] ;
LBL[2001] ;
! for sliding an object. ;
; Write the action at the depart position.
; Example) For a suction hand, turn the suction
signal OFF.
JMP LBL[2999] ;
LBL[2999] ;

2-3 Performing Actions Within the Operation Program Until All the Targets Are Extracted
Configure the vision controller settings.

1. Set the next start position.


The next start position refers to the start position of the path during the second and later path
generation operations. In the following figure, the position has ben set to above the box.

2. Configure the trigger setting.


The trigger setting refers to the trigger issuance position during the second and later path generation
operations. In the following figure, the place position has been specified.
Also, the first trigger issuance position must be set to the image capture standby position.

Trigger
setting

Next start position

| 10 - 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
Editing the Operation Program

Check whether the configuration and the path image match.

1. The yellow and pink lines shown below indicate the path of the operation program.
Until all the targets are extracted, KEY_MOVE_ALONG_PATH.TP is used to repeat the movement
within the path indicated with the pink line.
The second and later trigger issuances are also performed within KEY_MOVE_ALONG_PATH.TP.

2. After all the targets within the field of view are extracted, the robot performs the
postprocessing action indicated by the blue line, and then returns to the preprocessing.

Preprocessing

First trigger issuance

Position above the box


As long as there are targets within
Image capture
the field of view, repeatedly issue Postprocessing
standby position
triggers and move along the path.

When all the targets are


extracted, perform the
Depart position
Approach position postprocessing action.

Place position
Grip position

Trigger issuance

* For the “Pull close” operation, move from the depart position to the image capture standby position, and then issue a trigger
according to the operation program.
* For a retry, move from the position above the box (the next start position) to the image capture standby position according
to the operation program.

When retrying, check that there are no collisions.


* No collision judgment is performed in the movement from the position above the box to the image capture
standby position during a retry.

1. When the detection count is 0, the retry action is performed. Therefore, place one target within
the field of view and verify the action.

2. If there is a collision during movement from the position above the box to the image capture
standby position, correct the position above the box (the next start position) of the vision
controller.

- 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
11 |
Editing the Operation Program

2-4 Executing Programs Other Than the Operation Program After One Target Is
Extracted
In this configuration, KEY_OPERATION.TP needs to be edited in addition to the programs that must be edited.
After configuring the vision controller settings and checking the path image, follow the procedure shown below to edit
KEY_OPERATION.TP.
Also, the locations to edit vary depending on whether triggers are issued within the operation program.

When triggers are issued within the operation program

Configure the vision controller settings.

1. Configure the settings so that the next start position is not used.
The next start position refers to the start position of the path during the second and later path
generation operations.
The next start position is not used this time, so the start position is the image capture standby position
for the second and later operations.

2. Configure the trigger setting.


The trigger setting refers to the trigger issuance position during the second and later path generation
operations. In the following figure, the place position has been specified.
Also, the first trigger issuance position must be set to the image capture standby position.

3. Set the image capture standby position to an arbitrary path generation start position.

Trigger
setting

| 12 - 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
Editing the Operation Program

Check whether the configuration and the path image match.

1. Start from the blue preprocessing and issue the first trigger at an arbitrary position.

2. The pink line shown below indicates the KEY_MOVE_ALONG_PATH.TP path.


With KEY_MOVE_ALONG_PATH.TP, the robot moves along the path for picking up one target,
and then stops.
After one target is picked up, the postprocessing action is performed, and then the robot returns
to the path generation start position.
The action indicated by the blue line must be written in the main program.

3. The second and later trigger issuances are also performed within KEY_MOVE_ALONG_PATH.TP.

Preprocessing

Path generation start position Perform the postprocessing action,


(Image capture standby position) and then pick up a target again from
the path generation start position.

First trigger issuance


Postprocessing

Pick up one target and


issue a trigger.

Depart position
Approach position

Place position
Grip position

Trigger issuance

* If a retry is performed with the “Pull close” operation, the operation program ends at the image capture standby position,
and the robot returns to the first trigger issuance position with the main program.

When retrying with the “Pull close” operation, check that there are no collisions.
* No collision judgment is performed in the movement from the image capture standby position to the first
trigger issuance position during a retry with the “Pull close” operation.

1. The action of the return movement from the image capture standby position to the first trigger
issuance position is verified with the main program.

2. If a collision occurs, reregister the image capture standby position of the vision controller to a

position where no collisions occur.

Alternatively, change the first trigger issuance position to a position where no collisions occur.

- 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
13 |
Editing the Operation Program

Embed KEY_OPERATION.TP into the main program.

1. Divide KEY_OPERATION.TP by role as shown in the following figure.


* Use only the colored parts.

Actual program Functions


!******************************** ;
! Operation Program Ver. 2.0 ;
! This program should be used ;
Not used
! with CV-X Ver. 5.3 ;
! or later versions. ;
!******************************** ;
;
!Initialize. ;
CALL KEY_SET_PARAM;
;
!Opens the connection. ;
Connecting to the vision controller
CALL KEY_CONNECT ;
(Omitted)
!Starts picking;
LBL[900] ;

CALL KEY_GET_VAR(17,1,R[181],R[173]) ;
Not used
J PR[R[173]] 10% FINE ;

CALL KEY_ISSUE_TRIGGER ;
First trigger issuance
IF R[180]<>0,JMP LBL[999] ;
;
!Moves the robot along path ;
LBL[901] ;
!Gets the result and moves ;
Path generation
CALL KEY_MOVE_ALONG_PATH ;
• Move to the generated path.
(Omitted)
• Second and later trigger issuances
LBL[902] ;
CALL KEY_GET_VAR(12,0,R[181],193) ;
IF R[193]<>0,JMP LBL[900] ;
;
!Issues the trigger ;
CALL KEY_ISSUE_TRIGGER ; Not used
IF R[180]<>0,JMP LBL[999] ;
;
JMP LBL[901] ; Return to path generation.
;
LBL[997] ;
R[180]=1 ;
JMP LBL[999] ;
LBL[998] ;
R[180]=2 ; End path generation.
JMP LBL[999] ;
LBL[999] ;
!Closes the connection. ;
CALL KEY_CLOSE ;

| 14 - 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
Editing the Operation Program

2. Add the divided KEY_OPERATION.TP to the main program as shown in the following figure.
If the content is duplicated, replace it with KEY_OPERATION.TP.
Example) If trigger issuance is written in the preprocessing action of the main program before editing,
it is necessary to replace this trigger issuance with the first trigger issuance of KEY_OPERATION.TP.

Main program before editing Main program after editing

Preprocessing action

Connecting to the vision

controller
Preprocessing action ↓
Move to the first trigger
issuance position.

➡ First trigger issuance
↓ ↓
Move to the path generation
Move to the pickup start
start position.
position.
(Pickup start position)
↓ ↓
Pickup action ➡ Path generation
↓ ↓
Postprocessing action Postprocessing action
↓ ↓
Move to the path generation
Move to the pickup start
start position.
position.
(Pickup start position)
↓ ↓
Return to the pickup action. ➡ Return to path generation.

➡ End path generation.

When triggers are issued with a different program

Configure the vision controller settings.

1. Configure the settings so that the next start position is not used.
The next start position refers to the start position of the path during the second and later path
generation operations.
The next start position is not used this time, so the start position is the image capture standby position
for the second and later operations.

2. Configure the settings so that the trigger setting is not used.


The trigger setting refers to the trigger issuance position during the second and later path generation
operations.
This time, the trigger is issued outside of the operation program, so the trigger setting is not necessary.

3. Set the image capture standby position to an arbitrary path generation start position.

- 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
15 |
Editing the Operation Program

Check whether the configuration and the path image match.

1. Start from the blue preprocessing and issue the first trigger at an arbitrary position.

2. The pink line shown below indicates the KEY_MOVE_ALONG_PATH.TP path.


With KEY_MOVE_ALONG_PATH.TP, the robot moves along the path for picking up one target,
and then stops.
After one target is picked up, the postprocessing action is performed, and then the robot returns
to the path generation start position.
The action indicated by the blue line must be written in the main program.

3. The second and later triggers are not issued within KEY_MOVE_ALONG_PATH.TP, so these
trigger issuances must be written in the main program.

Preprocessing

Perform the postprocessing action, issue a


Path generation start position trigger, and then pick up a target again
(image capture start position) from the path generation start position.

First trigger issuance


Postprocessing

Pick up one target.

Trigger issuance
Approach position Depart position

Place position
Grip position

* If a retry is performed with the “Pull close” operation, the operation program ends at the image capture standby position,
and the robot returns to the first trigger issuance position with the main program.

When retrying with the “Pull close” operation, check that there are no collisions.
* No collision judgment is performed in the movement from the image capture standby position to the first
trigger issuance position during a retry with the “Pull close” operation.

1. The action of the return movement from the image capture standby position to the first trigger
issuance position is verified with the main program.

2. If a collision occurs, reregister the image capture standby position of the vision controller to a

position where no collisions occur.

Alternatively, change the first trigger issuance position to a position where no collisions occur.

| 16 - 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
Editing the Operation Program

Embed KEY_OPERATION.TP into the main program.

1. Divide KEY_OPERATION.TP by role as shown in the following figure.


* Use only the colored parts.

Actual program Functions


!******************************** ;
! Operation Program Ver. 2.0 ;
! This program should be used ;
Not used
! with CV-X Ver. 5.3 ;
! or later versions. ;
!******************************** ;
;
!Initialize. ;
CALL KEY_SET_PARAM;
;
!Opens the connection. ;
Connecting to the vision controller
CALL KEY_CONNECT ;
(Omitted)
!Starts picking;
LBL[900] ;

CALL KEY_GET_VAR(17,1,R[181],R[173]) ; Not used


J PR[R[173]] 10% FINE ;

CALL KEY_ISSUE_TRIGGER ;
First trigger issuance
IF R[180]<>0,JMP LBL[999] ;
;
!Moves the robot along path ;
LBL[901] ;
!Gets the result and moves ;
Path generation
CALL KEY_MOVE_ALONG_PATH ;
• Move to the generated path.
(Omitted)
• Second and later trigger issuances
LBL[902] ;
CALL KEY_GET_VAR(12,0,R[181],193) ;
IF R[193]<>0,JMP LBL[900] ;
;
!Issues the trigger ;
CALL KEY_ISSUE_TRIGGER ; Second and later trigger issuances
IF R[180]<>0,JMP LBL[999] ;
;
JMP LBL[901] ; Return to path generation.
;
LBL[997] ;
R[180]=1 ;
JMP LBL[999] ;
LBL[998] ;
End path generation.
R[180]=2 ;
JMP LBL[999] ;
LBL[999] ;
!Closes the connection. ;
CALL KEY_CLOSE ;

- 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
17 |
Editing the Operation Program

2. Add the divided KEY_OPERATION.TP to the main program as shown in the following figure.
If the content is duplicated, replace it with KEY_OPERATION.TP.
Example) If trigger issuance is written in the preprocessing action of the main program before editing,
it is necessary to replace this trigger issuance with the first trigger issuance of KEY_OPERATION.TP.

Main program before editing Main program after editing

Preprocessing action

Connecting to the vision
controller
Preprocessing action
Move to the first trigger
issuance position.

First trigger issuance
↓ ↓
Move to the path generation
Pickup start position start position.
(Pickup start position)
↓ ↓
Pickup action ➡ Path generation
↓ ↓
Postprocessing action

Move to the position for the
second and later trigger
Postprocessing action
issuances.

Second and later trigger

issuances
↓ ↓
Move to the path generation
Pickup start position start position.
(Pickup start position)
↓ ↓
Return to the pickup action. ➡ Return to path generation.

➡ End path generation.

| 18 - 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
Other Common Edits

3. Other Common Edits

3-1 Executing Commands From the Robot

Situation

If you want to switch the execution conditions (EXW) or read the inspection settings (PR) from the robot, you have to add a
description by referring to KEY_ISSUE_TRIGGER.TP.

Editing example (EXW,2)

By referring to KEY_ISSUE_TRIGGER.TP, add the program to the location where you want to
switch the execution condition.
Example) If you want to switch the execution condition during operation program execution, write the
program before the trigger issuance (such as in KEY_ACT_AT_APPROACH_POS.TP).

1. Write the command character string to execute into the "T1" part of CALL KEY_SEND_CMD('T1').
Example) Replace T1 with EXW,2.

2. Write only the name of the command to execute into the "T1" part of CALL KEY_WAIT_CMD('T1',R[170]) ;.
Example) Rewrite T1 with EXW.
! initialize ;
R[180]=0 ;
;
! Cannot connect to the controller ;
! while "GetPath" is in progress ;
LBL[900] ;
CALL KEY_GET_VAR(2,0,R[181],182) ;
IF R[182]<>1,JMP LBL[900] ;
WAIT 0.01sec ;
;
! Error detection ;
CALL KEY_GET_VAR(10,0,R[181],193) ;
IF R[193]<>0,JMP LBL[999];
;
CALL KEY_SEND_CMD('EXW,2') ;
CALL KEY_WAIT_CMD('EXW',R[170]) ;
IF R[R[170]]<>0,JMP LBL[999] ;
;
LBL[999] ;

- 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
19 |
Other Common Edits

Editing example (PR)

In the same manner as the procedure for "EXW,2," change KEY_ISSUE_TRIGGER.TP so that the
command can be issued.

If a command with return values, like the PR command, is sent, the return value is stored starting
from R[R[170]].
Here, 20 is stored in R[170]. The command result is stored in R[20], the SD card number is stored in R[21], and the
program number is stored in R[22].

Store the return value in a different register.


* When a different command is issued, the value starting from R[R[171]] is overwritten.
Store the SD card number in R[100] and the program number in R[101].

! initialize ;
R[180]=0 ;
;
! Cannot connect to the controller ;
! while "GetPath" is in progress ;
LBL[900] ;
CALL KEY_GET_VAR(2,0,R[181],182) ;
IF R[182]<>1,JMP LBL[900] ;
WAIT 0.01sec ;
;
! Error detection ;
CALL KEY_GET_VAR(10,0,R[181],193) ;
IF R[193]<>0,JMP LBL[999];
;
CALL KEY_SEND_CMD('PR') ;
CALL KEY_WAIT_CMD('PR',R[170]) ;
IF R[R[170]]<>0,JMP LBL[999] ;
R[193]=R[170]+1
R[100]=R[R[193]]
R[193]=R[170]+2
R[101]=R[R[193]]
LBL[999] ;

| 20 - 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
Other Common Edits

3-2 Determining Whether All the Targets Have Been Extracted

Situation

In the operation program, check whether the detection count is 0, and then perform the retry action accordingly.
However, when the detection count is 0, it is not possible to determine whether targets are present but they could not be found
by the search or whether no targets are present because they have all been extracted.
If you want to switch the program on the basis of the judgment of whether all the targets have been extracted or if you do not
want to perform retry processing after all the targets have been removed, additional editing is required.

Editing method (determining whether all the targets have been extracted)

In the [Output Settings] of the vision controller, add the [3D Search Object Presence] option.

Add CALL KEY_GET_VAR(21,output data number + 1,R[181],arbitrary result storage register


number) to KEY_OPERATION.TP.
* Do not change the first and third arguments.
* The result is stored in REAL format."
The goal is to obtain the 3D Search Target Presence, so enter 2 in the output data number and set the value of an arbitrary
result storage register number to 193.

!******************************** ;
! Operation Program Ver. 2.0 ;
(Omitted)
!Moves the robot along path ;
LBL[901] ;
!Gets the result and moves ;
CALL KEY_MOVE_ALONG_PATH ;
!Error detection ;
IF R[180]>1,JMP LBL[999] ;
IF R[180]=0,JMP LBL[902] ;
CALL KEY_GET_VAR(21,2,R[181],193) ;
R[183]=R[183]+1 ;
IF R[183]<=R[174],JMP LBL[900] ;
JMP LBL[997] ;
(Omitted)
!Closes the connection. ;
CALL KEY_CLOSE ;

If a target is present, 1 is stored in the value of the arbitrary storage register number. If no targets
are present, 0 stored.
This time, the value is stored in R[193].

- 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
21 |
Other Common Edits

Editing method (do not retry when all targets have been extracted)

Carry out the procedure under “Determining Whether All the Targets Have Been Extracted.”

Add the red text to KEY_OPERATION.TP.

!******************************** ;
! Operation Program Ver. 2.0 ;
(Omitted)
!Moves the robot along path ;
LBL[901] ;
!Gets the result and moves ;
CALL KEY_MOVE_ALONG_PATH ;
!Error detection ;
IF R[180]>1,JMP LBL[999] ;
IF R[180]=0,JMP LBL[902] ;
CALL KEY_GET_VAR(21,2,R[181],193) ;
IF R[193]<0.5,JMP LBL[997] ;
R[183]=R[183]+1 ;
IF R[183]<=R[174],JMP LBL[900] ;
JMP LBL[997] ;
(Omitted)
!Closes the connection. ;
CALL KEY_CLOSE ;

| 22 - 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
Other Common Edits

3-3 Continually Extracting the Same Target

Situation

The vision controller is not able to recognize whether a target has been picked up.
Therefore, if the robot cannot pick up a target due to problems such as those with the hand, the same target may be picked
up even if the image is captured again.
With the configuration in “2-3 Performing Actions Within the Operation Program Until All the Targets Are Extracted,” an attempt
is made to continually pick up targets that cannot be picked up, resulting in a situation where the pickup action does not end.
This problem can be eliminated by changing the label number to be picked up and picking up a different target.

Editing method

On the vision controller, set [Output Count] to 2 under [Path Planning].

Prepare the error detection parameter.

Add the red text to [Link].


* The suction pressure is monitored, and a signal is sent from the PLC to the robot when the pressure drops
to a certain value, thereby detecting the error. For example, in the following program, it is assumed that
R[10] being 1 indicates that an error was detected.

! initialize ;
R[180]=0 ;
(Omitted)
! Starts parallel data receive ;
CALL KEY_GET_VAR(1,0,R[181],193) ;
IF R[10]<>0,JMP LBL[950] ;
CALL KEY_SET_VAR(R[171],R[172],1) ;
JMP LBL[951] ;
LBL[950] ;
CALL KEY_SET_VAR(R[171],1,2) ;
R[10]=0 ;
LBL[951] ;
CALL KEY_CLOSE ;
RUN KEY_GET_PATH ;
(Omitted)

- 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
23 |
Other Common Edits

3-4 Collisions With the Robotʼs Point Cloud With the Automatic Position Trigger Setting

Situation

When the trigger setting is set to the automatic position, the trigger may be issued when the robot is within the field of view.
In this situation, the point cloud of the robot within the field of view at the time the image is captured is viewed as an obstacle,
so a roundabout path may be generated by the path generation.

Editing method

On the detailed screen for the [Detection Conditions] of the [Path Planning], select the [Do Not
Judge Outside Box] check box under [Collision Judgment].
* Collision judgment will no longer be performed with point clouds outside the box.
Use the layout settings to register any items that require collision judgment.

3-5 Usage With a 2D Camera

Situation

To correct with high accuracy, perform grip shift correction with the 2D camera after picking up targets.
Also, if you want to perform inspections after picking up targets, it may be the case that you use a 2D camera with the other
equipment.

Editing method

Select [Asynchronous Trigger] under [Set Advanced] in the [Camera Settings] of the vision
controller.
* The trigger is automatically allocated.

For the place position in the path settings, register the position where the gripped target is shown
to the 2D camera.

Perform the editing under “When triggers are issued with a different program” in “2-4 Executing
Programs Other Than the Operation Program After One Target Is Extracted.”

| 24 - 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
Other Common Edits

Insert the 2D vision-guided robotics sample program after the path generation.

Main program before editing Main program after editing

Preprocessing action

Connecting to the vision

controller
Preprocessing action ↓
Move to the first trigger
issuance position.

➡ First trigger issuance
↓ ↓
Move to the path generation
Move to the pickup start
start position.
position.
(Pickup start position)
↓ ↓
Pickup action ➡ Path generation
↓ ↓
Start the 2D sample program.

Postprocessing action

Move to the position for the
Postprocessing action
second and later trigger
issuances.

Second and later trigger

issuances
↓ ↓
Move to the path generation
Pickup start position start position.
(Pickup start position)
↓ ↓
Return to the pickup action. ➡ Return to path generation.

➡ End path generation.

Edit the 2D vision-guided robotics sample program to match the actions and program being used
this time.
Add the following text to the start of the 2D sample program.

! Cannot connect to the controller ;


! while "GetPath" is in progress ;
LBL[900] ;
CALL KEY_GET_VAR(2,0,R[181],182) ;
IF R[182]<>1,JMP LBL[900] ;
WAIT 0.01sec ;
CALL KEY_CONNECT ;

- 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
25 |
Operation Program Details

4. Operation Program Details

4-1 KEY_SET_PARAM.TP
This program specifies parameters.

Actual program Explanation


!******************************* ;
!* Please type in the values *;
(Omitted)
!registers ;
!for vision outputs;
R[170]=20 ; Result reception register index specification
;
!Path planning tool id ;
R[171]=101 ; Path generation tool number specification
;
!Path label ;
R[172]=0 ; Path generation tool path label number
specification
;
!Start index of consecutive ;
!position registers ;
!for waypoint coordinates;
R[173]=10 ; Result reception position register index
specification
* Within the operation program, an amount of
memory specified by the number of
segments × the number of waypoints starting
from the specified address is used for the
registers. Configure the settings so that the
range does not overlap registers used by other
programs.
;
!Maximum number ;
!of times of retry ;
R[174]=0 ; Retry count upper limit specification
* The retry count is the number of times to
capture images again when the number of
detections is 0.
;
!R180-195 are used ;
!by this sample ;
!operation status ;
R[180]=0 ;
!toggled index ;
Variable definitions
R[181]=1 ;
* Do not use R[180] to R[195], written here,
(Omitted)
with other programs.
R[194]=0 ;
R[195]=0 ;

4-2 KEY_ACT_AT_GRIP_POS.TP
This program writes the action at the grip position.

Actual program Explanation


!******************************* ;
!* Please type in action *;
!* at grip position. *;
!******************************* ;
;
;
; Write the action at the grip position.
;
;

| 26 - 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
Operation Program Details

4-3 KEY_ACT_AT_PLACE_POS.TP
This program writes the action at the place position.

Actual program Explanation


!******************************* ;
!* Please type in *;
!* the robot operations *;
!* at place position. *;
!******************************* ;
;
;
; Write the action at the place position.
;
;

4-4 KEY_ACT_AT_DEPART_DEST.TP
This program writes the action at the depart position.

実際のプログラム 解説
!******************************* ;
!* Please type in action at *;
!* depart destination position. *;
!******************************* ;
R[193]=AR[1]+2000 ;
JMP LBL[R[193]] ;
LBL[2000] ;
! for lifting an object. ;
;
;
Lift up
;
Write the action at the depart position.
;
;
JMP LBL[2999] ;
LBL[2001] ;
! for sliding an object. ;
;
;
Pull close
;
Write the action at the depart position.
;
;
JMP LBL[2999] ;
LBL[2999] ;

4-5 KEY_ACT_AT_APPROACH_POS.TP
This program writes the action at the approach position.

Actual program Explanation


!******************************* ;
!* Please type in action *;
!* at approach position. *;
!******************************* ;
;
;
; Write the action at the approach position.
;
;

- 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
27 |
Operation Program Details

4-6 KEY_ACT_AT_EACH_POS.TP
This program writes the action in each segment.
By default, segments 0 to 9 are available, so increase the number of items as necessary.

Actual program Explanation


! calculates where to jump ;
R[193]=AR[1]+1000 ; Segment number calculation
JMP LBL[R[193]] ;
;
LBL[1000] ;
!Action at leg 0 ;
;
; Segment number 0
; Write the action that is performed after the
; segment ends.
;
JMP LBL[1999] ;
LBL[1001] ;
!Action at leg 1 ;
;
; Segment number 1
; Write the action that is performed after the
; segment ends.
;
JMP LBL[1999] ;
(Omitted)
LBL[1010] ;
!Action at leg 10 ;
;
; Segment number 10
; Write the specific action that is performed after
; the segment ends.
;
JMP LBL[1999] ;
LBL[1999] ;

| 28 - 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
Operation Program Details

4-7 [Link]
This program is executed when you use the operation program.
It receives values from the vision controller and calls the necessary actions and programs for path generation.
Errors in the operation program are stored in g_keyOperationStatus within KEY_OPERATION.TP.

List of g_keyOperationStatus values


Value Description Countermeasure
0 Success -
1 The detection count is 0. If the detection count is 0 even though targets are present, revise the search settings.
Result acquisition failure (PPR Check whether communication can be performed.
2
command failure) Check whether the tool number specified with KEY_SET_PARAM.TP is correct.
Check whether communication can be performed.
3 Trigger failure Check whether operation mode is enabled.
Check whether the trigger signal is correct.

Actual program Explanation


!******************************** ;
! Operation Program Ver. 2.0 ;
! This program should be used ;
! with CV-X Ver. 5.3 ;
! or later versions. ;
!******************************** ;
;
!Initialize. ;
CALL KEY_SET_PARAM; Parameter storage
(execution of KEY_SET_PARAM.TP)
;
!Opens the connection. ;
CALL KEY_CONNECT ; Start communication.
;
!Gets the setting data. ;
CALL KEY_GET_CONF(R[171]) ; Acquisition of setting data from the vision
CALL KEY_GET_VAR(0,0,0,193) ; controller via issuance of a PPR command
IF R[193]<>0,JMP LBL[998]; Exit KEY_OPERATION.TP if the operation fails.
;
!Starts picking;
LBL[900] ;
CALL KEY_GET_VAR(17,1,R[181],R[173]) ; Movement to the image capture standby position
J PR[R[173]] 10% FINE ; * Because this is movement from the preprocessing,
no collision judgment is performed.
Directly write the change to the movement speed
here.

CALL KEY_ISSUE_TRIGGER ; Execution of KEY_ISSUE_TRIGGER.TP


IF R[180]<>0,JMP LBL[999] ; (1) Trigger issuance
(2) Acquisition of each axis value of all the
waypoints from the vision controller via the
issuance of a PPR command
Exit KEY_OPERATION.TP if the operation fails.
;
!Moves the robot along path ;
LBL[901] ;
!Gets the result and moves ;
CALL KEY_MOVE_ALONG_PATH ; Path generation execution
(1) Movement to all the waypoints
(2) Action execution at each segment (execution
of KEY_ACT_AT_*_*.TP)
(3) Execution of KEY_ISSUE_TRIGGER.TP at the
trigger issuance segment
!Error detection ;

IF R[180]>1,JMP LBL[999] ; Retry execution


IF R[180]=0,JMP LBL[902] ; (1) If path generation is successful, exit the
R[183]=R[183]+1 ; operation program.
IF R[183]<=R[174],JMP LBL[900] ; (2) If the error is 1, retry is executed until the
JMP LBL[997] ; retry count upper limit is reached.
(3) When performing a retry, return to the image
capture standby position.
(4) If the retry count upper limit is exceeded, exit
KEY_OPERATION.TP.
(4) If the error is 2, exit KEY_OPERATION.TP.
;

- 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
29 |
Operation Program Details

!Slide move handling ;


LBL[902] ; If the “Pull close” operation was performed,
CALL KEY_GET_VAR(12,0,R[181],193) ; return to the image capture standby position.
IF R[193]<>0,JMP LBL[900] ; * This is not used if the next start position has
been set.
;
!Issues the trigger ;
CALL KEY_ISSUE_TRIGGER ; Execution of KEY_ISSUE_TRIGGER.TP
IF R[180]<>0,JMP LBL[999] ; (1) Trigger issuance
(2) Acquisition of each axis value of all the
waypoints from the vision controller via the
issuance of a PPR command
Exit KEY_OPERATION.TP if the operation fails.
* This is not used if the next start position has
been set.
;
JMP LBL[901] ; Return to path generation execution.
* This is not used if the next start position has
been set.
;
LBL[997] ;
R[180]=1 ;
JMP LBL[999] ;
LBL[998] ; Processing when an error occurs
R[180]=2 ;
JMP LBL[999] ;
LBL[999] ;
!Closes the connection. ;
CALL KEY_CLOSE ; End communication
;

| 30 - 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
Operation Program Details

4-8 KEY_ISSUE_TRIGGER.TP
This program issues a trigger.

Actual program Explanation


! initialize ;
R[180]=0 ; Error initialization
;
! Cannot connect to the controller ;
! while "GetPath" is in progress ;
LBL[900] ; Waiting for KEY_GET_PATH to end
CALL KEY_GET_VAR(2,0,R[181],182) ; * Commands cannot be transmitted during the
IF R[182]<>1,JMP LBL[900] ; execution of KEY_GET_PATH. Therefore, check
the execution status of KEY_GET_PATH. If it is
being executed, wait until it ends.

WAIT 0.01sec ;
! Error detection ;
CALL KEY_GET_VAR(10,0,R[181],193) ; Receiving the execution result of KEY_DET_PATH
IF R[193]<>0,JMP LBL[998]; * Do not change the first to third arguments of
KEY_GET_VAR. Specify in the fourth argument
the register index in which to store the
execution result flag of KEY_GET_PATH.
Normally this argument does not need to be
changed.
! Re-connect ;
CALL KEY_CONNECT ; Start communication
* Communication is closed within
KEY_GET_PATH, so open communication on the
main program side.
;
! Issues the trigger ;
CALL KEY_SEND_CMD('T1') ;
CALL KEY_WAIT_CMD('T1',R[170]) ; Trigger issuance
IF R[R[170]]<>0,JMP LBL[997] ;
;
! Starts parallel data receive ;
CALL KEY_GET_VAR(1,0,R[181],193) ; Preparation for the parallel execution of
KEY_GET_PATH
CALL KEY_SET_VAR(R[171],R[172],1) ; Pass parameters to KEY_GET_PATH.
First argument: Path generation tool number
Second argument: Path generation label number
Third argument: Minimum detected path count
(If the detected count is smaller than the
minimum detected path count, error 1 occurs
when KEY_MOVE_ALONG_PATH is executed.)
CALL KEY_CLOSE ; End communication
* Communication is opened within
KEY_GET_PATH, so close communication on the
main program side.
RUN KEY_GET_PATH ; Path generation result acquisition
Acquisition of each axis value of all the
waypoints from the vision controller via the
issuance of a PPR command
* KEY_GET_PATH is executed in parallel with the
main program.
;
! Waits for initialization ;
! and update idx ;
LBL[901] ;
Waiting for the initialization of KEY_GET_PATH
CALL KEY_GET_VAR(4,0,R[193],182) ;
to end
IF R[182]<>1,JMP LBL[901];
;
JMP LBL[999] ;
LBL[997] ;
R[180]=3 ;
Processing when an error occurs
JMP LBL[999] ;
Store error 3 when trigger issuance fails.
LBL[998] ;
Store error 2 when result acquisition fails.
R[180]=2 ;
JMP LBL[999] ;
LBL[999] ;

- 3D VISION-GUIDED ROBOTICS, OPERATION PROGRAM GUIDE,


FANUC CORPORATION EDITION -
31 |
Revision History

Date Version Revision details


July 2020 Official release

Specifications are subject to change without notice.

KEYENCE CORPORATION
1-3-14, Higashi-Nakajima, Higashi-Yodogawa-ku, Osaka, 533-8555, Japan PHONE: +81-6-6379-2211
AUSTRIA FRANCE ITALY POLAND TAIWAN
Phone: +43 2236 378266 0 Phone: +33-1-56-37-78-00 Phone: +39-02-6688220 Phone: +48 71 36861 60 Phone: +886-2-2721-8080
BELGIUM GERMANY KOREA ROMANIA THAILAND
Phone: +32 15 281 222 Phone: +49-6102-3689-0 Phone: +82-31-789-4300 Phone: +40 269 232 808 Phone: +66-2-369-2777
BRAZIL HONG KONG MALAYSIA SINGAPORE UK & IRELAND
Phone: +55-11-3045-4011 Phone: +852-3104-1010 Phone: +60-3-7883-2211 Phone: +65-6392-1011 Phone: +44 1908-696-900
CANADA HUNGARY MEXICO SLOVAKIA USA
Phone: +1-905-366-7655 Phone: +36 1 802 7360 Phone: +52-55-8850-0100 Phone: +421 2 5939 6461 Phone: +1-201-930-0100
CHINA INDIA NETHERLANDS SLOVENIA VIETNAM
Phone: +86-21-3357-1001 Phone: +91-44-4963-0900 Phone: +31 40 20 66 100 Phone: +386 1 4701 666 Phone: +84-24-3772-5555
CZECH REPUBLIC INDONESIA PHILIPPINES SWITZERLAND
Phone: +420 220 184 700 Phone: +62-21-2966-0120 Phone: +63-2-8981-5000 Phone: +41 43 455 77 30
A4WW1-MAN-2010

Copyright○
C 2020 KEYENCE CORPORATION. All rights reserved. 124480GB 2070-1 A39GB

You might also like