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

From 3D scanning Knowledge base - Photoneo wiki
Jump to: navigation, search
 
(24 intermediate revisions by the same user not shown)
Line 7: Line 7:
 
== 2. KAWASAKI Controller setup ==
 
== 2. KAWASAKI Controller setup ==
  
The following tutorial provides a step by step guide of how to configure your KAWASAKI E-series controller and install all .pg files which you will need to get the robot interface for Photoneo Binpicking Studio up and running.  
+
The following tutorial provides a step by step guide of how to configure your KAWASAKI E-series controller and install all .pg files which you will need to get the robot interface for Photoneo Bin Picking Studio up and running.  
  
 
=== 2.1 Network configuration ===
 
=== 2.1 Network configuration ===
Line 13: Line 13:
 
Turn on the robot controller, wait for the system to boot, open the '''Menu screen''' and select the '''Aux Function''' option:
 
Turn on the robot controller, wait for the system to boot, open the '''Menu screen''' and select the '''Aux Function''' option:
  
 
+
[[File: Kawa IP step 0.png|frame|none|alt=Alt text| Figure 2.1.1]]
[[File: Kawa IP step 0.png]]
 
  
  
Line 20: Line 19:
  
  
[[File: Kawa IP step 2.png]]
+
[[File: Kawa IP step 2.png|frame|none|alt=Alt text| Figure 2.1.2]]
  
  
 
E-series robot controllers have two Ethernet ports. We will use '''Port 1''' for communication with '''Photoneo Binpicking Studio''', while '''Port 2''' will be utilized for transferring programs between PC and Robot controller using '''KRTerm'''.  
 
E-series robot controllers have two Ethernet ports. We will use '''Port 1''' for communication with '''Photoneo Binpicking 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 Photoneo Binpicking Studio are on the same subnet.  
+
Configure Port 1 to meet your network requirements and ensure that both the robot controller and the vision controller which will run Photoneo Bin Picking Studio are on the same subnet.  
  
  
[[File:Kawa IP step 3.png]]
+
[[File:Kawa IP step 3.png|frame|none|alt=Alt text| Figure 2.1.3]]
  
  
Line 34: Line 33:
  
  
[[File:Kawa IP step 4.png]]  
+
[[File:Kawa IP step 4.png|frame|none|alt=Alt text| Figure 2.1.4]]
  
  
 
=== 2.2 Enable Autostart ===
 
=== 2.2 Enable Autostart ===
  
The Photoneo KAWASAKI interface consists of two tasks - '''the Binpicking Client''' task and the '''State server'''.  
+
The Photoneo KAWASAKI interface consists of two tasks - '''the Bin Picking Client''' task and the '''State server'''.  
  
While the bin picking client is '''Cycle Started''' as a normal robotic program, state server runs in the background from boot.  
+
While the bin picking client is '''Cycle Started''' as a normal robotic program, state server runs in the background from the boot.  
  
 
In order to enable the state server to run properly from the first boot, it is necessary to enable the '''AUTOSTART.PC''' system switch.  
 
In order to enable the state server to run properly from the first boot, it is necessary to enable the '''AUTOSTART.PC''' system switch.  
Line 48: Line 47:
  
  
[[File: Kawa Autostart step 2.png]]
+
[[File: Kawa Autostart step 2.png|frame|none|alt=Alt text| Figure 2.2.1]]
  
  
 
You should see the list of system switches. '''AUTOSTART.PC''' switches are available on the second page so click '''Next Page''' to access them.  
 
You should see the list of system switches. '''AUTOSTART.PC''' switches are available on the second page so click '''Next Page''' to access them.  
  
Turning AUTOSTART.PC '''ON''' enables State Server to start properly even on the first boot
+
Turning '''AUTOSTART.PC''' to '''ON''' enables State Server to start properly even on the first boot
  
  
[[File: Kawa Autostart step 3.png]]
+
[[File: Kawa Autostart step 3.png|frame|none|alt=Alt text| Figure 2.2.2]]
  
  
Restart the robot controller to apply the network and autostart settings.
+
'''Restart the robot controller to apply the network and autostart settings.'''
 +
 
 +
'''NOTE:''' Before proceeding further, please ensure that State server is running - '''PC window on the pendant is not empty - AUTOSTART program pointer should be visible here !!!'''
 +
 
 +
 
 +
[[File: Setting up Guide Kawasaki State Server Running.png|frame|none|alt=Alt text| Figure 2.2.3]]
  
 
=== 2.3 BASE Coordinates  ===
 
=== 2.3 BASE Coordinates  ===
  
Photoneo Binpicking Studio requires the origin of the robot to be defined '''at the very bottom of the robot'''.  
+
Photoneo Bin Picking Studio requires the origin of the robot to be defined '''at the very bottom of the robot'''.  
  
In Kawasaki robots, the default origin position is in the axis of second joint, so therefore we need to redefine its position and shift it vertically down in the Z-axis.  
+
In Kawasaki robots, the default origin position is in the axis of the second joint, so therefore we need to redefine its position and shift it vertically down in the Z-axis.  
  
 
Browse to '''Menu'''->'''Aux Functions''' -> '''Advanced Settings''' -> Base Coordinates'''
 
Browse to '''Menu'''->'''Aux Functions''' -> '''Advanced Settings''' -> Base Coordinates'''
  
[[File:Kawa Base Coordinates.png]]
+
[[File:Kawa Base Coordinates.png|frame|none|alt=Alt text| Figure 2.3.1]]
  
  
 
Set the '''Z coordinate''' value according to the robot being used and offset the list as is shown below:
 
Set the '''Z coordinate''' value according to the robot being used and offset the list as is shown below:
  
RS010N Offset = -430
 
  
RS020N Offset = -465
+
[[File: Kawasaki Offset table June 2019.png|frame|none|alt=Alt text| Figure 2.3.2]]
  
'''NOTE: Be careful if you are integrating Photoneo Binpicking interface into an existing application, since changes to the Base Coordinates might affect your previously taught positions!'''   
+
 
 +
'''NOTE: Be careful if you are integrating Photoneo Bin Picking interface into an existing application since changes to the Base Coordinates might affect your previously taught positions!'''   
  
 
== 3. KRTerm  ==
 
== 3. KRTerm  ==
Line 94: Line 98:
 
=== 3.1 Transfering .pg files to robot controller ===
 
=== 3.1 Transfering .pg files to robot controller ===
  
You should have received the '''.pg''' files as a .zip archive together with Photoneo Binpicking Studio. 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 [http://ftp.kawasakirobot.de/files/public/Software/KRTerm/ KRTerm] tool.  
+
You should have received the '''.pg''' files as a .zip archive together with Photoneo Bin Picking Studio. 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 [http://ftp.kawasakirobot.de/files/public/Software/KRTerm/ KRTerm] tool.  
  
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 command line).
+
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:
 
Open KRTerm and select '''COM''' -> '''Options''' to add a new robot controller:
  
  
[[File:Kawa KRTerm step 0.png]]
+
[[File:Kawa KRTerm step 0.png|frame|none|alt=Alt text| Figure 3.1.1]]
  
  
Input the IP address of Port 2 as configured in the pendant in previous step and click the '''Add''' button:
+
Input the IP address of Port 2 as configured in the pendant in the previous step and click the '''Add''' button:
  
  
[[File:Kawa KRTerm step 1 ver2.png]]
+
[[File:Kawa KRTerm step 1 ver2.png|frame|none|alt=Alt text| Figure 3.1.2]]
  
  
Line 113: Line 117:
  
  
[[File:Kawa KRTerm step 3.png]]
+
[[File:Kawa KRTerm step 3.png|frame|none|alt=Alt text| Figure 3.1.3]]
  
  
Line 121: Line 125:
  
  
[[File:Kawa KRTerm step 2.png]]
+
[[File:Kawa KRTerm step 2.png|frame|none|alt=Alt text| Figure 3.1.4]]
  
  
Line 129: Line 133:
  
  
[[File:Kawa KRTerm step 4.png]]
+
[[File:Kawa KRTerm step 4.png|frame|none|alt=Alt text| Figure 3.1.5]]
  
  
Line 135: Line 139:
  
  
[[File:Kawa KRTerm step 5.png]]
+
[[File:Kawa KRTerm step 5.png|frame|none|alt=Alt text| Figure 3.1.6]]
  
  
At this point your Robot Controller is configured to work with Photoneo Binpicking Studio. However your AS code must be adapted to meet the requirements of your application - you need to reteach HOME, START and END poses, update part placing, application logic, etc. The following section of the tutorial provides basic examples of how this can be programmed and also offers a detailed explanation of the Photoneo AS API.
+
At this point, your Robot Controller is configured to work with Photoneo Bin Picking Studio. However your AS code must be adapted to meet the requirements of your application - '''you need to reteach HOME, START and END pose, update part placing''', application logic, etc. The following section of the tutorial provides basic examples of how this can be programmed and also offers a detailed explanation of the Photoneo AS API.
  
 
== 4. AS Language ==
 
== 4. AS Language ==
  
The Photoneo KAWASAKI interface was designed to be easily integrated into existing applications written in AS code. The interface influences the final behaviour of the robot using two different methods:
+
The Photoneo KAWASAKI interface was designed to be easily integrated into existing applications written in AS code. The interface influences the final behavior of the robot using two different methods:
  
- '''AS API''' - a set of AS requests (or procedures) used to control the binpicking sequence. Requests are defined in the '''photoneo_common.pg''' module and used within '''main_application.pg'''
+
- '''AS API''' - a set of AS requests (or procedures) used to control the bin picking sequence. Requests are defined in the '''photoneo_common.pg''' module and used within '''main_application.pg'''
  
 
- '''AS CONFIG''' - '''customer_definitions.pg''' holds application specific settings such as gripper commands, motion execution settings and object placing definitions.
 
- '''AS CONFIG''' - '''customer_definitions.pg''' holds application specific settings such as gripper commands, motion execution settings and object placing definitions.
Line 150: Line 154:
 
=== 4.1 AS API ===
 
=== 4.1 AS API ===
  
The following API describes the functionality of requests provided by the Photoneo KAWASAKI Interface. These requests are intended for high level control of binpicking sequences and are usually called in '''main_application.pg'''
+
The following API describes the functionality of requests provided by the Photoneo KAWASAKI Interface. These requests are intended for high-level control of bin picking sequences and are usually called in '''main_application.pg'''
 
--------------------------------------------------------
 
--------------------------------------------------------
 
- '''connect_to_vc(.ret_val_conn)''' - function to establish a connection to the Vision Controller. Blocking function; suspends the program until a proper connection is established.  
 
- '''connect_to_vc(.ret_val_conn)''' - function to establish a connection to the Vision Controller. Blocking function; suspends the program until a proper connection is established.  
 +
 +
- '''init_req(.ret_val_init)''' - request to initialize bin picking application from the Vision Controller side. Start and End Poses defined by the operator from the AS side are transferred to the Vision Controller and used in the trajectory planning pipeline as start and terminus points.
  
 
- '''scan_req(.ret_val_scan)''' - request to trigger the next scan and localization. Non-blocking request; the AS program continues immediately at the next line.
 
- '''scan_req(.ret_val_scan)''' - request to trigger the next scan and localization. Non-blocking request; the AS program continues immediately at the next line.
  
- '''wait_for_scan(.ret_val_wait)''' - function to wait for scan to be finished. This should be called after triggering the scan, but not immediately. Blocking function, waits for response from Vision Controller.
+
- '''wait_for_scan(.ret_val_wait)''' - function to wait for the scan to be finished. This should be called after triggering the scan, but not immediately. Blocking function, waits for a response from Vision Controller.
  
 
- '''traj_req(.ret_val_traj)''' - request to start trajectory planning for current goal. Non-blocking function; the AS program continues immediately at the next line.
 
- '''traj_req(.ret_val_traj)''' - request to start trajectory planning for current goal. Non-blocking function; the AS program continues immediately at the next line.
  
 
- '''traj_recv(.ret_val_traj)''' - function to receive requested binpicking trajectories (consisting of a sequence of trajectory and gripper operations). Blocking function; waits for motion data to be received.
 
- '''traj_recv(.ret_val_traj)''' - function to receive requested binpicking trajectories (consisting of a sequence of trajectory and gripper operations). Blocking function; waits for motion data to be received.
 
- '''init_req(.ret_val_init)''' - request to initialize binpicking application from the Vision Controller side. Start and End Poses defined by the operator from the AS side are transferred to the Vision Controller and used in the trajectory planning pipeline as start and terminus points.
 
  
- '''calib_add_req(.ret_val_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.
+
- '''change_sol_req(.ret_val_sol)''' - request to change currently deployed solution.
 +
 
 +
- '''calib_start_req(.ret_val_start)''' - request to start current calibration for selected vision system and remove all previously added points '''(Not supported in this version)'''
 +
 
 +
- '''calib_add_req(.ret_val_add)''' - request to add calibration point - a scan is triggered and the calibration is recalculated. '''(Not supported in this version)
  
- '''calib_set_req(.ret_val_set)''' - request to set current calibration result to the PhoXi Scanner
+
- '''calib_set_req(.ret_val_set)''' - request to save current calibration result to selected Vision System '''(Not supported in this version)'''
  
- '''calib_reset_req(.ret_val_reset)''' - request to reset current calibration and remove all previously added points
+
- '''calib_reset_req(.ret_val_reset)''' - request to reset current calibration and remove all previously added points '''(Not supported in this version)'''
 +
 
 +
- '''locate_bin_req(.ret_val_loc)''' -  request to localize bin position in the environment '''(Reserved for future use)'''
 +
 
 +
- '''pick_failed_req(.ret_val.fail) - request to notify bin picking studio that object picking has failed '''(Reserved for future use)'''
 +
 
 +
 
 +
 
 +
'''NOTE #1:''' The '''connect_to_vc''' function should always be called as a first of Photoneo Bin Picking API procedures. It should always be followed by '''init_req''' function. Not obeying these order will result in a communication error.
 +
 
 +
 
 +
'''NOTE #2:''' The '''wait_for_scan''' has to be called after the '''scan_req'''. A user can perform standard robotic commands between these two calls but cannot perform any other Photoneo Bin Picking API calls. The '''wait_for_scan''' function has to be finished first. For example - '''scan_req''' followed by '''traj_req''' results in communication error.
 +
 
 +
 
 +
'''NOTE #3:''' The '''traj_recv''' has to be called after the '''traj_req'''. A user can perform standard robotic commands between these two calls but cannot perform any other Photoneo Bin Picking API calls. The '''traj_recv''' function has to be finished first. For example - the '''traj_req''' followed by the '''scan_req''' results in a communication error.
  
  
 
=== 4.2 AS CONFIG ===
 
=== 4.2 AS CONFIG ===
  
'''customer_definitions.pg''' enables the user to configure several binpicking settings, to define home, start & end bin picking positions, to implement gripper commands, to set trajectory speed and to make precision adjustments.  
+
'''customer_definitions.pg''' enables the user to configure several bin picking settings, to define home, start & end bin picking positions, to implement gripper commands, to set trajectory speed and to make precision adjustments.  
 
--------------------------------------------------------
 
--------------------------------------------------------
  
 
==== 4.2.1 ROUTINES ====
 
==== 4.2.1 ROUTINES ====
 +
 +
- '''pick_part()''' - standard binpicking sequence. This flexible, operation-based implementation allows performing binpicking sequences, which consist of various numbers of operations to be performed. '''Do not edit !!!'''
 +
 +
- '''place_part()''' - placing operation. Adapt placing sequence and poses to meet your application requirements
  
 
- '''traj_1_params()''' - set DECEL and ACCURACY parameters for first trajectory - usually APPROACH
 
- '''traj_1_params()''' - set DECEL and ACCURACY parameters for first trajectory - usually APPROACH
Line 185: Line 211:
  
 
- '''traj_4_params()''' - set DECEL and ACCURACY parameters for fourth trajectory - usually END
 
- '''traj_4_params()''' - set DECEL and ACCURACY parameters for fourth trajectory - usually END
 
- '''pick_part()''' - standard binpicking sequence. This flexible, operation-based implementation allows performing binpicking sequences, which consist of various numbers of operations to be performed. '''Do not edit !!!'''
 
 
- '''place_part()''' - placing operation. Adapt placing sequence and poses to meet your application requirements.
 
  
 
- '''grip_attach()'''  - implement function for attaching object to the gripper here   
 
- '''grip_attach()'''  - implement function for attaching object to the gripper here   
  
- '''grip_deattach()'''  - implement function for detaching object from the gripper here
+
- '''grip_detach()'''  - implement function for detaching object from the gripper here
  
 
- '''gripper_user_1()''' - implement custom user gripper command (reserved for future use)
 
- '''gripper_user_1()''' - implement custom user gripper command (reserved for future use)
Line 208: Line 230:
 
==== 4.2.2 VARIABLES ====
 
==== 4.2.2 VARIABLES ====
  
- '''#pho_home''' - homing position for the robot - the robot automatically moves to this position once a connection to the Vision Controller is established. This position should not collide with the scanner space.  
+
- '''#pho_home''' - homing position for the robot - the robot automatically moves to this position once a connection to the Bin Picking Studio is established. This position should not collide with the scanner space.  
  
- '''#pho_start''' - start binpicking position - this position should be defined right above the bin. The robot moves to this position when a trajectory is successfully received.
+
- '''#pho_start''' - start bin picking position - this position should be defined right above the bin. The robot moves to this position when a trajectory is successfully received.
  
- '''#pho_end''' - end binpicking position - this position should be defined in near proximity to the bin. The robot finishes its bin picking movement in this position.  
+
- '''#pho_end''' - end bin picking position - this position should be defined in near proximity to the bin. The robot finishes its bin picking movement in this position.  
  
- '''#pho_place_up''' - upper placing position - this is used for demonstration purposes only; in real applications users can define their own placing positions and routines.
+
- '''#pho_place_up''' - upper placing position - this is used for demonstration purposes only; in real applications, users can define their own placing positions and routines.
  
 
- '''#pho_place_down''' -  position for part placing - this is used for demonstration purposes only; in real applications users can define their own placing positions and routines.
 
- '''#pho_place_down''' -  position for part placing - this is used for demonstration purposes only; in real applications users can define their own placing positions and routines.
Line 220: Line 242:
 
=== 4.3 AS ERROR HANDLING ===  
 
=== 4.3 AS ERROR HANDLING ===  
  
The Photoneo KAWASAKI interface provides basic error handling. If an error occurs during binpicking operations, an error code is returned to '''main_application''' via the '''ret_val''' variable.
+
The Photoneo KAWASAKI interface provides basic error handling. If an error occurs during bin picking operations, an error code is returned to '''main_application''' via the '''ret_val''' variable.
 
--------------------------------------------------------
 
--------------------------------------------------------
Following is the list of potential binpicking error codes:  
+
Following is the list of potential bin picking error codes:  
  
'''OK = 0''' - Service response from Vision Controller is valid  
+
'''OK = 0''' - Service response from Bin Picking Studio is valid  
  
'''SERVICE_ERR = 1''' - Service response from Vision Controller is invalid.
+
'''SERVICE_ERR = 1''' - Service response from Bin Picking Studio is invalid.
  
'''UNKNOWN_REQ = 2''' - The Vision Controller received an unknown request.
+
'''UNKNOWN_REQ = 2''' - The Bin Picking Studio received an unknown request.
  
 
'''COMM_FAILURE = 3''' - Communication failure due to socket closure.   
 
'''COMM_FAILURE = 3''' - Communication failure due to socket closure.   
Line 235: Line 257:
  
 
'''TIMEOUT = 5''' - Communication failure due to socket timeout.
 
'''TIMEOUT = 5''' - Communication failure due to socket timeout.
 +
 +
'''UNKNOWN_ERR = 99''' - Unspecified internal error
  
 
'''PLANNING_FAILED = 201''' - Trajectory planning has failed
 
'''PLANNING_FAILED = 201''' - Trajectory planning has failed
Line 240: Line 264:
 
'''NO_PART_FOUND = 202''' - No part has been localized
 
'''NO_PART_FOUND = 202''' - No part has been localized
  
'''NOT_INIT = 203''' - Bin picking application has not been properly initialized on Vision Controller
+
'''NOT_INIT = 203''' - Bin picking application has not been properly initialized on the Bin Picking Studio side.
  
'''UNKNOWN_ERR = 299''' - Unspecified internal error
+
'''WRONG_BP_CONFIG = 255''' - Wrong Bin Picking Configuration - Check Log Console in the Bin Picking Studio
 
--------------------------------------------------------
 
--------------------------------------------------------
 
The '''main_application.pg''' already includes basic error_handling which is implemented through '''labels''' and '''GOTO''' commands, but it can be adapted to more complex scenarios if required.
 
The '''main_application.pg''' already includes basic error_handling which is implemented through '''labels''' and '''GOTO''' commands, but it can be adapted to more complex scenarios if required.
Line 383: Line 407:
  
  
[[File:Kawa run step 0.png]]
+
[[File:Kawa run step 0.png|frame|none|alt=Alt text| Figure 5.1]]
  
  
Line 389: Line 413:
  
  
[[File:Kawa run step 2.png]]
+
[[File:Kawa run step 2.png|frame|none|alt=Alt text| Figure 5.2]]
  
  
Line 395: Line 419:
  
  
[[File:Kawa run step 3.png]]
+
[[File:Setting up Guide Kawasaki Main Select.png|frame|none|alt=Alt text| Figure 5.3]]
  
  
Line 401: Line 425:
  
  
[[File:Kawa runtime step 1.png]]
+
[[File:Kawa runtime step 1.png|frame|none|alt=Alt text| Figure 5.4]]
  
  
 
Now turn on the motor power. '''Hold A key + MOTOR_ON/JOG key'''. You should hear that the motors brakes have been released and '''MOTOR status''' should appear right next to the RUN status in the top right corner.
 
Now turn on the motor power. '''Hold A key + MOTOR_ON/JOG key'''. You should hear that the motors brakes have been released and '''MOTOR status''' should appear right next to the RUN status in the top right corner.
  
[[File:Kawa runtime step 2.png]]
+
 
 +
[[File:Kawa runtime step 2.png|frame|none|alt=Alt text| Figure 5.5]]
  
  
The Kawasaki robot is now ready for connection to the Vision Controller. Start bin picking in '''Deployment''' tab of Photoneo Bin Picking Studio and wait until the '''Robot Status''' and '''Scanner Status''' both show: '''Connected'''
+
The Kawasaki robot is now ready for connection to the Bin Picking Studio. Start bin picking in '''Deployment''' tab of Photoneo Bin Picking Studio and wait until the '''Robot Status''' and '''Scanner Status''' both show: '''Connected'''
  
  
[[File:Kawa run step 9.png]]
+
[[File:Kawa run step 9.png|frame|none|alt=Alt text| Figure 5.6]]
  
  
Line 418: Line 443:
  
  
[[File:Kawa runtime step 3.png]]
+
[[File:Kawa runtime step 3.png|frame|none|alt=Alt text| Figure 5.7]]
  
  
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'''
+
If the connection between the robot controller and the Bin Picking Studio has been established properly, the robot should move to the home position and the  Bin Picking status should show: '''Connected'''
  
  
[[File:Kawa run step 10.png]]
+
[[File:Kawa run step 10.png|frame|none|alt=Alt text| Figure 5.8]]
  
  
Line 430: Line 455:
  
  
[[File: Kawasaki tutorial keyboard.png]]
+
[[File: Kawasaki tutorial keyboard.png|frame|none|alt=Alt text| Figure 5.9]]
  
  
Line 437: Line 462:
  
 
'''NOTE: Ensure that you are ready to halt motion execution immediately. It is strongly recommended to reduce the speed to 10% of maximum during initial bin picking tests.'''
 
'''NOTE: Ensure that you are ready to halt motion execution immediately. It is strongly recommended to reduce the speed to 10% of maximum during initial bin picking tests.'''
 +
 +
== 6. TROUBLESHOOTING ==
 +
 +
If you experience '''Open Socket Error''' as shown in the figure below, it means that the previous connection to the Bin Picking Studio has not been properly closed.
 +
 +
 +
[[File: Setting up Guide Kawasaki Open Socket Issue.png|frame|none|alt=Alt text| Figure 5.10]]
 +
 +
 +
Run the '''close_socket()''' program to terminate the previous session properly:
 +
 +
 +
[[File: Setting up Guide Kawasaki Close Socket.png|frame|none|alt=Alt text| Figure 5.11]]

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. Prerequisities

The Photoneo KAWASAKI Interface is compatible with all E-series robot controllers.

2. KAWASAKI Controller setup

The following tutorial provides a step by step guide of how to configure your KAWASAKI E-series controller and install all .pg files which you will need to get the robot interface for Photoneo Bin Picking Studio up and running.

2.1 Network configuration

Turn on the robot controller, wait for the system to boot, open the Menu screen and select the Aux Function option:

Alt text
Figure 2.1.1


In the Aux function menu select System and Network Settings:


Alt text
Figure 2.1.2


E-series robot controllers have two Ethernet ports. We will use Port 1 for communication with Photoneo Binpicking 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 Photoneo Bin Picking Studio are on the same subnet.


Alt text
Figure 2.1.3


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.


Alt text
Figure 2.1.4


2.2 Enable Autostart

The Photoneo KAWASAKI interface consists of two tasks - the Bin Picking Client task and the State server.

While the bin picking client is Cycle Started as a normal robotic program, state server runs in the background from the boot.

In order to enable the state server to run properly from the first boot, it is necessary to enable the AUTOSTART.PC system switch.

On the pendant click Menu -> Aux Functions -> Advanced Settings -> System Switch


Alt text
Figure 2.2.1


You should see the list of system switches. AUTOSTART.PC switches are available on the second page so click Next Page to access them.

Turning AUTOSTART.PC to ON enables State Server to start properly even on the first boot


Alt text
Figure 2.2.2


Restart the robot controller to apply the network and autostart settings.

NOTE: Before proceeding further, please ensure that State server is running - PC window on the pendant is not empty - AUTOSTART program pointer should be visible here !!!


Alt text
Figure 2.2.3

2.3 BASE Coordinates

Photoneo Bin Picking Studio requires the origin of the robot to be defined at the very bottom of the robot.

In Kawasaki robots, the default origin position is in the axis of the second joint, so therefore we need to redefine its position and shift it vertically down in the Z-axis.

Browse to Menu->Aux Functions -> Advanced Settings -> Base Coordinates

Alt text
Figure 2.3.1


Set the Z coordinate value according to the robot being used and offset the list as is shown below:


Alt text
Figure 2.3.2


NOTE: Be careful if you are integrating Photoneo Bin Picking interface into an existing application since changes to the Base Coordinates might affect your previously taught positions!

3. KRTerm

Photoneo KAWASAKI interface consists of three .pg files

- photoneo_common.pg

- customer_definitions.pg

- main_application.pg

These three files include approximately 25 programs which comprise the Photoneo Kawasaki Interface. All of these files need to be transferred to the robot controller to get the interface up and running.

3.1 Transfering .pg files to robot controller

You should have received the .pg files as a .zip archive together with Photoneo Bin Picking Studio. 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.

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:


Alt text
Figure 3.1.1


Input the IP address of Port 2 as configured in the pendant in the previous step and click the Add button:


Alt text
Figure 3.1.2


Click File -> Set Current Folder and set the path to the folder where you saved the extracted .pg files


Alt text
Figure 3.1.3


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:


Alt text
Figure 3.1.4


The login name is as . If 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 as is shown in the figure below:


Alt text
Figure 3.1.5


Use the LOAD command to upload all three .pg files of the Photoneo KAWASAKI interface.


Alt text
Figure 3.1.6


At this point, your Robot Controller is configured to work with Photoneo Bin Picking Studio. However your AS code must be adapted to meet the requirements of your application - you need to reteach HOME, START and END pose, update part placing, application logic, etc. The following section of the tutorial provides basic examples of how this can be programmed and also offers a detailed explanation of the Photoneo AS API.

4. AS Language

The Photoneo KAWASAKI interface was designed to be easily integrated into existing applications written in AS code. The interface influences the final behavior of the robot using two different methods:

- AS API - a set of AS requests (or procedures) used to control the bin picking sequence. Requests are defined in the photoneo_common.pg module and used within main_application.pg

- AS CONFIG - customer_definitions.pg holds application specific settings such as gripper commands, motion execution settings and object placing definitions.

4.1 AS API

The following API describes the functionality of requests provided by the Photoneo KAWASAKI Interface. These requests are intended for high-level control of bin picking sequences and are usually called in main_application.pg


- connect_to_vc(.ret_val_conn) - function to establish a connection to the Vision Controller. Blocking function; suspends the program until a proper connection is established.

- init_req(.ret_val_init) - request to initialize bin picking application from the Vision Controller side. Start and End Poses defined by the operator from the AS side are transferred to the Vision Controller and used in the trajectory planning pipeline as start and terminus points.

- scan_req(.ret_val_scan) - request to trigger the next scan and localization. Non-blocking request; the AS program continues immediately at the next line.

- wait_for_scan(.ret_val_wait) - function to wait for the scan to be finished. This should be called after triggering the scan, but not immediately. Blocking function, waits for a response from Vision Controller.

- traj_req(.ret_val_traj) - request to start trajectory planning for current goal. Non-blocking function; the AS program continues immediately at the next line.

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

- change_sol_req(.ret_val_sol) - request to change currently deployed solution.

- calib_start_req(.ret_val_start) - request to start current calibration for selected vision system and remove all previously added points (Not supported in this version)

- calib_add_req(.ret_val_add) - - request to add calibration point - a scan is triggered and the calibration is recalculated. (Not supported in this version)

- calib_set_req(.ret_val_set) - request to save current calibration result to selected Vision System (Not supported in this version)

- calib_reset_req(.ret_val_reset) - request to reset current calibration and remove all previously added points (Not supported in this version)

- locate_bin_req(.ret_val_loc) - request to localize bin position in the environment (Reserved for future use)

- pick_failed_req(.ret_val.fail) - request to notify bin picking studio that object picking has failed (Reserved for future use)


NOTE #1: The connect_to_vc function should always be called as a first of Photoneo Bin Picking API procedures. It should always be followed by init_req function. Not obeying these order will result in a communication error.


NOTE #2: The wait_for_scan has to be called after the scan_req. A user can perform standard robotic commands between these two calls but cannot perform any other Photoneo Bin Picking API calls. The wait_for_scan function has to be finished first. For example - scan_req followed by traj_req results in communication error.


NOTE #3: The traj_recv has to be called after the traj_req. A user can perform standard robotic commands between these two calls but cannot perform any other Photoneo Bin Picking API calls. The traj_recv function has to be finished first. For example - the traj_req followed by the scan_req results in a communication error.


4.2 AS CONFIG

customer_definitions.pg enables the user to configure several bin picking settings, to define home, start & end bin picking positions, to implement gripper commands, to set trajectory speed and to make precision adjustments.


4.2.1 ROUTINES

- pick_part() - standard binpicking sequence. This flexible, operation-based implementation allows performing binpicking sequences, which consist of various numbers of operations to be performed. Do not edit !!!

- place_part() - placing operation. Adapt placing sequence and poses to meet your application requirements

- traj_1_params() - set DECEL and ACCURACY parameters for first trajectory - usually APPROACH

- traj_2_params() - set DECEL and ACCURACY parameters for second trajectory - usually GRASP

- traj_3_params() - set DECEL and ACCURACY parameters for third trajectory - usually DEAPPROACH

- traj_4_params() - set DECEL and ACCURACY parameters for fourth trajectory - usually END

- grip_attach() - implement function for attaching object to the gripper here

- grip_detach() - implement function for detaching object from the gripper here

- gripper_user_1() - implement custom user gripper command (reserved for future use)

- gripper_user_2() - implement custom user gripper command (reserved for future use)

- gripper_user_3() - implement custom user gripper command (reserved for future use)

- gripper_user_4() - implement custom user gripper command (reserved for future use)

- gripper_user_5() - implement custom user gripper command (reserved for future use)

- gripper_user_6() - implement custom user gripper command (reserved for future use)

4.2.2 VARIABLES

- #pho_home - homing position for the robot - the robot automatically moves to this position once a connection to the Bin Picking Studio is established. This position should not collide with the scanner space.

- #pho_start - start bin picking position - this position should be defined right above the bin. The robot moves to this position when a trajectory is successfully received.

- #pho_end - end bin picking position - this position should be defined in near proximity to the bin. The robot finishes its bin picking movement in this position.

- #pho_place_up - upper placing position - this is used for demonstration purposes only; in real applications, users can define their own placing positions and routines.

- #pho_place_down - position for part placing - this is used for demonstration purposes only; in real applications users can define their own placing positions and routines.

4.3 AS ERROR HANDLING

The Photoneo KAWASAKI interface provides basic error handling. If an error occurs during bin picking operations, an error code is returned to main_application via the ret_val variable.


Following is the list of potential bin picking error codes:

OK = 0 - Service response from Bin Picking Studio is valid

SERVICE_ERR = 1 - Service response from Bin Picking Studio is invalid.

UNKNOWN_REQ = 2 - The Bin Picking Studio 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.

UNKNOWN_ERR = 99 - Unspecified internal error

PLANNING_FAILED = 201 - Trajectory planning has failed

NO_PART_FOUND = 202 - No part has been localized

NOT_INIT = 203 - Bin picking application has not been properly initialized on the Bin Picking Studio side.

WRONG_BP_CONFIG = 255 - Wrong Bin Picking Configuration - Check Log Console in the Bin Picking Studio


The main_application.pg already includes basic error_handling which is implemented through labels and GOTO commands, but it can be adapted to more complex scenarios if required.

4.4 MAIN APPLICATION

This is a basic bin picking template. The main program loop is defined here and the main application implements the variables defined in customer_definitions.pg

Users should input an IP Address and set the Port of the Vision Controller and adapt operation logic here.

    ; Copyright (c) 2018 Photoneo s.r.o.
    ; All rights reserved
    ; Description: Photoneo Kawasaki Module v.1.2.0 Main Application
    ;//-------------------------------------------------------------------------
    .PROGRAM main()
 
      ;// Enable State Server to start on boot
      AUTOSTART.PC ON
         
      ;// Adopt Network settings to your meet your configuration
      BP_PORT = 11003
      VC_IP[1] = 192
      VC_IP[2] = 168
      VC_IP[3] = 100
      VC_IP[4] = 12
 
      ;// Connect to Vision Controller
      CALL connect_to_vc(ret_val)
      IF ret_val == COMM_FAILURE THEN
        GOTO quit
      END
 reinit:
     ;// Initialize binpicking
     CALL init_req(ret_val)
     IF ret_val <> OK THEN
       GOTO quit
     END     
   
     ;// Deattach gripper and move to Home Position - away from scanning area
     CALL grip_deattach
     SPEED 10 ALWAYS
     JMOVE #pho_home
     BREAK
   
     ;// Request first scan 
     CALL scan_req(ret_val)
     IF ret_val == COMM_FAILURE THEN
       GOTO quit
     END   
 
     ;// Initial wait
     TWAIT 10  
 
     ;// MAIN LOOP
     WHILE (TRUE) DO
 main_start:	
       ;// Wait for scan completition
       CALL wait_for_scan(ret_val)
 
       ;// Check COMM_FAILURE error
       IF (ret_val == COMM_FAILURE) THEN
         GOTO quit
       END
 
       ;// Check NOT_INIT or SERVICE_ERR state
       IF (ret_val == NOT_INIT) OR (ret_val == SERVICE_ERR) THEN
         GOTO reinit
       END
    
       ;// SCAN was received successfully
       IF (ret_val == OK) THEN
 
         ;// Request trajectory
         CALL traj_req(ret_val)
         IF ret_val == COMM_FAILURE THEN
           GOTO quit
         END
 
         ;// Receive trajectory
         CALL traj_recv(ret_val)
   
         ;// Check COMM_FAILURE error
         IF ret_val == COMM_FAILURE THEN
           GOTO quit
         END
   
         ;// Check NOT_INIT or SERVICE_ERR state
         IF (ret_val == NOT_INIT) OR (ret_val == SERVICE_ERR) THEN
           GOTO reinit
         END
   
         ;// Check PLANNING FAILED or NO_PART_FOUND state
         IF (ret_val == PLANNING_FAILED) OR (ret_val == NO_PART_FOUND) THEN
     
           ;// Move back to home position
 	    JMOVE #pho_home
           BREAK
   	
 	    ;// Request new scan		
           CALL scan_req(ret_val)
           IF ret_val == COMM_FAILURE THEN
             GOTO quit
           END
 	
 	    GOTO main_start  	
         END
   	  
         ;// TRAJECTORY was calculated successfully
         IF (ret_val == OK) THEN
   
           ;// Move robot to binpicking start position
           JMOVE #pho_start
   
           ;// Pick part and wait for movement completition
           CALL pick_part	  
           BREAK
   
           ;// Trig new scan
           CALL scan_req(ret_val)
           IF ret_val == COMM_FAILURE THEN
             GOTO quit
           END
    
           ;// Place part
           CALL place_part	  
         END
       END
     END
     ;//End of MAIN LOOP  
 
   quit:
     CALL close_socket
   .END

5. RUNTIME

Once all changes has been uploaded to the robot controller using USB Stick or KRTerm, you are ready to start the bin picking application.

The first step is to select the program which will be run. Click on the yellow program rectangle on the pendant touch screen:


Alt text
Figure 5.1


Select Directory to enter the program list:


Alt text
Figure 5.2


Find and select the main program:


Alt text
Figure 5.3


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:


Alt text
Figure 5.4


Now turn on the motor power. Hold A key + MOTOR_ON/JOG key. You should hear that the motors brakes have been released and MOTOR status should appear right next to the RUN status in the top right corner.


Alt text
Figure 5.5


The Kawasaki robot is now ready for connection to the Bin Picking Studio. Start bin picking in Deployment tab of Photoneo Bin Picking Studio and wait until the Robot Status and Scanner Status both show: Connected


Alt text
Figure 5.6


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:


Alt text
Figure 5.7


If the connection between the robot controller and the Bin Picking Studio has been established properly, the robot should move to the home position and the Bin Picking status should show: Connected


Alt text
Figure 5.8


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


Alt text
Figure 5.9


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 maximum during initial bin picking tests.

6. TROUBLESHOOTING

If you experience Open Socket Error as shown in the figure below, it means that the previous connection to the Bin Picking Studio has not been properly closed.


Alt text
Figure 5.10


Run the close_socket() program to terminate the previous session properly:


Alt text
Figure 5.11