Difference between revisions of "Locator Tutorial: Setting up Locator to work with FANUC robots"
Line 162: | Line 162: | ||
− | 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. | + | 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. |
+ | |||
+ | 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. | ||
Revision as of 11:02, 4 March 2019
Users are strongly recommended to read Locator Tutorial: Introduction prior to installation of specific robot interface
Contents
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):
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 the Teach Pendant, press Menu -> Setup -> Host Comm -> TCP/IP -> F3[Detail]:
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:
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:
2.3 Configure TCP/IP Client
The main Locator Fanuc Interface works in client mode. Configure the TCP/IP Client for this purpose.
Press Menu -> Setup -> Host Comm -> F4[SHOW] and select Clients
Select C1 slot
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
3. Locator Fanuc Interface Setup
The Locator Fanuc Interface consists of a 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 into the Teach Pendant.
Press Menu -> File -> File -> F5[UTILS] and select Set Device:
Select the USB on TP (UT1:) option as is shown in the figure below:
Press F2[DIR] to set the directory subset and select "*.*(all files)" to show all items on the USB.
Select the files one by one, press F3[LOAD] and YES to load the programs to the Robot Controller:
Press Select button to verify that all of the TP and Karel programs have been loaded successfully:
4. Calibration
Robot Camera Calibration is a crucial step in Locator configuration. Accurate calibration guarantees that 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:
Users are strongly recommended to clear UTOOL values prior to calibration.
Browse to Menu -> Setup -> Frames and select the one you want to use for calibration; in the example given Tool[1] was used.
Ensure that all UTOOL values are cleared:
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 a standard ping-pong ball) and set the Min visible arameter to 40%:
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 the POSN button -> F4[WORLD] to obtain the current TOOL[1] position with respect to the robot WORLD frame:
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 once you have added the final point.
For successful calibration, the Final Error per point should not exceed 2-3 mm. (0.807mm in this example).
If the final error value is too high, try adding more points or start the calibration from the beginning again. Increasing the orientation of the tool can help to reduce the final error value.
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:
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.
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.
Again, browse to Menu -> Setup -> Frames
Input the values from the misplacement vector to the TOOL[1]
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:
Compare the position of the ball calculated in the Robot Transformation Coordinate Space with the POSITION of TOOL[1] in the WORLD frame.
The values calculated by the Photoneo Robot Camera Calibration Tool should approximately match.
4.2 Tool Calibration
The misplacement vector calculated during the robot camera calibration process determines the center of the calibration ball with respect to the Tool Frame selected during calibration. This is a convenient method for validating the calibration, but in practice the real gripping point is usually different from the center point of the calibration ball. In order to ensure successful picking, the robot tool should also be calibrated. The most commonly used method of achieving this, 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:
Jog the robot to approach the referencing point with your gripper tool point from 3 different positions and press the SHIFT + RECORD button to confirm each one.
If the calibration routine was has been performed correctly, you should see the resulting - tool X,Y,Z coordinates immediately.
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 processes have 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:
Do not edit L PR[X] poses unless you know exactly what you are doing; these are intended to perform motion commands towards the targets received from Locator.
5.2 Endiannes
The endianness in Fanuc Robots is controller specific, while one controller might communicate using Little endian, another may communicate using Big endian.
Configure and run the Locator GUI - you should see that Locator is in the Waiting for Connection... state.
Select the LOC_SINGLE Program and press SHIFT + FWD to start the program.
If the network configuration has been set properly, the Karel routine should establish a connection to the Locator server and trigger 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:
In order to switch the communication from Little to Big-endian, change the value in R[1] from 0 to 1.
Repeat the connection attempt and if no error has occurred, the result from Locator should appear in PR1[PHO RESERVED].
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.
Ensure that you are ready to stop the motion execution immediately if something goes wrong.
Select the LOC_SINGLE/LOC_MULTIPLE program or another program which you have prepared your own.
If Locator is in the Waiting for Connection... state, press the SHIFT + FWD buttons to start the application:
If everything is working correctly, you should see that the scan has been 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 the Karel background routine loc_client.pc and four TP files.
- - loc_client.pc - handles communication with Locator and feeds position registers 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 - users should assign commands required for attaching object to the gripper to this function
- - LOC_GRIP_DEA.TP - users should assign commands required for detaching object from gripper to this function
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 the LOC_CLIENT Karel background routine and waits until the Karel routine has established a connection with Locator. As soon as the connection has been established, a Single Result Mode Trigger is sent to Locator. Locator initializes scanning and localization and if a result is found it is sent back to the Fanuc robot. The Karel routine inputs Cartesian Data received from Locator to PR1[PHO_RESERVED] and sets F4[RES_RECEIVED] flag to ON. LOC_SINGLE.TP is waiting for F4[RES_RECEIVED]; immediately after it is set to ON it performs the motion to the received target. The offset from PR100[APPR OFFSET] is applied to approaching and de-approaching points. After finalizing the placing, the scan is repeated. In Multiple Result Mode, the scan is repeated after picking all of the 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 between TP and Karel programs
- - R4[PHO RES RECEIVED] - Response Received 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 transferring 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)
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
PR100[PHO APPR OFFSET] is used to configure the offset for approaching the target. The default configuration is (X = 0, Y = 0, Z = 100mm, W = 0, P = 0, R = 0) for approaching directly on the Z axis.
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