Locator Tutorial: Setting up Locator to work with FANUC robots

From 3D scanning Knowledge base - Photoneo wiki
Revision as of 11:41, 14 December 2018 by Durovsky (talk | contribs)

Jump to: navigation, search

Users are strongly recommended to read Locator Tutorial: Introduction prior to installation of specific robot intere

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 R648 User Socket Msg option is installed on your robot controller (see figure below):


Fanuc Locator Setting Up Guide Prerequisities.png

2. Fanuc Controller Setup

2.1 Set IP Addresses of Ethernet Ports

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]:


Fanuc tutorial Step2.png


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

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


Fanuc Locator Setting Up Guide IP.png


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:


Fanuc tutorial Step3.png


2.3 Configure TCP/IP Client

The main Locator Fanuc Interface works in the client mode. Configure the TCP/IP Client for this purpose.

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


Fanuc Locator Setting Up Guide Clients.png


Select C1 slot


Fanuc Locator Setting Up Guide Clients Select.png


Configure the TCP/IP Client C1 as is shown in the figure below:

NOTE: Set the IP address of the Vision Controller to SERVER IP/HOSTNAME


Fanuc Locator Setting Up Guide Client Setup.png

3. Locator Fanuc Interface Setup

The Locator Fanuc Interface consists of one Karel binary and four TP programs. All of these files need to be copied to the robot controller in order to get the Locator Fanuc Interface up and running.

Extract the Locator Fanuc Interface archive (.zip file) to the USB stick and plug it the into the Teach Pendant.

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


Fanuc Locator Setting Up Guide Files 1.png


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


Fanuc Locator Setting Up Guide Files 2.png


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


Fanuc Locator Setting Up Guide Files 3.png


Select the files one by one, press F3[LOAD] and YES to load the programs to the robot controller:


Fanuc Locator Setting Up Guide Files 4.png


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


Fanuc Locator Setting Up Guide Files 5.png

4. Calibration

Robot Camera Calibration is a crucial step in Locator configuration. Accurate calibration guarantees that the object positions will be calculated directly in Robot Base coordinates.

4.1 Robot - Camera Calibration

Mount the Scanner firmly, ensure that the scene is properly captured from the final position and start the Photoneo Robot Camera Calibrator:


KUKA SettingUp Guide Scanner Calibration 10.png


It is highly recommended to clear UTOOL values prior to calibration.

Browse to Menu -> Setup -> Frames and select the one you want to use for calibration, in this case Tool[1] was used.


Fanuc Locator Setting Up Guide Frames.png


Ensure that all UTOOL values are all cleared:


Fanuc Locator Setting Up Guide Zero Frame.png


Connect to the Scanner, select XYZ_Extrinsic formalism (Standard for FANUC robots), adjust the Sphere radius (21.75 mm in this case/ 20.00 mm for standard ping-pong ball) and set the Min visible parameter to 40%:


File Fanuc Locator Setting Up Guide Calib 0001.png


Attach a ping-pong ball to the gripper, and jog the robot to the first position (usually the nearest corner of the bin/ area of interest).

On the Fanuc Pendant press POSN button -> F4[WORLD] to obtain the current TOOL[1] position with respect to the robot WORLD frame:


Fanuc Locator Setting Up Guide Calib 0002.png


Input the X,Y,Z [mm] and W,P,R [deg] values of the current position to the first line of the point list and repeat the same procedure for at least 7 more points

The recommended procedure is to cover the four corners + four positions in the center of the scanning volume).

Change the orientation of the tool in all axes to achieve a wider range of input values. Press the Compute button after adding the final point.

For successful calibration, the Final Error per point should not exceed 2-3 mm. (0.807mm in this example).


Fanuc Locator Setting Up Guide Calib 0005.png


If the final error value is too high, try adding more points or start the calibration from the beginning again. Try to increase the orientation of the tool more than before.

Once you are satisfied with the results, press the Set Matrix to PhoXi button to store the results to the PhoXi Scanner.

Do not forget to switch the Coordinate Space in PhoXi Control after calibration has been completed successfully:


KUKA SettingUp Guide Scanner Calibration 20.png


In addition to the Robot - Camera transformation matrix, the calibration process also calculates a Calibration Sphere Misplacement vector which denotes the transformation between the selected Tool (TOOL[1]) and the center of the sphere (the ping-pong ball). This information can be used for calibration verification. First Set the Fanuc Tool coordinates according to the Misplacement Vector as calculated in the calibration process. Ensure that the ping-pong ball has not moved since the end of calibration.

Fanuc Locator Setting Up Guide Calib 0006.png


Again, browse to Menu -> Setup -> Frames


Fanuc Locator Setting Up Guide Frames.png


Input values from misplacement vector to the TOOL[1]


Fanuc Locator Setting Up Guide Calib 0007.png


Save the changes, jog the robot to the center of the scanning volume and select the Test button in the Photoneo Robot Camera Calibration Tool:


Fanuc Locator Setting Up Guide Calib 0008.png


Compare the position of the ball calculated in Robot Transformation Coordinate Space with the POSITION of TOOL[1] in the WORLD frame.


Fanuc Locator Setting Up Guide Calib 0009.png


The values calculated by the Photoneo Robot Camera Calibration Tool should approximately match.


4.2 Tool Calibration

The misplacement vector calculated during robot camera calibration determines the center of the calibration ball with respect to the Tool Frame selected during calibration. This method is convenient for validating the calibration, however, the real gripping point is usually different from the center of the calibration ball. In order to enable successful picking, it is necessary to calibrate the robot tool. The most commonly used method of carrying this out is to use the built-in FANUC calibration tools. The following section demonstrates tool calibration using the Three Point method.

Select Menu -> Setup -> Frames and select the tool frame you want to use within your program.

Press F2[Method] and select the Three Point calibration method:


Fanuc Locator Setting Up Guide Tool Calib 1.png


Jog the robot to approach the referencing point by your gripper tool point from 3 different positions and press the SHIFT + RECORD button to confirm each one.

If the calibration routine was performed correctly you should see the result - tool X,Y,Z coordinates immediately.


Fanuc Locator Setting Up Guide Tool Calib 2.png


NOTE: The basic Locator configuration is BASE Selection = WORLD and UTOOL Selection = YOUR CALIBRATED FRAME

5. Runtime

5.1 Reteach Application poses

Once the Robot-Camera and Tool calibration has been completed, you can proceed to re-teaching the application poses. Prior to starting this process, please ensure that you have selected the correct User and Tool Frame.

Go through the LOC_SINGLE or LOC_MULTIPLE programs and reteach all J P[X] poses using the standard procedure as shown in the figure below:


Fanuc Locator Setting Up Guide First Run.png


Do not edit L PR[X] poses unless you know exactly what you are doing, these are for performing motion commands towards the targets received from the Locator

5.2 Endiannes

The endianness in Fanuc Robots is controller specific. This means that one controller might communicate using Little endian, while another communicates using Big endian.

Configure and run the Locator GUI - you should see that Locator is in Waiting for Connection State ...


Fanuc Locator Setting Up Guide Runtime GUI.png


Select LOC_SINGLE Program and press SHIFT + FWD button to start the program.

If network configuration has been set properly, the Karel routine should establish a connection to the Locator server and trig the first scan.

If the Robot Controller uses Little-endian (the default config), everything should work fine and the result from Locator should appear in PR1[PHO RESERVED].

However, if the Robot Controller uses Big-endian, the following error will occur:


Fanuc Locator Setting Up Guide Endianess error.png


In order to switch the communication from Little to Bin-endian, change the value in R[1] from 0 to 1.


Fanuc Locator Setting Up Guide Endianess.png


Repeat the connection attempt and if no error has occurred, the result from Locator should appear in PR1[PHO RESERVED]


Fanuc Locator Setting Up Guide PR.png

5.3 Run Locator

You are now ready to run the program. Switch to T1 mode and select 10% speed; this option is recommended for safety reasons.

Make sure that you are ready to stop the motion execution immediately if something goes wrong.

Select the LOC_SINGLE/LOC_MULTIPLE program or other if you have prepared your own.


Fanuc Locator Setting Up Guide Runtime Select.png


If Locator is in Waiting for Connection... state, press SHIFT + FWD buttons to start the application:


Fanuc Locator Setting Up Guide Runtime.png


If everything is working correctly, you should that the scan was triggered, the result from locator has been transmitted to the Robot Controller and the robot is approaching the object


6. TP Program

The Locator Fanuc module is a combination of Karel background routine loc_client.pc and four TP files.

  • - loc_client.pc - handles communication with locator and feeding PR with received data
  • - LOC_SINGLE.TP - is a basic template for using Locator Fanuc Module in the Single Result Mode
  • - LOC_MULTIPLE.TP - is a basic template for using Locator Fanuc Module in the Multiple Result Mode
  • - LOC_GRIP_ATT.TP - user should fill this function by commands required for attaching object to the gripper
  • - LOC_GRIP_DEA.TP - user should fill this function by commands required for detaching object from the gripper


6.1 Main

The following code is the content of the LOC_SINGLE.TP. As can be seen in the figure below, it clears registers, runs LOC_CLIENT Karel background routine and waits until Karel routine establishes the connection with Locator. As soon as the connection is established, Single Result Mode Trigger is sent to Locator. Locator initializes scanning and localization and if a result is found it is being sent back to the Fanuc robot. The Karel routine fills Cartesian Data received from Locator to PR[1] and sets F[RES_RECEIVED] flag to ON. LOC_SINGLE.TP keeps waiting for F[RES_RECEIVED] right after it is set to ON it performs the motion to the received target. Offset from PR[100] is applied for approaching and deapproaching points. After finalizing the placing, the scan is repeated. For Multiple Result Mode, the scan is repeated after picking all received targets.


  1:  !Clear Registers ;
  2:  F[2]=(OFF) ;
  3:  F[3]=(OFF) ;
  4:  F[4]=(OFF) ;
  5:  R[7:PHO LOC STATUS]=99    ;
  6:  R[8:PHO NUM TAR REQ]=0    ;
  7:  R[9:PHO NUM TAR RCV]=0    ;
  8:  !Start Locator Client ;
  9:  RUN LOC_CLIENT ;
 10:  !Move Out of Scanning Volume ;
 11:J P[1] 100% FINE    ;
 12:  !Wait for Establishing Connectio  ;
 13:  WAIT (F[2]=ON)    ;
 14:  !Main Loop ;
 15:  LBL[1] ;
 16:  !Single Result Trigger ;
 17:  R[6:PHO REQ TYPE]=1    ;
 18:  F[3]=(ON) ;
 19:  !Wait For Response ;
 20:  WAIT (F[4]=ON)    ;
 21:  F[4]=(OFF) ;
 22:  !Repeat Scanning if Timeout ;
 23:  IF (R[7:PHO LOC STATUS]=1),JMP LBL[1] ;
 24:  !If OK, Proceed to Picking ;
 25:J P[2] 100% CNT100    ;
 26:L PR[1:PHO RESERVED] 100mm/sec FINE Offset,PR[100:PHO APPR OFFSET]    ;
 27:L PR[1:PHO RESERVED] 1000mm/sec FINE    ;
 28:  CALL LOC_GRIP_ATT    ;
 29:L PR[1:PHO RESERVED] 100mm/sec FINE Offset,PR[100:PHO APPR OFFSET]    ;
 30:  !Move Out of Scanning Volume ;
 31:J P[3] 100% FINE    ;
 32:  !Placing ;
 33:J P[4] 100% CNT100    ;
 34:J P[5] 100% FINE    ;
 35:  CALL LOC_GRIP_DEA    ;
 36:J P[6] 100% CNT100    ;
 37:  !End of Loop ;
 38:  JMP LBL[1] ;


6.2 Registers Used

The Locator client occupies the following Registers:

  • - R1[PHO ENDIAN] - Little/Big Endian Switch Little Endian = 0, Big Endian = 1
  • - R2[PHO CONNECTED] - Connection flag, ON - Connected to Locator, OFF - Disconnected from Locator
  • - R3[PHO NEW REQ] - New Request Flag - used to synchronize action betweeen TP and Karel programs
  • - R4[PHO RES RECEIVED] - Response Recevied Flag - used to synchronize action between TP and Karel programs
  • - R5[PHO LOC PORT] - Register for configuring the port on which Locator server is listening
  • - R6[PHO REQ TYPE] - Register for storing the Request Type - Single Result Mode = 1, Multiple Result Mode = 2
  • - R7[PHO LOC STATUS] - Register for transfering Locator Status Value from Karel to TP, 0 = LOC_OK, 1 = LOC_TIMEOUT, 2 = LOC_ERROR
  • - R8[PHO NUM TAR REQ] - Register for storing the number of results requested from Locator (only valid for Multiple Result Mode)
  • - R9[PHO NUM TAR RCV] - Register for storing the number of results received from Locator (only valid for Multiple Result Mode)


Fanuc Locator Setting Up Guide Registers.png


The Locator client occupies the following Position Registers:

  • - PR1[PHO_RESERVED] - PR99[PHO RESERVED] - Position Registers for storing Locator Results
  • - PR100[PHO APPR OFFSET] - Position Registers for storing Approach/Deapproach Pose offset


Fanuc Locator Setting Up Guide Position Registers.png


PR100[PHO APPR OFFSET] is be used to configure the offset for approaching to the target. The default configuration is (X = 0, Y = 0, Z = 100mm, W = 0, P = 0, R = 0) for approaching directly in Z axis.


Fanuc Locator Setting Up Guide Registers Offset.png

6.3 Communication Protocol

The following illustrations explain the Locator - FANUC communication protocol in both Single and Multiple Result Modes.

NOTE #1: Communication is performed in UF - Unformatted mode


Fanuc Locator Setting Up Guide Single Com Protocol.png


Fanuc Locator Setting Up Guide Multiple Com Protocol.png