Warning
You are reading an old version of this documentation. If you want up-to-date information, please have a look at 1.4 .Sample program
Here we introduce an example of a program to perform a basic pick and place.
Fig. 13 Production scenario with get_part
It is necessary at this stage to have already performed the camera configuration, as well as the creation of a recipe with its hand-eye calibration.
Basic scenario - get_part
Initialization
1. Prepare the robot:
Initialize robot frame and tool.
Initialize the robot gripper.
Move the robot out of the field of view.
2. Initialize the communication: Call the command EYE_CONFIGURE with the correct client number.
3. Start EYE+ in production: Stop the current state of the EYE+ if needed and start the production with the desired recipe.
Cyclic part of robot program
4. Get the part coordinates: Call the command EYE_GET_PART to get the coordinates of the part to be picked. These coordinates will be stored in the chosen position register.
5. Check if no error occurs while requesting the part coordinates: Call the command EYE_CHECK_LAST_ERROR and check if it returns 0. If it does not, an error has occurred (e.g., a timeout)
6. Calculate position: Create an intermediate position EYEPosDZ from the EYEPos to make sure to not hit anything when picking the part, whether it is the Asycube or another part.
Fig. 14 Path to pick the part
7. Pick: Follow the path from out_of_view to EYEPosDZ to EYEPos and pick the part with your gripper.
8. Place: Follow the path from EYEPos to EYEPosDZ to out_of_view to EYEPlace and place the part with your gripper.
Out of cyclic part
9. Stop EYE+ state: Stop the EYE+ production state by calling the command EYE_STOP. This command will also stop the communication.
Example of FANUC program
Here is an example of a simple pick and place using the registers listed in Table 3.
Register number |
Register type |
Description |
|---|---|---|
R[18] |
Registers |
Reserved register for internal use |
R[19] |
Registers |
Reserved register for internal use |
R[20] |
Registers |
Reserved register for internal use |
R[21] |
Registers |
Last plugin error raised by EYE_CHECK_LAST_ERROR |
PR[19] |
Position Reg |
Robot position to place the part |
PR[20] |
Position Reg |
Last part position found (EYEPos) |
PR[21] |
Position Reg |
Last part position with z-offset (EYEPosDz) |
PR[22] |
Position Reg |
Robot position out of field of view (out_of_view) |
! Configure the communication
CALL EYE_CONFIGURE(1, 2)
CALL EYE_CHECK_LAST_ERROR
IF (R[21:Asyril-EYELastEr)=602) THEN
ABORT
ENDIF
! Initialize the robot
UTOOL_NUM=2
UFRAME_NUM=0
CALL VENTURI_OFF
! Move out of field of view
J PR[22:out_of_view] 100% FINE
! Start EYE+ in production state
CALL EYE_START_PRODUCTION(12345)
CALL EYE_CHECK_LAST_ERROR
IF (R[21:Asyril-EYELastEr)<>0) THEN
ABORT
ENDIF
! Loop to pick and place
IF (R[21:Asyril-EYELastEr]=0) THEN
FOR R[1]=1 TO 50
! Get 1 part coord. in PR[20]
CALL EYE_GET_PART
CALL EYE_CHECK_LAST_ERROR
! If no error, pick the part
IF (R[21:Asyril-EYELastEr]=0) THEN
! Change to Asycube frame
UFRAME_NUM=3
! Set EYEPos component Z. W, P
PR[20, 3:Asyril-EYEPos]=0
PR[20, 4:Asyril-EYEPos]=(-180)
PR[20, 5:Asyril-EYEPos]=0
! Calculate position EYEPosDz
PR[21:EYEPosDZ]=PR[20:Asyril-EYEPos]
PR[21, 3:EYEPosDZ]=15
! Move to position EYEPosDz
J PR[21:EYEPosDZ] 100% FINE
! Move to position EYEPos
J PR[20:Asyril-EYEPosDZ] 100% FINE
! Pick the part
CALL VENTURI_ON
! Move to position EYEPosDz
J PR[21:EYEPosDZ] 100% FINE
! Change to "place" frame
UFRAME_NUM=0
! Place the part
J PR[19:Asyril-EYEPlace] 100% FINE
CALL VENTURI_OFF
ENDIF
ENDFOR
! End of the loop
ENDIF
! Stop the EYE+ production state
CALL EYE_STOP("production")
CALL EYE_CHECK_LAST_ERROR
IF (R[21:Asyril-EYELastEr)<>0) THEN
ABORT
ENDIF