Difference between revisions of "Bin Picking Tutorial: Setting up Photoneo Bin Picking Studio with FANUC robots"

From 3D scanning Knowledge base - Photoneo wiki
Jump to: navigation, search
 
(44 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
'''NOTE: Users are strongly recommended to read the  [http://wiki.photoneo.com/index.php/Binpicking_Tutorial:_Introduction_to_Robot_Interfaces general introduction to robot interfaces] prior to installing specific robot modules.'''
 +
 
== 1. Prerequisites ==
 
== 1. Prerequisites ==
  
Please make sure that your Fanuc controller meets following criteria:
+
Prior to setup, please ensure that your Fanuc controller meets the following criteria:
  
 
- '''System version 8.10 and higher''' (Versions 6.40 - 7.70 are also supported with certain limitations)
 
- '''System version 8.10 and higher''' (Versions 6.40 - 7.70 are also supported with certain limitations)
 
- '''R632 Karel''' - Karel option available
 
  
 
- '''R648 User Socket Msg''' - Socket Communication option available
 
- '''R648 User Socket Msg''' - Socket Communication option available
  
Click Menu -> Status -> Version ID -> Next -> Order FI to show installed options
+
Click '''Menu''' -> '''Next''' -> '''Status''' -> '''Version ID''' -> '''Next''' -> '''F3[ORDER FI]''' to verify that the '''User Socket Msg''' option is installed on your robot controller (see figure below):
  
  
[[File:Fanuc tutorial Step1.png]]
+
[[File:Prerequisities.png|frame|none|alt=Alt text| Figure 1.1]]
  
 
== 2. Fanuc Controller Setup ==
 
== 2. Fanuc Controller Setup ==
  
=== 2.1 Set an IP Addresses of Ethernet Ports ===
+
=== 2.1 Set IP Addresses ===
 +
 
 +
The first step of the process is to configure the IP addresses of the robot controller.
 +
 
 +
Using Teach Pendant, press '''Menu''' -> '''Setup''' -> '''Host Comm''' -> '''TCP/IP''' -> '''F3[Detail]''':
  
Turn on the robot controller and set the controller IP addresses to meet your network configuration.
 
  
On Pendant Press '''Menu''' -> '''Setup''' -> '''Host Comm''' -> '''TCP/IP''':
+
[[File:Fanuc tutorial Step2.png|frame|none|alt=Alt text| Figure 2.1.1]]
  
  
[[File:Fanuc tutorial Step2.png]]
+
Two Ethernet ports should be available; users are recommended to configure '''Port#1''' for communication with Vision Controller.  
  
 +
Amend the IP address of Port#1 to match your network configuration:
  
Two Ethernet ports should be available for configuration, it is recommended to configure '''Port#1''' for communication with Vision Controller:
 
  
 +
[[File:Fanuc tutorial Step2 2.png|frame|none|alt=Alt text| Figure 2.1.2]]
  
[[File:Fanuc tutorial Step2 2.png]]
 
  
 +
If you use ROBOGUIDE for workcell commissioning, configure '''Port#2''' for transferring files between the robot controller and your PC.
  
If you use ROBOGUIDE for workcell commisioning, configure '''Port#2''' for transferring files between robot controller and your PC:
+
Click '''F3[PORT]''' to switch between Port#1 and Port#2 and amend the IP address of Port#2 to match your network configuration:
  
  
[[File:Fanuc tutorial Step3.png]]
+
[[File:Fanuc tutorial Step3.png|frame|none|alt=Alt text| Figure 2.1.3]]
  
  
 
=== 2.2 Configure TCP/IP Server ===
 
=== 2.2 Configure TCP/IP Server ===
  
Photoneo Fanuc Module requires State Server to run as a background task on robot controller. Configured TCP/IP server is necessary for this purpose.
+
The Photoneo Fanuc Module requires State Server to run as a background task on the robot controller. A configured TCP/IP server is required for this purpose.
  
 
Press '''Menu''' -> '''Setup''' -> '''Host Comm''' -> '''F4[SHOW]''' and select '''Servers'''
 
Press '''Menu''' -> '''Setup''' -> '''Host Comm''' -> '''F4[SHOW]''' and select '''Servers'''
  
  
[[File:Fanuc tutorial Step4.png]]
+
[[File:Fanuc tutorial Step4.png|frame|none|alt=Alt text| Figure 2.2.1]]
  
  
'''Select S3 slot''' - we keep S1 and S2 slots reserved for user application.
+
'''Select S3 slot''' - the S1 and S2 slots are reserved for user applications.
  
  
[[File:Fanuc tutorial Step5.png]]
+
[[File:Fanuc tutorial Step5.png|frame|none|alt=Alt text| Figure 2.2.2]]
  
  
Configure TCP/IP server S3 as shown in the figure below:
+
Configure '''TCP/IP server S3''' as is shown in the figure below:
  
  
[[File:Fanuc tutorial Step6.png]]
+
[[File:Fanuc tutorial Step6.png|frame|none|alt=Alt text| Figure 2.2.3]]
  
  
 
=== 2.3 Configure TCP/IP Client ===
 
=== 2.3 Configure TCP/IP Client ===
  
The main Photoneo Bin Picking application works in client mode. Configured TCP/IP Client is necessary for this purpose.
+
The main Photoneo Bin Picking application works in client mode. Configure the TCP/IP Client for this purpose.
  
 
Press '''Menu''' -> '''Setup''' -> '''Host Comm''' -> '''F4[SHOW]''' and select '''Clients'''
 
Press '''Menu''' -> '''Setup''' -> '''Host Comm''' -> '''F4[SHOW]''' and select '''Clients'''
  
  
[[File:Fanuc tutorial Step4.png]]
+
[[File:Fanuc tutorial Step4.png|frame|none|alt=Alt text| Figure 2.3.1]]
 +
 
  
 +
'''Select C3 slot''' - the C1 and C2 slots are reserved for user applications.
  
'''Select C3 slot''' - we keep C1 and C2 slots reserved for user application.
 
  
 +
[[File:Fanuc tutorial Step7.png|frame|none|alt=Alt text| Figure 2.3.2]]
  
[[File:Fanuc tutorial Step7.png]]
 
  
 +
Configuration of the '''TCP/IP client C3''' is shown in the figure below:
  
Configure TCP/IP client C3 as shown in the figure below:
+
'''Set the SERVER IP/HOSTNAME according to the Vision Controller Robotic Interface IP address!'''
  
  
[[File:Fanuc tutorial Step9.png]]
+
[[File:Fanuc tutorial Step9.png|frame|none|alt=Alt text| Figure 2.3.3]]
  
  
 
=== 2.4 Change Cartesian Origin of Robot ===
 
=== 2.4 Change Cartesian Origin of Robot ===
  
The Cartesian origin of Fanuc robots is different than the Cartesian origin of robot models used in the Photoneo Binpicking Studio. In order to ensure successful calibration, we need to apply predefined offset in Z axis in UFRAME.
+
The Cartesian origin of Fanuc robots is different to the Cartesian origin of robot models used in the Photoneo Bin Picking Studio.  
 +
 
 +
In order to ensure successful calibration, it is necessary to apply a predefined offset in the Z axis in UFRAME.
 +
 
 +
Press '''Menu''' -> '''Next''' -> '''System''' -> '''Variables''' and scroll down until you find the system variable named '''GROUP'''. (Use Shift to scroll faster)
 +
 
 +
 
 +
[[File:Fanuc group step 1.png|frame|none|alt=Alt text| Figure 2.4.1]]
 +
 
 +
 
 +
Press '''Enter''' to open the list of options in '''GROUP''' and find '''UFRAME''' as is shown in the figure below:
 +
 
 +
 
 +
[[File:Fanuc group step 2.png|frame|none|alt=Alt text| Figure 2.4.2]]
 +
 
 +
 
 +
Edit the '''Z''' value of '''UFRAME''' according to the Offset table below.
 +
 
 +
 
 +
[[File:Fanuc group step 3.png|frame|none|alt=Alt text| Figure 2.4.3]]
 +
 
 +
 
 +
List of '''Z axis offsets''' for specific robot models:
 +
 
 +
 
 +
[[File: Fanuc Offset table June 2019.png|frame|none|alt=Alt text| Figure 2.4.4]]
 +
 
 +
 
 +
'''NOTE: Be careful as these changes might affect previously taught Cartesian positions !!!'''
 +
 
 +
=== 2.5 Load Photoneo Fanuc Module Files ===
 +
 
 +
The Photoneo Fanuc Interface consists of two Karel binaries and approximately 20 TP programs. All of these files need to be copied to the robot controller in order to get Photoneo Fanuc Module up and running. 
 +
 
 +
Extract the Photoneo Fanuc Module archive (.zip file) which you received with Photoneo Bin Picking Studio to the USB stick and plug it the into Teach Pendant.
 +
 
 +
Press '''Menu''' -> '''File''' -> '''File''' -> '''F5[UTILS]''' and select '''Set Device''':
 +
 
 +
 
 +
[[File:Fanuc tutorial Step13.png|frame|none|alt=Alt text| Figure 2.5.1]]
 +
 
 +
 
 +
Select '''USB on TP (UT1:)''' option as is shown in the figure below:
 +
 
 +
 
 +
[[File:Fanuc tutorial Step14.png|frame|none|alt=Alt text| Figure 2.5.2]]
 +
 
 +
 
 +
Press '''F2[DIR]''' to set the directory subset and select "*.*(all files)" to show all items on the USB.
 +
 
 +
 
 +
[[File:Fanuc tutorial Step15.png|frame|none|alt=Alt text| Figure 2.5.3]]
 +
 
 +
 
 +
Select '''*.*(all files)''' within '''PHOTONEO_FANUC_MODULE''' and press '''F3[LOAD]''' and '''YES''' to load the files from the Photoneo Fanuc Module to the robot controller:
 +
 
 +
 
 +
[[File:Fanuc tutorial Step16 2.png|frame|none|alt=Alt text| Figure 2.5.4]]
 +
 
 +
 
 +
Press '''Select''' button to verify that all TP and Karel programs have been loaded successfully:
 +
 
 +
 
 +
[[File:Fanuc tutorial Step17 2.png|frame|none|alt=Alt text| Figure 2.5.5]]
 +
 
 +
 
 +
=== 2.6 Enable Autostart of State Server ===
 +
 
 +
The next step of the process is to configure State Server to start automatically after boot.
 +
 
 +
Press '''Menu''' -> '''Next''' -> '''System''' -> '''Variables''' and scroll down to find the '''SHELL_CFG''' variable
 +
 
 +
 
 +
[[File:Fanuc tutorial Step18.png|frame|none|alt=Alt text| Figure 2.6.1]]
 +
 
 +
 
 +
Edit '''SHELL_NAME''' and '''SHELL_EXT''' to match the details shown in the figure below:
 +
 
 +
 
 +
[[File:Fanuc tutorial Step19.png|frame|none|alt=Alt text| Figure 2.6.2]]
 +
 
 +
 
 +
Cycle power to apply all changes. Press '''FCTN''' -> '''NEXT''' -> '''CYCLE POWER''' and confirm YES.
 +
 
 +
 
 +
[[File:Fanuc tutorial Step20.png|frame|none|alt=Alt text| Figure 2.6.3]]
 +
 
 +
 
 +
If everything has been set correctly, you should see '''PHOSTATE: Waiting for connection...''' on the User screen immediately after the boot:
 +
 
 +
 
 +
[[File:Fanuc tutorial Step21.png|frame|none|alt=Alt text| Figure 2.6.4]]
 +
 
  
Press '''Menu''' -> '''Next''' -> '''System''' -> '''Variables''' and scroll down until you find system variable named '''GROUP'''
+
=== 2.7 Data Registers Used ===
  
 +
Press '''Data''' to open the '''Data Registers''' screen. As you can see in the figure below, the Photoneo Fanuc Module has automatically added comments to '''Data Registers R[1] - R[34]''' that are utilized for bin picking application.
  
[[File:Fanuc tutorial Step10.png]]
+
'''NOTE: Prevent using registers R[1]-R[34] in your application !!!'''
  
  
Press '''Enter''' to open GROUP menu and select '''UFRAME''' option as shown in the figure below:  
+
[[File:Fanuc tutorial Step22.png|frame|none|alt=Alt text| Figure 2.7.1]]
  
 +
=== 2.8 Teach Home, Start and End positions ===
  
[[File:Fanuc tutorial Step11.png]]
+
A crucial step of bin picking configuration is the teaching of home, start, and end poses. The home position of the robot should be taught in such a way that the robot remain outside the scanning area. The start position should be taught in such a way that the robot gripper is approximately above the center of the bin. The end position can be similar to the start position or slightly shifted towards the placing area. Do not position the end pose too far from the bin as this might significantly affect dynamic trajectory planning, increase total planning time and cause planning errors.
  
 +
In order to switch from Standard Registers to Position Registers press '''F1[TYPE]''' -> '''Position Registers'''
  
Edit the '''Z axis''' value according Offset table below and the arm you are using for your application.
+
NOTE: The default range of position registers is usually PR[1] - PR[100]. For full functionality of the Photoneo Fanuc Module, users are highly recommended to increase the range up to 120 position registers or more. Since this is a maintenance operation, please contact your local Fanuc support to help you with this step. Be careful since there is a possibility that previously taught positions and other register data could be lost during this operation!
  
  
[[File:Fanuc tutorial Step12.png]]
+
[[File:Fanuc tutorial Step23.png|frame|none|alt=Alt text| Figure 2.7.2]]
  
  
'''NOTE: Be careful since this change might affect your previously taught Cartesian positions'''
+
As with Standard Registers, the Photoneo Fanuc Module has automatically added comments to the Position Registers utilized for the bin picking application. As can be seen in the figure below, the Photoneo Fanuc Module utilizes '''PR[1]-PR[3]''' for Home, Start & End poses, '''PR[4]-PR[9]''' for calibration poses, and '''PR[20]-PR[120]''' for trajectory transfers. '''PR[10]-PR[19]''' are available for user applications.
  
 +
In order to teach the Home position, jog the robot to the desired pose, select register '''PR[1]''' and press '''Shift''' + '''F3[RECORD]''' to record the position.
  
=== 2.4 Load Photoneo Fanuc Module Files ===
+
You should see that the asterisk has changed to an '''R''' sign if the teach position command has been successful.
  
  
 +
[[File:Fanuc tutorial Step24.png|frame|none|alt=Alt text| Figure 2.7.3]]
  
[[File:Fanuc tutorial Step13.png]]
 
  
 +
For full operation of bin picking, internal representations of Home, Start and End must be switched from '''Cartesian''' to '''Joint'''. In order to achieve this, press '''F4[Position]''' ->'''F5[REPRE]''' -> '''Joint'''
  
[[File:Fanuc tutorial Step14.png]]
 
  
 +
[[File:Fanuc tutorial Step26.png|frame|none|alt=Alt text| Figure 2.7.4]]
  
[[File:Fanuc tutorial Step15.png]]
 
  
 +
Confirm the switching of representation by pressing '''Continue'''. Repeat the same procedure for the '''Start''' and '''End''' poses.
  
[[File:Fanuc tutorial Step16.png]]
+
''NOTE: If you utilize Calibration poses in your application, these do not need to be switched to Joint representation.''
  
  
[[File:Fanuc tutorial Step17.png]]
+
[[File:Fanuc tutorial Step27.png|frame|none|alt=Alt text| Figure 2.7.5]]
  
  
[[File:Fanuc tutorial Step18.png]]
+
At this point your Robot Controller is configured to work with the Photoneo Bin Picking Studio. However the TP code should also be amended to meet the precise requirements of your application. This may involve updating part placing, gripper commands or application logic. The following section of the tutorial provides some basic examples of how this can be programmed as well as a detailed explanation of the Photoneo TP API.
  
 +
== 3. TP LANGUAGE ==
  
[[File:Fanuc tutorial Step19.png]]
+
The Photoneo Fanuc Module was designed to be easily integrated into existing applications written as TP programs.  
  
 +
=== 3.1 TP API ===
  
[[File:Fanuc tutorial Step20.png]]
+
The Photoneo Fanuc TP API is comprised of the following programs. These are intended for high level control of bin picking sequences and are usually called in PHO_MAIN program.  
  
 +
'''PHO_REQ_SCAN''' - request to trigger the next scan and localization. Non-blocking request; the TP program continues immediately at the next line.
  
[[File:Fanuc tutorial Step21.png]]
+
'''PHO_WAIT_SCAN''' - function to wait for scan to be finished. This should be called after triggering the scan, but not does not have to be called immediately. Blocking function, waits for response from the Vision Controller.
  
 +
'''PHO_TRAJ_REQ''' - request to start trajectory planning for current goal. Non-blocking function; the TP program continues immediately at the next line.
  
[[File:Fanuc tutorial Step22.png]]
+
'''PHO_TRAJ_RECV''' - function to receive requested bin picking trajectories (consisting of a sequence of trajectory and gripper operations). Blocking function; waits for motion data to be received.
  
 +
'''PHO_INIT''' - request to initialize bin picking application from the Vision Controller side. Start and End Poses defined by the operator from Teach Pendant are transferred to the Vision Controller and used in the trajectory planning pipeline as start and terminus points.
  
[[File:Fanuc tutorial Step23.png]]
+
'''PHO_CALIB_ADD''' - request to add calibration point - a scan is triggered and the calibration is recalculated. Blocking request; the program will not continue until the calibration result is recalculated and has been received by the Robot Controller.
  
 +
'''PHO_CALIB_SET''' - request to set current calibration result to the PhoXi Scanner.
  
[[File:Fanuc tutorial Step24.png]]
+
'''PHO_CALIB_RESET''' - request to reset current calibration and remove all previously added points.
  
 +
=== 3.2 TP CONFIG ===
  
[[File:Fanuc tutorial Step25.png]]
+
The following programs enable the user to configure several bin picking settings, to implement gripper commands and to amend the placing of the attached object.  
  
 +
'''PHO_GRIP_ATT''' - implement function for attaching object to gripper here.
  
[[File:Fanuc tutorial Step26.png]]
+
'''PHO_GRIP_DEATT''' - implement function for detaching object from gripper here.
  
 +
'''PHO_GRIP_USER1''' - implement function for custom gripper command (reserved for future use).
  
[[File:Fanuc tutorial Step27.png]]
+
'''PHO_GRIP_USER2''' - implement function for custom gripper command (reserved for future use).
  
 +
'''PHO_GRIP_USER3''' - implement function for custom gripper command (reserved for future use).
  
[[File:Fanuc tutorial Step28.png]]
+
'''PHO_GRIP_USER4''' - implement function for custom gripper command (reserved for future use).
  
 +
'''PHO_GRIP_USER5''' - implement function for custom gripper command (reserved for future use).
  
[[File:Fanuc tutorial Step29.png]]
+
'''PHO_GRIP_USER6''' - implement function for custom gripper command (reserved for future use).
  
 +
'''PHO_PICK_PART''' - standard bin picking sequence. This flexible, operation-based implementation allows the execution of bin picking sequences, which consist of various numbers of operations (Trajectories + Gripper commands).
  
 +
'''PHO_PLACE_PART''' - implement function for placing attached object
  
Plug Ethernet cable to appropriate socket in the Fanuc controller cabinet, restart the robot controller and try to ping
+
=== 3.3 TP ERROR HANDLING ===
  
robot controller from the Vision Controller. If simple ping works, you can proceed to the configuration of robot controller communication.
+
The Photoneo FANUC interface provides basic error handling. If an error occurs during bin picking operations, an error code is returned in Register '''R[19] - PHO ERROR DATA'''.  
  
 +
The following list shows the potential bin picking error codes:
  
 +
'''OK = 0''' - Service response from Vision Controller is valid
  
=== 2.2 Configure State Server ===
+
'''SERVICE_ERR = 1''' - Service response from Vision Controller is invalid.
  
Now we will configure communication server for reporting current joint and tool poses to the Vision Controller
+
'''UNKNOWN_REQ = 2''' - The Vision Controller received an unknown request.
  
On Pendant press '''Menu''' -> '''Setup''' -> '''Host Comm''' -> '''F4[SHOW]''' -> '''Servers'''. Following list should appear:
+
'''COMM_FAILURE = 3''' - Communication failure due to socket closure.
  
[[File:Fanuc state server config 1.png]]
+
'''BAD_DATA = 4''' - Data validation check has failed.
  
 +
'''TIMEOUT = 5''' - Communication failure due to socket timeout.
  
Enter S3 settings and configure '''PHOSTATE''' as shown in the figure below:
+
'''PLANNING_FAILED = 201''' - Trajectory planning has failed
  
 +
'''NO_PART_FOUND = 202''' - No part has been localized
  
[[File:Fanuc state server config 2.png]]
+
'''NOT_INIT = 203''' - Binpicking application has not been properly initialized on Vision Controller
  
 +
'''UNKNOWN_ERR = 299''' - Unspecified internal error
  
Now, we need to set the server port which will be utilized for the communication.  
+
Photoneo Fanuc Interface by default performs basic error handling immediately after the '''TRAJ_RECV''' program call.  
  
Using pendant navigate to '''Menu''' -> '''Next''' -> '''System''' -> '''Variables'''.
+
If '''NOT_INIT''' or '''SERVICE_ERR''' occurs, the whole bin picking is reinitialized.  
  
Hold '''SHIFT''' to speed up scrolling and press '''ARROW DOWN''' several times to find - '''HOSTS_CFG''' as shown in the figure below:
+
If '''PLANNING_FAILED''' or '''NO_PART_FOUND''' occurs, scanning is repeated.
  
 +
It is up to the user to decide if existing error handling is sufficient for particular application or if it needs to be expanded. 
  
[[File:Fanuc state server config 3.png]]
+
=== 3.4 MAIN APPLICATION ===
  
 +
'''PHO_MAIN''' program can be considered as a basic bin picking template. The main program loop with basic error handling is implemented here. User can amend the details to meet their application requirements. 
  
For State Server - '''S3''' set '''SERVER_PORT''' system variable to '''11004'''. (Be careful! SERVER_PORT and PORT are different items!)
+
  1:  !Start Phoclient 
 +
  2:  RUN PHOCLIENT
 +
  3:  !Initialize Binpicking
 +
  4:  LBL[1]
 +
  5:  CALL PHO_INIT   
 +
  6:  !Clear REINIT flag
 +
  7:  F[8]=(OFF)
 +
  8:  WAIT  1.00(sec)
 +
  9:  LBL[2]
 +
  10:  !Move to Home Position
 +
  11:J PR[1] 100% FINE   
 +
  12:  !Request First Scan
 +
  13:  CALL PHO_REQ_SCAN   
 +
  14:  !Clear REPLAN flag
 +
  15:  F[9]=(OFF)  
 +
  16:  !Main Loop
 +
  17:  LBL[3]
 +
  18:  !Wait For Scan
 +
  19:  CALL PHO_WAIT_SCAN   
 +
  20:  !Request Trajectory
 +
  21:  CALL PHO_REQ_TRAJ   
 +
  22:  !Receive Trajectory
 +
  23:  CALL PHO_TRAJ_RECV   
 +
  24:  !Check Reinit Flag
 +
  25:  IF (F[8]=ON),JMP LBL[1]
 +
  26:  !Check Replan Flag
 +
  27:  IF (F[9]=ON),JMP LBL[2]
 +
  28:  !Pick Part
 +
  29:  CALL PHO_PICK_PART   
 +
  30:  !Request Next Scan
 +
  31:  CALL PHO_REQ_SCAN 
 +
  32:  !Place Part To Defined Spot
 +
  33:  CALL PHO_PLACE_PART   
 +
  34:  JMP LBL[3]
 +
  /POS
 +
  /END
  
  
[[File:Fanuc state server config 4.png]]
+
== 4. Runtime ==
  
=== 2.3 Configure Binpicking Client ===
+
Now you are ready to start the bin picking application. Press '''Select''' button and choose the '''PHO_MAIN''' program:
  
As a next step we will configure communication client for transferring requests/responses between the Vision and Fanuc Controller.
 
  
On Pendant press '''Menu''' -> '''Setup''' -> '''Host Comm''' -> '''F4[SHOW]''' -> '''Clients'''. Following list should appear:
+
[[File:Fanuc tutorial Step28 2.png|frame|none|alt=Alt text| Figure 4.1]]
  
  
[[File:Fanuc_bp_client_config_1.png]]
+
Ensure that the Bin Picking application on the Vision Controller side is running and waiting for a connection:
  
  
Enter '''C3''' settings and configure '''PHOCLIENT''' as shown in the figure below.
+
[[File:Fanuc tutorial Step waiting.png|frame|none|alt=Alt text| Figure 4.2]]
  
'''Do not forget to input an IP address of Vision Controller Server here!'''
 
  
 +
Start the PHO_MAIN program in Manual or Auto mode and if everything has been configured correctly, you should see a message stating that '''PHOCLIENT has established connection with Vision Controller''':
  
[[File:Fanuc_bp_client_config_2.png]]
 
  
 +
[[File:Fanuc tutorial Step29.png|frame|none|alt=Alt text| Figure 4.3]]
  
Hold '''SHIFT''' to speed up scrolling and press '''ARROW DOWN''' several times to find '''HOSTC_CFG''' as shown in the figure below
 
  
 +
If the connection between the robot controller and the vision controller has been established properly, the robot should move to the Home position and the Bin picking status should show: '''Connected'''
  
[[File:Fanuc_bp_client_config_3.png]]
 
  
 +
[[File:Fanuc tutorial Step connected.png|frame|none|alt=Alt text| Figure 4.4]]
  
For '''C3''' set '''SERVER_PORT''' system variable to '''11003''' (Be careful! SERVER_PORT and PORT are different items!)
 
  
 +
As soon as the trajectory to the first localized object is calculated, the robot should start executing the motion.
  
[[File:Fanuc_bp_client_config_4.png]]
+
'''NOTE: Ensure that you are prepared to halt the motion execution immediately if any problem arises. It is strongly recommended to reduce the speed to 10% of maximum during initial bin picking tests.'''

Latest revision as of 19:03, 6 May 2019

NOTE: Users are strongly recommended to read the general introduction to robot interfaces prior to installing specific robot modules.

1. Prerequisites

Prior to setup, please ensure that your Fanuc controller meets the following criteria:

- System version 8.10 and higher (Versions 6.40 - 7.70 are also supported with certain limitations)

- R648 User Socket Msg - Socket Communication option available

Click Menu -> Next -> Status -> Version ID -> Next -> F3[ORDER FI] to verify that the User Socket Msg option is installed on your robot controller (see figure below):


Alt text
Figure 1.1

2. Fanuc Controller Setup

2.1 Set IP Addresses

The first step of the process is to configure the IP addresses of the robot controller.

Using Teach Pendant, press Menu -> Setup -> Host Comm -> TCP/IP -> F3[Detail]:


Alt text
Figure 2.1.1


Two Ethernet ports should be available; users are recommended to configure Port#1 for communication with Vision Controller.

Amend the IP address of Port#1 to match your network configuration:


Alt text
Figure 2.1.2


If you use ROBOGUIDE for workcell commissioning, configure Port#2 for transferring files between the robot controller and your PC.

Click F3[PORT] to switch between Port#1 and Port#2 and amend the IP address of Port#2 to match your network configuration:


Alt text
Figure 2.1.3


2.2 Configure TCP/IP Server

The Photoneo Fanuc Module requires State Server to run as a background task on the robot controller. A configured TCP/IP server is required for this purpose.

Press Menu -> Setup -> Host Comm -> F4[SHOW] and select Servers


Alt text
Figure 2.2.1


Select S3 slot - the S1 and S2 slots are reserved for user applications.


Alt text
Figure 2.2.2


Configure TCP/IP server S3 as is shown in the figure below:


Alt text
Figure 2.2.3


2.3 Configure TCP/IP Client

The main Photoneo Bin Picking application works in client mode. Configure the TCP/IP Client for this purpose.

Press Menu -> Setup -> Host Comm -> F4[SHOW] and select Clients


Alt text
Figure 2.3.1


Select C3 slot - the C1 and C2 slots are reserved for user applications.


Alt text
Figure 2.3.2


Configuration of the TCP/IP client C3 is shown in the figure below:

Set the SERVER IP/HOSTNAME according to the Vision Controller Robotic Interface IP address!


Alt text
Figure 2.3.3


2.4 Change Cartesian Origin of Robot

The Cartesian origin of Fanuc robots is different to the Cartesian origin of robot models used in the Photoneo Bin Picking Studio.

In order to ensure successful calibration, it is necessary to apply a predefined offset in the Z axis in UFRAME.

Press Menu -> Next -> System -> Variables and scroll down until you find the system variable named GROUP. (Use Shift to scroll faster)


Alt text
Figure 2.4.1


Press Enter to open the list of options in GROUP and find UFRAME as is shown in the figure below:


Alt text
Figure 2.4.2


Edit the Z value of UFRAME according to the Offset table below.


Alt text
Figure 2.4.3


List of Z axis offsets for specific robot models:


Alt text
Figure 2.4.4


NOTE: Be careful as these changes might affect previously taught Cartesian positions !!!

2.5 Load Photoneo Fanuc Module Files

The Photoneo Fanuc Interface consists of two Karel binaries and approximately 20 TP programs. All of these files need to be copied to the robot controller in order to get Photoneo Fanuc Module up and running.

Extract the Photoneo Fanuc Module archive (.zip file) which you received with Photoneo Bin Picking Studio to the USB stick and plug it the into Teach Pendant.

Press Menu -> File -> File -> F5[UTILS] and select Set Device:


Alt text
Figure 2.5.1


Select USB on TP (UT1:) option as is shown in the figure below:


Alt text
Figure 2.5.2


Press F2[DIR] to set the directory subset and select "*.*(all files)" to show all items on the USB.


Alt text
Figure 2.5.3


Select *.*(all files) within PHOTONEO_FANUC_MODULE and press F3[LOAD] and YES to load the files from the Photoneo Fanuc Module to the robot controller:


Alt text
Figure 2.5.4


Press Select button to verify that all TP and Karel programs have been loaded successfully:


Alt text
Figure 2.5.5


2.6 Enable Autostart of State Server

The next step of the process is to configure State Server to start automatically after boot.

Press Menu -> Next -> System -> Variables and scroll down to find the SHELL_CFG variable


Alt text
Figure 2.6.1


Edit SHELL_NAME and SHELL_EXT to match the details shown in the figure below:


Alt text
Figure 2.6.2


Cycle power to apply all changes. Press FCTN -> NEXT -> CYCLE POWER and confirm YES.


Alt text
Figure 2.6.3


If everything has been set correctly, you should see PHOSTATE: Waiting for connection... on the User screen immediately after the boot:


Alt text
Figure 2.6.4


2.7 Data Registers Used

Press Data to open the Data Registers screen. As you can see in the figure below, the Photoneo Fanuc Module has automatically added comments to Data Registers R[1] - R[34] that are utilized for bin picking application.

NOTE: Prevent using registers R[1]-R[34] in your application !!!


Alt text
Figure 2.7.1

2.8 Teach Home, Start and End positions

A crucial step of bin picking configuration is the teaching of home, start, and end poses. The home position of the robot should be taught in such a way that the robot remain outside the scanning area. The start position should be taught in such a way that the robot gripper is approximately above the center of the bin. The end position can be similar to the start position or slightly shifted towards the placing area. Do not position the end pose too far from the bin as this might significantly affect dynamic trajectory planning, increase total planning time and cause planning errors.

In order to switch from Standard Registers to Position Registers press F1[TYPE] -> Position Registers

NOTE: The default range of position registers is usually PR[1] - PR[100]. For full functionality of the Photoneo Fanuc Module, users are highly recommended to increase the range up to 120 position registers or more. Since this is a maintenance operation, please contact your local Fanuc support to help you with this step. Be careful since there is a possibility that previously taught positions and other register data could be lost during this operation!


Alt text
Figure 2.7.2


As with Standard Registers, the Photoneo Fanuc Module has automatically added comments to the Position Registers utilized for the bin picking application. As can be seen in the figure below, the Photoneo Fanuc Module utilizes PR[1]-PR[3] for Home, Start & End poses, PR[4]-PR[9] for calibration poses, and PR[20]-PR[120] for trajectory transfers. PR[10]-PR[19] are available for user applications.

In order to teach the Home position, jog the robot to the desired pose, select register PR[1] and press Shift + F3[RECORD] to record the position.

You should see that the asterisk has changed to an R sign if the teach position command has been successful.


Alt text
Figure 2.7.3


For full operation of bin picking, internal representations of Home, Start and End must be switched from Cartesian to Joint. In order to achieve this, press F4[Position] ->F5[REPRE] -> Joint


Alt text
Figure 2.7.4


Confirm the switching of representation by pressing Continue. Repeat the same procedure for the Start and End poses.

NOTE: If you utilize Calibration poses in your application, these do not need to be switched to Joint representation.


Alt text
Figure 2.7.5


At this point your Robot Controller is configured to work with the Photoneo Bin Picking Studio. However the TP code should also be amended to meet the precise requirements of your application. This may involve updating part placing, gripper commands or application logic. The following section of the tutorial provides some basic examples of how this can be programmed as well as a detailed explanation of the Photoneo TP API.

3. TP LANGUAGE

The Photoneo Fanuc Module was designed to be easily integrated into existing applications written as TP programs.

3.1 TP API

The Photoneo Fanuc TP API is comprised of the following programs. These are intended for high level control of bin picking sequences and are usually called in PHO_MAIN program.

PHO_REQ_SCAN - request to trigger the next scan and localization. Non-blocking request; the TP program continues immediately at the next line.

PHO_WAIT_SCAN - function to wait for scan to be finished. This should be called after triggering the scan, but not does not have to be called immediately. Blocking function, waits for response from the Vision Controller.

PHO_TRAJ_REQ - request to start trajectory planning for current goal. Non-blocking function; the TP program continues immediately at the next line.

PHO_TRAJ_RECV - function to receive requested bin picking trajectories (consisting of a sequence of trajectory and gripper operations). Blocking function; waits for motion data to be received.

PHO_INIT - request to initialize bin picking application from the Vision Controller side. Start and End Poses defined by the operator from Teach Pendant are transferred to the Vision Controller and used in the trajectory planning pipeline as start and terminus points.

PHO_CALIB_ADD - request to add calibration point - a scan is triggered and the calibration is recalculated. Blocking request; the program will not continue until the calibration result is recalculated and has been received by the Robot Controller.

PHO_CALIB_SET - request to set current calibration result to the PhoXi Scanner.

PHO_CALIB_RESET - request to reset current calibration and remove all previously added points.

3.2 TP CONFIG

The following programs enable the user to configure several bin picking settings, to implement gripper commands and to amend the placing of the attached object.

PHO_GRIP_ATT - implement function for attaching object to gripper here.

PHO_GRIP_DEATT - implement function for detaching object from gripper here.

PHO_GRIP_USER1 - implement function for custom gripper command (reserved for future use).

PHO_GRIP_USER2 - implement function for custom gripper command (reserved for future use).

PHO_GRIP_USER3 - implement function for custom gripper command (reserved for future use).

PHO_GRIP_USER4 - implement function for custom gripper command (reserved for future use).

PHO_GRIP_USER5 - implement function for custom gripper command (reserved for future use).

PHO_GRIP_USER6 - implement function for custom gripper command (reserved for future use).

PHO_PICK_PART - standard bin picking sequence. This flexible, operation-based implementation allows the execution of bin picking sequences, which consist of various numbers of operations (Trajectories + Gripper commands).

PHO_PLACE_PART - implement function for placing attached object

3.3 TP ERROR HANDLING

The Photoneo FANUC interface provides basic error handling. If an error occurs during bin picking operations, an error code is returned in Register R[19] - PHO ERROR DATA.

The following list shows the potential bin picking error codes:

OK = 0 - Service response from Vision Controller is valid

SERVICE_ERR = 1 - Service response from Vision Controller is invalid.

UNKNOWN_REQ = 2 - The Vision Controller received an unknown request.

COMM_FAILURE = 3 - Communication failure due to socket closure.

BAD_DATA = 4 - Data validation check has failed.

TIMEOUT = 5 - Communication failure due to socket timeout.

PLANNING_FAILED = 201 - Trajectory planning has failed

NO_PART_FOUND = 202 - No part has been localized

NOT_INIT = 203 - Binpicking application has not been properly initialized on Vision Controller

UNKNOWN_ERR = 299 - Unspecified internal error

Photoneo Fanuc Interface by default performs basic error handling immediately after the TRAJ_RECV program call.

If NOT_INIT or SERVICE_ERR occurs, the whole bin picking is reinitialized.

If PLANNING_FAILED or NO_PART_FOUND occurs, scanning is repeated.

It is up to the user to decide if existing error handling is sufficient for particular application or if it needs to be expanded.

3.4 MAIN APPLICATION

PHO_MAIN program can be considered as a basic bin picking template. The main program loop with basic error handling is implemented here. User can amend the details to meet their application requirements.

  1:  !Start Phoclient  
  2:  RUN PHOCLIENT 
  3:  !Initialize Binpicking 
  4:  LBL[1] 
  5:  CALL PHO_INIT    
  6:  !Clear REINIT flag 
  7:  F[8]=(OFF) 
  8:  WAIT   1.00(sec) 
  9:  LBL[2] 
 10:  !Move to Home Position 
 11:J PR[1] 100% FINE    
 12:  !Request First Scan 
 13:  CALL PHO_REQ_SCAN    
 14:  !Clear REPLAN flag 
 15:  F[9]=(OFF) 
 16:  !Main Loop 
 17:  LBL[3] 
 18:  !Wait For Scan 
 19:  CALL PHO_WAIT_SCAN    
 20:  !Request Trajectory 
 21:  CALL PHO_REQ_TRAJ    
 22:  !Receive Trajectory 
 23:  CALL PHO_TRAJ_RECV    
 24:  !Check Reinit Flag 
 25:  IF (F[8]=ON),JMP LBL[1] 
 26:  !Check Replan Flag 
 27:  IF (F[9]=ON),JMP LBL[2] 
 28:  !Pick Part 
 29:  CALL PHO_PICK_PART    
 30:  !Request Next Scan 
 31:  CALL PHO_REQ_SCAN   
 32:  !Place Part To Defined Spot 
 33:  CALL PHO_PLACE_PART    
 34:  JMP LBL[3] 
 /POS
 /END


4. Runtime

Now you are ready to start the bin picking application. Press Select button and choose the PHO_MAIN program:


Alt text
Figure 4.1


Ensure that the Bin Picking application on the Vision Controller side is running and waiting for a connection:


Alt text
Figure 4.2


Start the PHO_MAIN program in Manual or Auto mode and if everything has been configured correctly, you should see a message stating that PHOCLIENT has established connection with Vision Controller:


Alt text
Figure 4.3


If the connection between the robot controller and the vision controller has been established properly, the robot should move to the Home position and the Bin picking status should show: Connected


Alt text
Figure 4.4


As soon as the trajectory to the first localized object is calculated, the robot should start executing the motion.

NOTE: Ensure that you are prepared to halt the motion execution immediately if any problem arises. It is strongly recommended to reduce the speed to 10% of maximum during initial bin picking tests.