Difference between revisions of "Locator Tutorial: Setting up Locator to work with KUKA robots"
Line 128: | Line 128: | ||
=== 4.1 Robot - Camera Calibration === | === 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: | + | Mount the Scanner firmly, ensure that the scene is properly captured from the final position and start the '''Photoneo Robot Camera Calibrator''': |
Revision as of 15:20, 13 October 2018
It is highly recommended that users read Locator Tutorial: Introduction prior to installation of the specific robot interface
Contents
1. Prerequisities
Photoneo KUKA module prerequisities:
- - KRC4 system v.8.3 or higher
- - Ethernet KRL Interface v.2.1 or higher installed
In order to check if Ethernet KRL is available on the robot controller, switch to Expert Mode and browse to Menu -> Startup -> Additional Software:
2. KUKA Controller setup
The following tutorial gives a step by step guide of how to configure your KUKA KRC4 controller and install all the necessary files you will need to get the robot interface for Locator up and running.
This tutorial was originally written using the latest KRC4 system version 8.3 and KUKA AGILUS KR6 R900 sixx robot.
2.1 Network configuration
The Locator KUKA Module utilizes TCP/IP communication for transferring data between KRC4 Robot Controller and Vision Controller.
As a first step in commissioning, ensure that the IP address of the KRC4 controller meets your network configuration requirements
Switch to Expert Mode, open the Menu screen and select the Startup-> Network Configuration option:
Amend the network configuration to meet your requirements:
KRC4 Control PC needs to be rebooted in order to apply the new network configuration.
Open the Menu Screen and select the Shutdown -> Reboot control PC option:
3. Photoneo KUKA Module Setup
The first step in the installation of Locator KUKA Module is to copy the files from the Locator KUKA Module Archive to the Robot Controller.
The Locator KUKA Module consists of the following files:
- Photoneo EthernetKRL Config Folder
- - locator_client.xml
- Photoneo Folder
- - locator_communication.src
- - locator_communication.dat
- Program Folder
- - locator_basic_template.src
- - locator_basic_template.dat
3.1 Ethernet KRL config
EthernetKRL Config folder contains only one XML file - locator_client.xml.
Copy this configuration file from the USB stick to C:\System\KRC\Roboter\Config\User\Common\EthernetKRL\ as is shown in the figure below:
The XML file contains the configuration of the EKI communication interface. The only entry that needs to be changed is the IP address tag.
Enter the IP address of the Vision Controller to External IP tag in locator_client.xml as is shown in the figure below:
Save the changes and reboot the control PC again to apply the new EthernetKRL interface configuration.
Port utilized by Photoneo KUKA Module:
- - Locator Client Port: 54602
Flags occupied by EthernetKRL functions:
- - $FLAG[101] - Locator Connection Alive
- - $FLAG[102] - New Data Received
NOTE: Do NOT use these flags and port in the rest of your application!!!
3.2 Copy Photoneo & Program files
The Photoneo folder contains internal communication sources that should not be edited by the user.
Copy the entire content of Photoneo folder from the USB Stick to the R1/Photoneo/ folder/ (Compilation errors can be ignored for now - just copy the files):
It is highly recommended to hide the Photoneo folder from the Operator's reach.
Switch to Expert Mode, and set the System flag in the Properties of the Photoneo folder:
The program folder contains files which should be adapted by the user in order to meet application requirements.
Do not replace the whole program folder, copy only the locator_basic_template files from the Locator_KUKA_Module archive to the R1/Program Folder:
NOTE: Compilation errors should disappear after copying all files to the Robot Controller.
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:
Ensure that the Base and Tool Selections are set to $NULLFRAME:
Connect to the Scanner, select ZYX_Intrinsic formalism (Standard for KUKA robots), adjust the Sphere radius (20 mm in case of standard ping pong ball) and set the Min visible parameter 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).
Press the Capture button on the first line of the list of points in order to capture the ball position.
On the KUKA Pendant select Main Menu -> Display -> Variable -> Single and input the $pos_act variable to obtain the current tool position with the required number of decimals:
Input the X,Y,Z and A,B,C values of the current position to the first line of the point list and repeat the same procedure for at least 5 more points (the four corners of the scanning volume/bin + two 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. (1.089mm in this example).
If the Final Error value is too high, try adding more points or start the calibration from the beginning again.
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 ($NULLFRAME) and the center of the sphere (the ping-pong ball). This information can be used for calibration verification. First Set the KUKA 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.
Select Main Menu -> Startup -> Calibration -> Tool -> Numeric Input
Select the Tool number which you want to use for validation, set Name (5-VERIFICATION in this example) and input the values from the misplacement vector:
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 Robot Transformation Coordinate Space with $pos_act values:
The values calculated by the Photoneo Robot Camera Calibration Tool should approximately match the values reported by the KUKA Pendant:
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 therefore necessary to calibrate the robot tool. The most commonly used method of carrying this out is to use the built-in KUKA calibration tools. The following section demonstrates Tool Calibration using the XYZ-4 point method.
Switch to Expert Mode and select Start Up -> Calibration -> Tool -> XYZ -4 Point:
Select the Tool Number you want to calibrate and enter a name:
Jog the robot to approach the referencing point by your gripper tool point from 4 different positions and press the Calibrate button to confirm each one.
Once the process is completed and you are satisfied with Final Error value, press the Save button to store the results. Refer to [KUKA System Integrator Manual] for more information.
NOTE: The basic Locator configuration is BASE Selection = $NULLFRAME and TOOL Selection = YOUR CALIBRATED TOOL
5 Runtime
5.1 Reteach Start and End poses
Once the Robot-Camera and Tool calibration 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 Base and Tool Frame.
Switch to Expert Mode and select locator_basic_template.src program as is shown in the figure below:
Press the Block Selection button to move the program pointer to the current line. Jog the robot to the new pose and select the Touch Up Button to reteach position:
Select Yes to confirm the new position. Repeat the same procedure also for the START, END and placing positions:
NOTE: START and END position should be of PTP Motion type
5.2 Run Locator
You are now ready to run the program. Switch to AUT 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.
Press PLAY button and keep it pressed until the robot moves to the Start Pose. Release the PLAY button and press it again to continue with the program execution.
If everything has been configured and calibrated properly, the robot should trigger a first scan, wait for the result and move towards the first localized object.
6. KRL
The Locator KUKA module is a set of KRL procedures which handle socket communication with the Locator and provides basic examples of how to navigate the robot to specific targets.
6.1 Main
The following code is a main loop from the locator_basic_template.src. As can be seen in the figure below, MULTIPLE RESULT MODE is utilized and Locator is requested to return 5 results.
If at least one object pose is received, program will attempt to execute motion towards the returned target/s. Attached object/s will be then placed in predefined positions.
Users can adapt this KRL code to meet their application requirements, change the speed, precision or order of steps in the main loop if needed.
6.2 Communication API
KRL procedures necessary for communication with Locator are available in the locator_communication.src and locator_communication.dat files.
PHO_ConnectToVC() - procedure to establish a connection with the Locator according to the IP address configured in the EKI XML config file.
- $FLAG[101] is set to TRUE if communication has been established properly
- $FLAG[102] is set to TRUE if new data has been received from the Vision Controller
PHO_TrigLocator(mode:IN, requested_targets:IN) - procedure to trigger the next localization
- mode - two modes are available - SINGLE_RESULT_MODE and MULTIPLE_RESULT_MODE.
- requested_targets - optional parameter used in MULTIPLE_RESULT_MODE - defines the number of results requested by the user.
PHO_WaitForLocatorRes() - procedure to wait for a localization result to be received
- locator_targets[] - global E6POS array defined in locator_communication.dat which stores targets received from Locator. By default the array range is set to 100 targets.
- available_targets = global INT variable defined in locator_communication.dat which stores the number of received targets fromn last localization
6.3 Communication Protocol
The following illustrations explain the Locator - KUKA communication protocol in both Single and Multiple Result Modes.
KUKA EKI Communication is configured to work in STREAM mode and requires combination of terminating signs to be appended after each message.
In the current version of the communication protocol, 5 terminating signs TERMI are utilized for this purpose