Example of FANUC TP program

Here is an example of TP program to perform a pick and place scenario.

../../_images/sample_program_icons.png

Fig. 20 SAMPLEPROGRAM.tp

Here is the resulting code in TP mode. This code is automatically generated from the programming blocks.

Note

The IPL_ASYRIL_EYE_* programs cannot be called directly from the old FANUC user interface. They are protected and intended for use only via CRX programming blocks.

Listing 1 “SAMPLEPROGRAM.tp”
 1:  !Initialize the robot
 2:  CALL INITROBOT
 3:  !Start EYE+ in production
 4:  CALL IPL_ASYRIL_EYE_START_PRODUCTION(12345)
 5:  CALL IPL_ASYRIL_EYE_CHECK_LAST_ERROR
 6:  IF (R[21: ]=0) THEN
 7:  !Loop to pick and place
 8:  FOR R[10]=0 TO 20
 9:  !Move out of field of view
10:L  PR[1:OUF OF VIEW] 250mm/sec FINE
11:  CALL GRIPPEROPEN
12:  !Get 1 part coordinate in PR[20]
13:  CALL IPL_ASYRIL_EYE_GET_PART
14:  CALL IPL_ASYRIL_EYE_CHECK_LAST_ERROR
15:  IF (21=0) THEN
16:  !Pick and Place
17:  CALL PICKANDPLACE
18:  ENDIF
19:  ENDFOR
20:  ENDIF
21:  !Stop the EYE+ production state
22:  CALL IPL_ASYRIL_EYE_STOP('production')
[End]
Listing 2 “INITROBOT.tp”
 1:  !Initialize the robot
 2:  UTOOL_NUM=2
 3:  UFRAME_NUM=0
 4:  CALL GRIPPEROPEN
 5:
 6:  !Move out of field of view
 7:L  PR[1:OUF OF VIEW] 250mm/sec FINE
 8:  CALL GRIPPEROPEN
[End]
Listing 3 “PICKANDPLACE.tp”
 1:  !Change frame to Asycube
 2:  UFRAME_NUM=3
 3:
 4:  !Set position properly
 5:  PR[20,3:Asyril-Reserved]=0
 6:  PR[20,4:Asyril-Reserved]=180
 7:  PR[20,5:Asyril-Reserved]=0
 8:
 9:  !Calculate position EYEPosDZ
10:  PR[21: PICKPOSDZ]=PR[20:Asyril-Reserved]
11:  PR[21,3: PICKPOSDZ]=50
12:
13:  !Pick the part
14:L  PR[21: PICKPOSDZ] 250mm/sec FINE
15:L  PR[20:Asyril-Reserved] 250mm/sec FINE
16:  CALL GRIPPERCLOSE
17:
18:  !Place the part
19:L  PR[21: PICKPOSDZ] 250mm/sec FINE
20:L  PR[22:PLACEPOSDZ] 250mm/sec FINE
21:L  PR[23:PLACEPOS] 250mm/sec FINE
22:  CALL GRIPPEROPEN
23:L  PR[22:PLACEPOSDZ] 250mm/sec FINE
[End]