Integration Guide Kawasaki LS

Note: It is strongly recommended to read the Robot communication overview prior to this integration guide.

Contents

1 Prerequisites

The Robot module is compatible with all E-series & F-series robot controllers.

2 Robot controller setup

2.1 Controller configuration

2.1.1 Network configuration

Turn on the robot controller, wait for the system to boot, open the Menu screen and select the Aux Function option:
image1
In the Aux function menu select System and Network Settings:
image2
The robot controller has two Ethernet ports. We will use Port 1 for communication with Locator Studio, while Port 2 will be utilized for transferring programs between PC and Robot controller using KRTerm.
Configure Port 1 to meet your network requirements and ensure that both the robot controller and the vision controller which will run the Locator Studio are on the same subnet.
image3
Configure Port 2 for transferring programs between PC and robot controller. Click Next Page, configure the network settings and confirm by clicking the Enter button.
image4
Restart the robot controller to apply the network settings.

2.2 Robot module installation

2.2.1 Loading the Robot module files

The Robot module consists of a single core .pg file:

- photoneo_locator.pg

Besides that Photoneo provides an example locator program and a semi-automatic calibration example program located in folder example_programs:

- locator_example.pg

- calibration.pg

The core file (and optionally the example program if you wish to use it) need to be transferred to the robot controller to get the Robot module up and running.

You can copy the .pg files to the robot controller directly from the USB stick using the Pendant, however, the most convenient method of installation is to use the KRTerm tool (download_1, download_2).

Make sure that Port 2 is configured for communication with your PC and that both devices are connected to the same subnet (you must be able to ping the robot controller from the command line).

Open KRTerm and select COM -> Options to add a new robot controller:
image5
Input the IP address of Port 2 as configured in the pendant in the previous step and click the Add button:
image6
Click File -> Set Current Folder and set the path to the folder where you saved the extracted .pg files
image7
You are now ready to connect to the robot. Make sure that you are able to ping the robot controller from your PC and click on the Connect button.
If the connection has been established properly you should see the login prompt shown in the figure below:
image8
The login name is as. If the login has succeeded you should be able to issue commands directly to the robot controller.

In order to load .pg files to the robot controller enter the LOAD command, e.g.:

LOAD photoneo_locator.pg

Make sure all files are loaded successfully.

At this point, the robot controller is configured to work with the Locator Studio.

3 Robot module

The Robot module is designed to be easily integrated into existing applications written in AS language.

3.1 Robotic API

Note: It is strongly recommended to read the Photoneo robotic API prior to this section.

This section describes available API calls provided by the Robot module. These procedures are intended for high-level control of the locator application.

3.1.1 Connection procedures

Warning: These procedures are contained in the photoneo_locator.pg API section and must not be edited!

Connection procedure

Description / Usage

Connect to Action Request Server

connect_to_vc
(
.ret_val_conn
)
Description
Function to establish a new connection to the Action Request Server.

Input parameters:

.ret_val_conn- result of the connection operation

vc_ip - an array of 4 values defining the IP of the Action Request Server (Robot interface), values must be on indices 1-4 [global variable - define it in the main program before calling the procedure]

bp_port - port on which the Action Request Server is running, it is recommended to use value 11 003 [global variable - define it in the main program before calling the procedure]

tout_open - timeout for a single connection attempt, default = 60 seconds [global variable - defined in the procedure init_consts (adjust if needed)]

connect_att - number of total connection attempts before a communication error is returned, default = 5 attempts [global variable - defined in the procedure init_consts, set to -1 for infinite connection attempts (adjust according to your needs)]

Usage
The procedure should be called only once at the beginning of the program. Only after the connection has been established it is possible to send requests.
bp_port = 11003
vc_ip[1] = 192
vc_ip[2] = 168
vc_ip[3] = 0
vc_ip[4] = 80
CALL connect_to_vc (ret_val)

Close TCP socket

close_socket
(
)
Description
Closes the open TCP socket.
Usage
Normally, it is not necessary to call this procedure as it is called automatically from the procedure Connect to Action Request Server if the socket is already open - reconnection is performed.
However, in some cases, it might happen the socket connection status variable does not report the correct status and the procedure Connect to Action Request Server fails (more specifically, its subprocedure open_socket. Then this procedure (Close TCP socket) is used to close the TCP socket left open.

3.1.2 Communication procedures

Note: Please read Action requests for detailed documentation of these procedures.

Warning: These procedures are contained in the photoneo_locator.pg API section and must not be edited!

vision_system_i - global variable. Locator requests require the vision system ID as an input parameter. It needs to be set to the correct value (ID of the vision system) before sending the request

.ret_val_X - procedure parameter. It stores the result of the procedure call.

Locator requests

Request

Input variables

Output variables

Scan request
Variant A - Only for extrinsic VS
req_scan
(
.ret_val_scan
)

vision_system_i - vision system ID [global variable]

The result is accessible in two ways:

  • .ret_val_scan - result of request sending operation

  • error_msg - result of request sending operation [global variable]

Note: The response is received by the procedure Wait for scan completion.

Scan request
Variant B - Only for hand-eye VS
req_scan_tcp
(
.ret_val_scan,
.&tcp_pose
)

vision_system_i - vision system ID [global variable]

.&tcp_pose - TCP pose [used only for hand-eye vision systems]

The result is accessible in two ways:

  • .ret_val_scan - result of request sending operation

  • error_msg - result of request sending operation [global variable]

Note: The response is received by the procedure Wait for scan completion.

Get objects request
Variant A - Get a specific number of object poses
req_objects
(
.ret_val_pose,
.requested_num
)

vision_system_i - vision system ID [global variable]

.requested_num - number of requested object poses

The error code is accessible in two ways:

  • .ret_val_pose - error code

  • error_msg - error code [global variable]

pho_obj_posess[] - array containing received object poses as transformation values, starts indexing from 1 [global variable]

num_of_objects - number of received object poses [global variable]

Get objects request
Variant B - Get a single object pose
req_single_obj
(
.ret_val_pose,
)

vision_system_i - vision system ID [global variable]

The error code is accessible in two ways:

  • .ret_val_pose - error code

  • error_msg - error code [global variable]

pho_obj_pose - received object pose as transformation value [global variable]

Get objects request
Variant C - Get all object poses
req_all_objects
(
.ret_val_pose,
)

vision_system_i - vision system ID [global variable]

The error code is accessible in two ways:

  • .ret_val_pose - error code

  • error_msg - error code [global variable]

pho_obj_posess[] - array containing received object poses as transformation values, starts indexing from 1 [global variable]

num_of_objects - number of received object poses [global variable]

Calibration requests

Request

Input variables

Output variables

Add calibration point request

req_add_point
(
.ret_val_add
)

.&tcp_pose - TCP pose

The error code is accessible in two ways:

  • .ret_val_add - error code

  • error_msg - error code [global variable]

Solution requests

Request

Input variables

Output variables

Change solution request

change_sol_req
(
.ret_val_sol,
.solution_id
)

.solution_id - solution ID

The error code is accessible in two ways:

  • .ret_val_sol - error code

  • error_msg - error code [global variable]

Start solution request

start_sol_req
(
.ret_val_sol,
.solution_id
)

.solution_id - solution ID

The error code is accessible in two ways:

  • .ret_val_sol - error code

  • error_msg - error code [global variable]

Stop solution request

stop_sol_req
(
.ret_val_sol
)

—

The error code is accessible in two ways:

  • .ret_val_sol - error code

  • error_msg - error code [global variable]

Get running solution request

get_run_sol_req
(
.ret_val_sol
)

—

The error code is accessible in two ways:

  • .ret_val_sol - error code

  • error_msg - error code [global variable]

running_sol_id - solution ID [global variable]

Response receiving procedures

Response receiving procedures

Input variables

Output variables

Wait for scan completion

wait_for_scan
(
.ret_val_wait
)

—

The error code is accessible in two ways:

  • .ret_val_wait - error code

  • error_msg - error code [global variable]

3.2 Example programs

The following section contains the Main program example and the calibration template which show the correct usage of the robotic API.

It is recommended to add suitable error handling for dealing with error situations.

3.2.1 Main program example

This program is a very basic example of a simple locator application for picking objects from a tray.
It connects to the Vision Controller, and in a loop it:
  • moves to a scanning pose where it requests a scan

  • moves to a starting pose above the tray in which it requests a specific number of object poses

  • if no error occurred, it picks the reported objects in loop:

    • the robot goes to an approach pose above the object

    • then it moves in a linear path towards the object and picks it (gripper command needs to be implemented here)

    • after picking, it moves in a linear path to a deapproach pose above the object

    • finally, the placing procedure is executed (needs to be implemented)

Name: locator_example.pg (located in folder example_programs)

.PROGRAM locator_example () ;
  ; *******************************************************************
  ;
  ; Program:      locator_example
  ; Comment:      Main program template with single vision system
  ; Author:       Photoneo s.r.o.
  ;
  ; Date:         20/10/2022
  ;
  ; *******************************************************************
  ;
  ;// Amend the Network settings - IP address of the Action request server (Robot interface)
  vc_ip[1] = 192
  vc_ip[2] = 168
  vc_ip[3] = 0
  vc_ip[4] = 80
  ;// Amend the Network settings - Action request server port (unrecommended)
  bp_port = 11003
  ;// Connect to the Vision Controller
  CALL connect_to_vc (ret_val)
  ;// Check return value, abort in case of failure
  IF (ret_val <> 0) THEN
    GOTO quit
  END
  ;// Set Vision System ID
  vision_system_i = 1
  SPEED 10 ALWAYS
  ;// MAIN LOOP
  WHILE (TRUE) DO
    ;// Move to Scanning pose in which the robot does not occlude the scanning area
    JMOVE #scanning_pose
    BREAK
    ;// Request scan acquisition
    CALL req_scan(ret_val)
    ;// Receive response from the scan request
    CALL wait_for_scan (ret_val)
    ;// Check return value, abort in case of failure
    IF (ret_val <> 0) THEN
      GOTO quit
    END
    ;// Move to Starting pose
    JMOVE #starting_pose
    ;// Request exact number of object poses
    .requested_num = 3
    CALL req_objects (ret_val, .requested_num)
    ;// Check return value, abort in case of failure
    IF (ret_val <> 0) THEN
      GOTO quit
    END
    ;// Pick all reported objects in loop
    FOR .i = 1 TO num_of_objects STEP 1
      ;// Move to Approach
      JAPPRO pho_obj_poses[.i], 100
      ;// Move to the reported object pose
      LMOVE pho_obj_poses[.i]
      BREAK
      ;// Activate gripper here
      ;// Move to Depart
      LDEPART 100
      ;// Execute placing here
    END
  END
  ;// End of the MAIN LOOP
quit:
  ;// Disconnect from the Vision Controller
  CALL close_socket
.END

3.2.2 Calibration example

This program is a template for semi-automatic calibration.

Before running the program:

  • teach the calibration start pose through which the robot will move to the individual calibration poses

  • teach the individual calibration poses

  • start the calibration in the Locator Studio

Now you can start the program. It will move to individual calibration poses and send the Add calibration point request when it reaches them. In between the calibration poses the robot will go through the calibration start pose. Once all the calibration points are successfully added, the program ends. If you are satisfied with the calibration result, save it in the Locator Studio.

Name: calibration.pg (located in folder example_programs)

.PROGRAM calibration () ;
  ; *******************************************************************
  ;
  ; Program:      calibration
  ; Comment:      Template for semi-automatic calibration
  ; Author:       Photoneo s.r.o.
  ;
  ; Date:         20/10/2022
  ;
  ; *******************************************************************
  ;
  ;// Amend the Network settings - IP address of the Action request server (Robot interface)
  vc_ip[1] = 192
  vc_ip[2] = 168
  vc_ip[3] = 0
  vc_ip[4] = 80
  ;// Amend the Network settings - Action request server port (unrecommended)
  bp_port = 11003
  ;// Connect to the Vision Controller
  CALL connect_to_vc (ret_val)
  ;// Check return value, abort in case of failure
  IF (ret_val <> 0) THEN
    GOTO quit
  END
  ;// Go to the start pose from which the robot will move to the calibration poses
  JMOVE #calib_start
  ;// 1. calibration point
  ;// Go to the first calibration pose
  JMOVE #calib_1
  BREAK
  PRINT "LOC_CLIENT: Adding the 1st calibration point"
  ;// When the pose is reached, call request to add the first calibration point
  HERE .tcp
  CALL req_add_point (ret_val, .&tcp)
  ;// Check return value, abort in case of failure
  IF (ret_val <> 0) THEN
    GOTO quit
  END
  ;// Return to the start pose
  JMOVE #calib_start
  ;// 2. calibration point
  JMOVE #calib_2
  BREAK
  PRINT "LOC_CLIENT: Adding the 2nd calibration point"
  HERE .tcp
  CALL req_add_point (ret_val, .&tcp)
  IF (ret_val <> 0) THEN
    GOTO quit
  END
  JMOVE #calib_start
  ;// 3. calibration point
  JMOVE #calib_3
  BREAK
  PRINT "LOC_CLIENT: Adding the 3rd calibration point"
  HERE .tcp
  CALL req_add_point (ret_val, .&tcp)
  IF (ret_val <> 0) THEN
    GOTO quit
  END
  JMOVE #calib_start
  ;// 4. calibration point
  JMOVE #calib_4
  BREAK
  PRINT "LOC_CLIENT: Adding the 4th calibration point"
  HERE .tcp
  CALL req_add_point (ret_val, .&tcp)
  IF (ret_val <> 0) THEN
    GOTO quit
  END
  JMOVE #calib_start
  ;// 5. calibration point
  JMOVE #calib_5
  BREAK
  PRINT "LOC_CLIENT: Adding the 5th calibration point"
  HERE .tcp
  CALL req_add_point (ret_val, .&tcp)
  IF (ret_val <> 0) THEN
    GOTO quit
  END
  JMOVE #calib_start
  ;// 6. calibration point
  JMOVE #calib_6
  BREAK
  PRINT "LOC_CLIENT: Adding the 6th calibration point"
  HERE .tcp
  CALL req_add_point (ret_val, .&tcp)
  IF (ret_val <> 0) THEN
    GOTO quit
  END
  JMOVE #calib_start
  ;// 7. calibration point
  JMOVE #calib_7
  BREAK
  PRINT "LOC_CLIENT: Adding the 7th calibration point"
  HERE .tcp
  CALL req_add_point (ret_val, .&tcp)
  IF (ret_val <> 0) THEN
    GOTO quit
  END
  JMOVE #calib_start
  ;// 8. calibration point
  JMOVE #calib_8
  BREAK
  PRINT "LOC_CLIENT: Adding the 8th calibration point"
  HERE .tcp
  CALL req_add_point (ret_val, .&tcp)
  IF (ret_val <> 0) THEN
    GOTO quit
  END
  JMOVE #calib_start
  ;// 9. calibration point
  JMOVE #calib_9
  BREAK
  PRINT "LOC_CLIENT: Adding the 9th calibration point"
  HERE .tcp
  CALL req_add_point (ret_val, .&tcp)
  IF (ret_val <> 0) THEN
    GOTO quit
  END
  JMOVE #calib_start
quit:
  IF (ret_val <> 0) THEN
    PRINT "BP_CLIENT: Error while adding the calibration point"
    PRINT "BP_CLIENT: Check the Studio for more details"
  END
  ;// Disconnect from the Vision Controller
  CALL close_socket
  HALT
.END

3.3 Error handling

If an error occurs during the execution of the operation requested by the sent request the error is stored in the return variable .ret_val_X and the global variable error_msg. It is recommended to implement adequate error handling for your particular application after each synchronous request and response receiving procedure.

Error codes together with their description and troubleshooting can be found here.

4 Running the Main program example

4.1 Prerequisites

Before the Main program example can be run, the following requirements must be met:

  • A fully configured solution with a single vision system must be prepared for deployment

  • The robot controller must be configured according to the chapter Robot controller setup of this integration guide

  • Locator Studio network settings must be configured

  • Gripper procedures should be implemented (optional - if not implemented, the robot will not actually pick the object)

  • The placing procedure should be implemented

4.2 Reteach the robot poses

The Main program example uses the following poses:

scanning_pose - scan acquisition is requested in this pose via scan request. For extrinsic vision systems, it is a pose in which the robot does not occlude the scanning area. For hand-eye vision systems, it is a pose in which the scanner on the robot has an optimal view of the scene.

starting_pose - a pose from which the robot moves to a pose above the reported object pose (an approach pose)

Besides these two poses, the placing procedure needs to be implemented.

4.3 Runtime

Deploy your solution. The Action Request Client status on the Deployment page should be **  DISCONNECTED  ** (from the Action Request Server).

The first step is to select the program which will be run. Click on the yellow program rectangle on the pendant touch screen:
image9
Select Directory to enter the program list:
image10
Find and select the main program:
image11
When the main program is prepared for launch, hold A key + press RUN/HOLD key on the pendant. RUN status should appear in the top right corner:
image12
Now turn on the motor power. Hold A key + MOTOR_ON/JOG key. You should hear that the motor brakes have been released and MOTOR status should appear right next to the RUN status in the top right corner.
image13
Start the main program on the robot controller. Hold A key + press CYCLE START/CONT key. The CYCLE status should appear green in the top right corner:
image14
The Action Request Client status on the Deployment page will change to the **  CONNECTED  ** state.

If you press Menu -> Keyboard on Teach Pendant, you should see text outputs as shown in the figure below signalizing that the Action Request Client is working properly.

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

NOTE: Ensure that you are ready to halt motion execution immediately. It is strongly recommended to reduce the speed to 10% of the maximum during initial tests.

5 Troubleshooting

If you experience Open Socket Error as shown in the figure below, it means that the previous connection to the Action Request Server has not been properly closed.
image15
Run the close_socket() program to terminate the previous session properly:
image16