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

From 3D scanning Knowledge base - Photoneo wiki
Jump to: navigation, search
Line 411: Line 411:
 
     JUMP *MAIN
 
     JUMP *MAIN
 
     END
 
     END
 +
 +
 +
== 4. Runtime ==
 +
 +
Now you are ready to start the bin picking application. '''Browse to '''JOB''' -> '''Select Job''' and choose the '''PHO_MAIN''' program:
 +
 +
[[File: 20190225132927.jpg|frame|none|alt=Alt text| Figure 4.1]]
 +
 +
 +
Ensure that the Bin Picking application on the Vision Controller side is running and waiting for a connection:
 +
 +
 +
[[File:Fanuc tutorial Step waiting.png|frame|none|alt=Alt text| Figure 4.2]]
 +
 +
 +
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'''
 +
 +
 +
[[File:Fanuc tutorial Step connected.png|frame|none|alt=Alt text| Figure 4.4]]
 +
 +
 +
As soon as the trajectory to the first localized object is calculated, the robot should start executing the motion.
 +
 +
'''NOTE: Ensure that you are prepared to halt the motion execution immediately if any problem arises. It is strongly recommended to reduce the speed to 10% of maximum during initial bin picking tests.'''

Revision as of 13:29, 25 February 2019

NOTE: Users are strongly recommended to read the general introduction to robot interfaces prior to installing specific robot modules.

1. Prerequisites

Prior to setup, please ensure that your Yaskawa controller meets the following criteria:

- YRC1000 - the latest controller version. FS100, DX100 and DX200 are currently not supported but available on demand. NX100 is deprecated!

- MotoPlus Runtime option - This option needs to be enabled on robot controller in order to get Photoneo Yaskawa interface up and running.

The Photoneo Yaskawa Interface was originally developed using GP8 manipulator and YRC1000 Controller with the following version:


Alt text
Figure 1.0.1

2. Yaskawa Controller Setup

2.1 Maintenance & Management Mode

When configuring Yaskawa controller for Photoneo Interface it is necessary to switch to the Maintenance Mode and select Management Security level. Following procedure describes the steps necessary to enter this mode.

Start the Robot Controller into a Maintenance Mode by holding the Main Menu button while turning the main switch on. You should hear a short beep on a boot. Maintenance mode screen is shown in the figure below:


Alt text
Figure 2.1.1


Switch Security Level from Editing to Management Mode. Browse to System -> Security and select Management Mode:


Alt text
Figure 2.1.2


As a password to management mode, insert 9999999999999999 (16x9):


Alt text
Figure 2.1.3


Notice three keys in the top status bar - this means that Management Mode is Active

2.2 Set IP Address

Configure the IP address of the robot controller. In Maintenance mode, browse to System -> Setup -> Option Functions:


Alt text
Figure 2.2.1


Select LAN Interface Setting to enter the Network Configuration pane:


Alt text
Figure 2.2.2


Select Manual Setting for LAN2 Port and amend the IP Address to meet your network requirements:


Alt text
Figure 2.2.3


2.3 Enable MotoPlus Functionality

If MotoPlus functionality has not been enabled on robot controller before, browse to System -> Setup -> Option Functions

Switch MOTOPLUS Func Flag from NOT USED to USED.


Alt text
Figure 2.3.1


MotoPlus APL icon should be now visible on the left pane. Enter the MotoPlus Func. Settings to configure MotoPlus autostart option:


Alt text
Figure 2.3.2


2.4 Load Photoneo Yaskawa Module

Photoneo Yaskawa Module consists of several JOB Files and one PhotoneoBP_CONTROLLER_v_x_y_z.out file. This OUT file needs to be loaded to the Robot Controller as follows:

Select MOTOPLUS Apl. -> Load (User Application) and select the specific out file:


Alt text
Figure 2.4.1


Confirm loading the application by clicking YES:


Alt text
Figure 2.4.2


Maintenance Mode Configuration for Photoneo Yaskawa Module is finished now. Restart the robot controller into Normal Mode.

=== 2.5 Copy INFORM JOBS to Robot Controller

As a next step, all JOBS from INFORM Folder of Photoneo Yaskawa Module needs to be copied from USB to the robot controller.

Browse to Ex. Memory -> Load and select all JOBS from the INFORM Folder as shown in the figure below:


Alt text
Figure 2.5.1


Press Enter to start the transfer:


Alt text
Figure 2.5.2


All JOB files are now available in Robot Controller. Before proceeding further it is important to learn which registers are occupied by Photoneo Yaskawa Module.

2.6 Occupied Variables

Photoneo Yaskawa Module occupies following data registers:

BYTE REGISTERS (FLAGS):

  • B000 - CONNECT_TO_VC - flag set by INFORM JOB to notify MotoPlus application to establish connection to VC
  • B001 - CONNECTED - flag set by MotoPlus application to notify INFORM that connection has been established
  • B002 - NEW_REQ - flag set by INFORM JOB to notify MotoPlus application that new request has been issued
  • B003 - REQ_FINISHED - flag set by MotoPlus application to notify INFORM that request has been handled
  • B004 - DATA_READY - flag set by MotoPlus application to notify INFORM that bin picking sequence data are ready for execution
  • B005 - OPER_READY - flag set by MotoPlus application to notify INFORM that data are ready for execution
  • B006 - OPER_FINISH - flag set by INFORM JOB to notify MotoPlus application that operation has been executed
  • B007 - PICK_FINISH - flag set by MotoPlus application to notify INFORM about executing the last bin picking operation


Alt text
Figure 2.6.1


INTEGER RESIGTERS:

  • I000 - VC_IP_ADDRESS_1 - First Part of Vision Controller IP Address
  • I001 - VC_IP_ADDRESS_2 - Second Part of Vision Controller IP Address
  • I002 - VC_IP_ADDRESS_3 - Third Part of Vision Controller IP Address
  • I003 - VC_IP_ADDRESS_4 - Fourth Part of Vision Controller IP Address
  • I004 - VISION_SYSTEM_ID - Set Vision System ID here
  • I005 - REQUEST_TYPE - Type of request which is currently being handled
  • I006 - RESPONSE_STATUS - Response status for the last request
  • I007 - NUM_OF_OPER - Number of executed operation of current bin picking sequence
  • I008 - OPER_TYPE - Type of operation in execution
  • I009 - GRIPPER_ACTION - Type of gripper action in execution
  • I010 - TRAJ_SIZE - Size of trajectory in execution
  • I011 - TOOL_INVARIANCE - Tool Invariance for current pick
  • I012 - GRIP_POINT_ID - Gripping Point ID for current pick
  • I013 - GRIP_INVARIANCE - Gripping Point Invariance for current pick
  • I014 - I023 - INFO DATA 1-10 - Another info data received from Bin Picking Studio
  • I024 - CUSTOMER REQUEST - Num of data for customer request
  • I025 - NEXT SOLUTION ID - ID of solution that should be activated by PHO_CHANGE_SOL_REQ
  • I030 - TRAJ_CURRENT - Current trajectory speed - this is set automatically by MotoPlus application according to the content of I031-I040 registers
  • I031 - I040 - TRAJ_1_SPEED - TRAJ_10_SPEED - configuration of trajectory speed


Alt text
Figure 2.6.2


REAL REGISTERS:

  • R000 - CALIBRATION_ERROR (not supported in this version)
  • R001 - CUSTOMER_DATA_1 - data #1 to be send as a part of customer request to the Vision Controller
  • R002 - CUSTOMER_DATA_2 - data #2 to be send as a part of customer request to the Vision Controller
  • R003 - CUSTOMER_DATA_3 - data #3 to be send as a part of customer request to the Vision Controller
  • R004 - CUSTOMER_DATA_4 - data #4 to be send as a part of customer request to the Vision Controller


Alt text
Figure 2.6.3


POSITION REGISTERS:

  • P000 - Start Pose for Vision System 1
  • P001 - End Pose for Vision System 1
  • P002 - Start Pose for Vision System 2
  • P003 - End Pose for Vision System 2
  • P004 - Start Pose for Vision System 3
  • P005 - End Pose for Vision System 3
  • P006 - Start Pose for Vision System 4
  • P007 - End Pose for Vision System 4
  • P010 - P0110 - Reserved for trajectory execution

2.7 Reteach Start and End Positions

A crucial step of bin picking configuration is the teaching of home, start, and end poses. The home position of the robot should be taught in such a way that the robot remains outside the scanning area. The start position should be taught in such a way that the robot gripper is approximately above the center of the bin. The end position can be similar to the start position or slightly shifted towards the placing area. Do not position the end pose too far from the bin as this might significantly affect dynamic trajectory planning, increase total planning time and cause planning errors.

Start and End positions must be stored in Position Registers, it cannot be just a local program position variable.

The easiest way how to set values to Position Registers is to use PHO_TEACH_START_POSE and PHO_TEACH_END_POSE JOBS as shown in the figure below:


Alt text
Figure 2.7.1


Jog robot to the Start Pose, reteach the only MOVJ Command in the PHO_TEACH_START_POSE JOB and run the program. This procedure sets the current Joint Position to the P000 variable.

Repeat the same step with PHO_TEACH_END_POSE JOB to set P001 variable. If needed repeat the same procedure for other vision systems - do not forget to rewrite the P00X number in JOB in such a scenario.

3. INFORM LANGUAGE

The Photoneo Yaskawa Module was designed to be easily integrated into existing applications written as INFORM JOBS.

3.1 INFORM API

The Photoneo YASKAWA INFORM API is comprised of the following programs. These are intended for high-level level control of bin picking sequences and are usually called in PHO_MAIN program.

PHO_CONNECT_TO_VC - function to establish a connection to the Vision Controller. Blocking function; suspends the program until a proper connection is established.

PHO_SCAN_REQ - request to trigger the next scan and localization. Non-blocking request; the INFORM program continues immediately at the next line.

PHO_WAIT_FOR_SCAN - function to wait for scan to be finished. This should be called after triggering the scan but does not have to be called immediately. Blocking function, waits for the response from the BP Studio.

PHO_TRAJ_REQ - request to receive requested bin picking trajectories (consisting of a sequence of trajectory and gripper operations). Blocking function; waits for motion data to be received.

PHO_INIT_REQ - request to initialize bin picking application from the Vision Controller side. Start and End Poses defined by the operator from Teach Pendant are transferred to the Vision Controller and used in the trajectory planning pipeline as start and terminus points.

PHO_CHANGE_SOL_REQ - request to change currently deployed solution.

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

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

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

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

PHO_BIN_LOCATOR - request to localize bin position in the environment (Reserved for future use)

PHO_PICK_FAILED - request to notify bin picking studio that object picking has failed (Reserved for future use)


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


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


3.2 INFORM CONFIG

The following JOBS enable the user to configure several bin picking settings, to implement gripper commands and to amend the placing of the attached object.

4.2.1 ROUTINES

- PHO_PICK_OBJECT - standard bin picking sequence. This flexible, operation-based implementation allows performing bin picking sequences, which consist of various operations to be performed. Do not edit !!!

- PHO_PLACE_OBJECT - placing operation. Adapt placing sequence and poses to meet your application requirements

- PHO_GRIPPER_ATTACH - implement function for attaching object to the gripper here

- PHO_GRIPPER_DETACH - implement function for detaching object from the gripper here

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

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

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

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

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

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

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

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


3.3 INFORM ERROR HANDLING

The Photoneo YASKAWA interface provides basic error handling. If an error occurs during bin picking operations, an error code is returned in Register I006 - RESPONSE STATUS.

The following list shows the 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


Photoneo Yaskawa Interface by default performs basic error handling immediately after the PHO_TRAJ_REQ call.

If NOT_INIT or SERVICE_ERR occurs, the whole bin picking is reinitialized.

If PLANNING_FAILED or NO_PART_FOUND occurs, scanning is repeated.

It is up to the user to decide if existing error handling is sufficient for a particular application or if it needs to be expanded.

3.4 MAIN APPLICATION

PHO_MAIN program can be considered as a basic bin picking template. The main program loop with basic error handling is implemented here. The user can amend the details to meet their application requirements.

   NOP
   'CONNECT TO VC
   *CONNECT
   CALL JOB:PHO_CONNECT_TO_VC
   
   'SEND INITIALIZE REQUEST
   *INIT
   CALL JOB:PHO_INIT_REQ
   'CHECK RESPONSE
   IFTHENEXP I006<>0
       ABORT
   ENDIF
   
   *SCAN
   'MOVE TO HOME POSE
   MOVJ C00000 VJ=I026
   'REQUEST FIRST SCAN
   CALL JOB:PHO_SCAN_REQ
   'INITIAL WAIT
   WAIT T=10.00
   
   'MAIN LOOP
   *MAIN
   'WAIT FOR SCAN
   CALL JOB:PHO_WAIT_FOR_SCAN
   'CHECK RESPONSE
   IFTHENEXP I006=1 OREXP I006=203 OREXP I006=255
       JUMP *INIT
   ENDIF
   IFTHENEXP I006=0  
       JUMP *TRAJ
   ENDIF
   
   'REQUEST TRAJ
   *TRAJ
   CALL JOB:PHO_TRAJ_REQ
   'IF ERROR THEN REINIT
   IFTHENEXP I006=1 OREXP I006=203 OREXP I006=255
       JUMP *INIT
   ENDIF
   'IF NO TRAJ THEN RESCAN
   IFTHENEXP I006=201 OREXP I006=202
       JUMP *RESCAN
   ENDIF
   
   'IF OK THEN CONTINUE
   IFTHENEXP I006=0
       'MOVE TO START POSE
       MOVJ P000 VJ=I026
       'PICK OBJECT 
       CALL JOB:PHO_PICK_OBJECT 
       'TRIGGER NEXT SCAN
       CALL JOB:PHO_SCAN_REQ
       'PLACE OBJECT
       CALL JOB:PHO_PLACE_OBJECT
       'JUMP BACK TO MAIN LOOP
       JUMP *MAIN
   ENDIF
   
   'NEXT SCAN
   *RESCAN
   CALL JOB:PHO_SCAN_REQ
   'JUMP BACK TO MAIN LOOP
   JUMP *MAIN
   END


4. Runtime

Now you are ready to start the bin picking application. Browse to JOB -> Select Job and choose the PHO_MAIN program:

Alt text
Figure 4.1


Ensure that the Bin Picking application on the Vision Controller side is running and waiting for a connection:


Alt text
Figure 4.2


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


Alt text
Figure 4.4


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

NOTE: Ensure that you are prepared to halt the motion execution immediately if any problem arises. It is strongly recommended to reduce the speed to 10% of maximum during initial bin picking tests.