Difference between revisions of "Bin Picking Tutorial: Setting up Photoneo Bin Picking Studio with MITSUBISHI robots"
Line 12: | Line 12: | ||
− | [[File: Setting Up Guide Mitsubishi Step 22.png]] | + | [[File: Setting Up Guide Mitsubishi Step 22.png|frame|none|alt=Alt text| Figure 1.1.1]] |
Line 28: | Line 28: | ||
− | [[File: Setting Up Guide Mitsubishi Step 17.png]] | + | [[File: Setting Up Guide Mitsubishi Step 17.png|frame|none|alt=Alt text| Figure 2.1.1]] |
Line 34: | Line 34: | ||
− | [[File: Setting Up Guide Mitsubishi Step 21.png]] | + | [[File: Setting Up Guide Mitsubishi Step 21.png|frame|none|alt=Alt text| Figure 2.1.2]] |
Line 40: | Line 40: | ||
− | [[File: Setting Up Guide Mitsubishi Step 19.png]] | + | [[File: Setting Up Guide Mitsubishi Step 19.png|frame|none|alt=Alt text| Figure 2.1.3]] |
Line 47: | Line 47: | ||
=== 2.2 RT ToolBox3 project configuration === | === 2.2 RT ToolBox3 project configuration === | ||
− | When configuring the new project in RTToolBox it is recommended to enable TCP/IP communication for commissioning. | + | When configuring the new project in RTToolBox it is recommended to enable '''TCP/IP''' communication for commissioning. |
− | [[File: Setting Up Guide Mitsubishi RT Toolbox 1.png ]] | + | [[File: Setting Up Guide Mitsubishi RT Toolbox 1.png|frame|none|alt=Alt text| Figure 2.2.1]] |
− | The default configuration should work with RTToolbox3. Do not change any parameters here unless you know exactly what you are doing: | + | The default configuration should work with RTToolbox3. '''Do not change any parameters in Communication Settings''' here unless you know exactly what you are doing: |
− | [[File: Setting Up Guide Mitsubishi RT Toolbox 2.png]] | + | [[File: Setting Up Guide Mitsubishi RT Toolbox 2.png|frame|none|alt=Alt text| Figure 2.2.2]] |
=== 2.3 Go Online === | === 2.3 Go Online === | ||
Line 63: | Line 63: | ||
− | [[File: Setting Up Guide Mitsubishi Step 0.png]] | + | [[File: Setting Up Guide Mitsubishi Step 0.png|frame|none|alt=Alt text| Figure 2.3.1]] |
Line 69: | Line 69: | ||
− | [[File: Setting Up Guide Mitsubishi Step 2.png]] | + | [[File: Setting Up Guide Mitsubishi Step 2.png|frame|none|alt=Alt text| Figure 2.3.2]] |
== 3. Project Setup == | == 3. Project Setup == | ||
− | Photoneo Mitsubishi Interface consists of following | + | Photoneo Mitsubishi Interface consists of following program files: |
* - '''PHOCLIENT''' - handles communication with BP Studio - Do Not Edit | * - '''PHOCLIENT''' - handles communication with BP Studio - Do Not Edit | ||
Line 85: | Line 85: | ||
=== 3.1 Transfering Program files to Robot Controller === | === 3.1 Transfering Program files to Robot Controller === | ||
− | As the first step in Robot Controller configuration upload these four files to the Program List. Right Click on '''Program''' and select '''Program Manager''': | + | As the first step in Robot Controller configuration, upload these four files to the Program List. Right Click on '''Program''' and select '''Program Manager''': |
− | [[File: Setting Up Guide Mitsubishi Step 3.png]] | + | [[File: Setting Up Guide Mitsubishi Step 3.png|frame|none|alt=Alt text| Figure 3.1.1]] |
− | Select four program files and copy them to the robot. Ensure that you have selected proper '''Source''' and '''Destination''': | + | Select four program files from ZIP archive and copy them to the robot. Ensure that you have selected proper '''Source''' and '''Destination''': |
− | [[File: Setting Up Guide Mitsubishi Step 4.png]] | + | [[File: Setting Up Guide Mitsubishi Step 4.png|frame|none|alt=Alt text| Figure 3.1.2]] |
=== 3.2 Parameters === | === 3.2 Parameters === | ||
− | As a next step | + | As a next step, open '''Parameter''' -> '''Parameter List''' and search for a '''PRGUSR''': |
− | [[File: Setting Up Guide Mitsubishi Step 5.png]] | + | [[File: Setting Up Guide Mitsubishi Step 5.png|frame|none|alt=Alt text| Figure 3.2.1]] |
Line 107: | Line 107: | ||
− | [[File: Setting Up Guide Mitsubishi Step 6.png]] | + | [[File: Setting Up Guide Mitsubishi Step 6.png|frame|none|alt=Alt text| Figure 3.2.2]] |
− | Now browse to '''Parameter''' -> '''Program Parameter''' -> '''Command''' and ensure that RAD is selected: | + | Now browse to '''Parameter''' -> '''Program Parameter''' -> '''Command''' and ensure that '''RAD''' is selected: |
− | [[File: Setting Up Guide Mitsubishi Step 7.png]] | + | [[File: Setting Up Guide Mitsubishi Step 7.png|frame|none|alt=Alt text| Figure 3.2.3]] |
As a next step browse to '''Parameter''' -> '''Communication Parameter''' -> '''Ethernet''' | As a next step browse to '''Parameter''' -> '''Communication Parameter''' -> '''Ethernet''' | ||
− | Basic | + | Basic network parameters are shown here including NETIP which was configured as a first step: |
− | [[File: Setting Up Guide Mitsubishi Step 8.png]] | + | [[File: Setting Up Guide Mitsubishi Step 8.png|frame|none|alt=Alt text| Figure 3.2.4]] |
Line 127: | Line 127: | ||
− | [[File: Setting Up Guide Mitsubishi Step 9.png]] | + | [[File: Setting Up Guide Mitsubishi Step 9.png|frame|none|alt=Alt text| Figure 3.2.5]] |
Line 133: | Line 133: | ||
− | [[File: Setting Up Guide Mitsubishi Step 10.png]] | + | [[File: Setting Up Guide Mitsubishi Step 10.png|frame|none|alt=Alt text| Figure 3.2.6]] |
Line 139: | Line 139: | ||
− | [[File: Setting Up Guide Mitsubishi Step 11.png]] | + | [[File: Setting Up Guide Mitsubishi Step 11.png|frame|none|alt=Alt text| Figure 3.2.7]] |
Line 147: | Line 147: | ||
− | [[File: Setting Up Guide Mitsubishi Step 15.png]] | + | [[File: Setting Up Guide Mitsubishi Step 15.png|frame|none|alt=Alt text| Figure 3.2.8]] |
Line 155: | Line 155: | ||
− | [[File: Setting Up Guide Mitsubishi Step 16.png]] | + | [[File: Setting Up Guide Mitsubishi Step 16.png|frame|none|alt=Alt text| Figure 3.2.9]] |
− | === 3.3 Reteach Positions === | + | === 3.3 Reteach PHOMAIN Positions === |
At this point, your Robot Controller is configured to work with Photoneo Bin Picking Studio. However, in order to meet your application requirements, you need to reteach several robot poses. | At this point, your Robot Controller is configured to work with Photoneo Bin Picking Studio. However, in order to meet your application requirements, you need to reteach several robot poses. | ||
− | Open '''PHOMAIN''' file and select '''Joint Tab''' at the bottom of the screen to show a list of joint positions defined within the program. | + | Open '''PHOMAIN''' file and select '''Joint Tab''' at the bottom of the screen to show a list of joint positions defined within the '''PHOMAIN''' program. |
− | Following is the list of Joint Position defined in basic program template. This | + | Following is the list of Joint Position defined in basic program template. This must be adjusted to meet application requirements |
* - '''JHome''' - the robot Home position it should not interfere with scanning volume (Local Variable) | * - '''JHome''' - the robot Home position it should not interfere with scanning volume (Local Variable) | ||
− | + | * - '''JOutOfScan''' - Helper Joint Pose which guarantees that trigger will not be issued until the robot is in the scanning volume. It should be defined at the edge of scanning volume. (Local Variable doesn't have to be used) | |
− | |||
− | |||
− | |||
− | * - '''JOutOfScan''' - Helper Joint Pose which guarantees that trigger will not be issued until the robot is in the scanning volume. It should be defined at the edge of scanning volume. (Local Variable doesn't | ||
* - '''JPlaceUp''' - Place Up Pose - pose above final placing pose (Local Variable depends on the application) | * - '''JPlaceUp''' - Place Up Pose - pose above final placing pose (Local Variable depends on the application) | ||
* - '''JPlace''' - Place Pose - the final placing pose (Local Variable depends on the application) | * - '''JPlace''' - Place Pose - the final placing pose (Local Variable depends on the application) | ||
+ | |||
+ | * - '''JBackToStart''' - Helper Joint Pose which to get robot moving back to start pose. It is recommended to set it to the same values as J_Start defined in PHOCLIENT. (Local Variable doesn't have to be used) | ||
Reteaching all of these poses in Online Mode is simple. Jog the robot to the pose you want to teach and press '''Get Current Pose''' button. The current joint pose is saved. | Reteaching all of these poses in Online Mode is simple. Jog the robot to the pose you want to teach and press '''Get Current Pose''' button. The current joint pose is saved. | ||
+ | |||
+ | === 3.4 Reteach PHOCLIENT Positions === | ||
+ | |||
+ | Now open '''PHOCLIENT''' file and select '''Joint Tab''' at the bottom of the screen to show a list of joint positions defined within the PHOCLIENT program. | ||
+ | |||
+ | * - '''J_Start''' - Bin Picking Start Pose - it should be defined approximately above the center of the bin. (Global Variable, it must be defined) | ||
+ | |||
+ | * - '''J_End''' - Bin Picking End Pose - it should be defined approximately above the center of the bin but it can be also shifted towards the placing area (Global Variable, it must be defined) | ||
+ | |||
+ | Reteach J_Start and J_End poses in the same way as in the case of '''PHOMAIN''' using '''Get Current Pose''' button. | ||
[[File: Setting Up Guide Mitsubishi Step 12.png]] | [[File: Setting Up Guide Mitsubishi Step 12.png]] | ||
− | === 3. | + | === 3.5 PHOCLIENT Config === |
The only single line of code that needs to be edited in PHOCLIENT is the IP address and Port of Bin Picking Client. | The only single line of code that needs to be edited in PHOCLIENT is the IP address and Port of Bin Picking Client. | ||
− | Open '''PHOCLIENT''' and find "Try to establish the connection to BP Studio" section. Amend the IP address of Bin Picking Client and Port number here: | + | Open '''PHOCLIENT''' and find "Try to establish the connection to BP Studio" section. '''Amend the IP address''' of Bin Picking Client and '''Port number''' here: |
[[File: Setting Up Guide Mitsubishi Step 13.png]] | [[File: Setting Up Guide Mitsubishi Step 13.png]] | ||
− | === 3. | + | === 3.6 Gripper commands === |
In Photoneo Mitsubishi Module gripper command are implemented as '''subroutines''' directly in '''PHOMAIN''' program. | In Photoneo Mitsubishi Module gripper command are implemented as '''subroutines''' directly in '''PHOMAIN''' program. |
Revision as of 15:47, 7 March 2019
NOTE: Users are strongly recommended to read the general introduction to robot interfaces prior to installing specific robot modules.
Contents
1. Prerequisites
Photoneo Mitsubishi Interface is written in MELFA V language and it it should be compatible with following controllers:
- - CR750D
- - CR800
The robot used for the development: RV2-FR + CR800 controller with firmware version as shown in the figure below:
NOTE: RT Toolbox3 Software is highly recommended for setting up Photoneo Mitsubishi Module
2. Mitsubishi Controller Setup
2.1 Set IP Address
Setting up an IP Address of Robot Controller is an essential step in robot configuration.
It is not possible to go Online until the configuration of IP address does not match the network configuration of PC running RT Toolbox (same subnet)
Turn on the Robot Controller and Click the MEMU at the bottom. Select Parameter to open the Parameter list:
Turn ON the Keyboard by pressing KEY at the bottom and type NETIP to the search box:
This parameter holds the current IP settings of the Robot Controller. Change IP Address here to match your network configuration (same subnet).
Confirm WRITE and try to ping the Robot Controller from your PC. If this operation is successful, it should be possible to go Online from RTToolBox3.
2.2 RT ToolBox3 project configuration
When configuring the new project in RTToolBox it is recommended to enable TCP/IP communication for commissioning.
The default configuration should work with RTToolbox3. Do not change any parameters in Communication Settings here unless you know exactly what you are doing:
2.3 Go Online
If project configuration has been completed, RTToolbox should be in Offline mode:
Change to Online mode to start configuring Robot Controller:
3. Project Setup
Photoneo Mitsubishi Interface consists of following program files:
- - PHOCLIENT - handles communication with BP Studio - Do Not Edit
- - PHOCOMMON - holds the definition of global variables
- - PHOMAIN - the main program loop is defined here amend program, poses, logic and gripper actions here
- - PHOSTATE - state server module, it runs in the background from the boot and keeps reporting joint states and TCP pose to the Bin Picking Studio.
3.1 Transfering Program files to Robot Controller
As the first step in Robot Controller configuration, upload these four files to the Program List. Right Click on Program and select Program Manager:
Select four program files from ZIP archive and copy them to the robot. Ensure that you have selected proper Source and Destination:
3.2 Parameters
As a next step, open Parameter -> Parameter List and search for a PRGUSR:
Type PHOCOMMON here to enable sharing global variables within all programs:
Now browse to Parameter -> Program Parameter -> Command and ensure that RAD is selected:
As a next step browse to Parameter -> Communication Parameter -> Ethernet
Basic network parameters are shown here including NETIP which was configured as a first step:
Now switch to Device and Line. Photoneo Mitsubishi Module utilize OPT12 and OPT13 Devices:
Configure OPT12 as a Client and set Vision Controller IP here as configured in BP Studio. The default port utilized for Bin Picking Client is 11003
Configure OPT13 as a Server and change protocol to Data Link. The default port utilized for State Server is 11004
Now browse to Parameter -> Program Parameter -> Slot Table.
As is shown in the figure below PHOSTATE program needs to be added to the Slot 8:
Double click on Slot8 and select the PHOSTATE program.
Change conditions to ALWAYS to ensure that PHOSTATE program starts at the boot:
3.3 Reteach PHOMAIN Positions
At this point, your Robot Controller is configured to work with Photoneo Bin Picking Studio. However, in order to meet your application requirements, you need to reteach several robot poses.
Open PHOMAIN file and select Joint Tab at the bottom of the screen to show a list of joint positions defined within the PHOMAIN program.
Following is the list of Joint Position defined in basic program template. This must be adjusted to meet application requirements
- - JHome - the robot Home position it should not interfere with scanning volume (Local Variable)
- - JOutOfScan - Helper Joint Pose which guarantees that trigger will not be issued until the robot is in the scanning volume. It should be defined at the edge of scanning volume. (Local Variable doesn't have to be used)
- - JPlaceUp - Place Up Pose - pose above final placing pose (Local Variable depends on the application)
- - JPlace - Place Pose - the final placing pose (Local Variable depends on the application)
- - JBackToStart - Helper Joint Pose which to get robot moving back to start pose. It is recommended to set it to the same values as J_Start defined in PHOCLIENT. (Local Variable doesn't have to be used)
Reteaching all of these poses in Online Mode is simple. Jog the robot to the pose you want to teach and press Get Current Pose button. The current joint pose is saved.
3.4 Reteach PHOCLIENT Positions
Now open PHOCLIENT file and select Joint Tab at the bottom of the screen to show a list of joint positions defined within the PHOCLIENT program.
- - J_Start - Bin Picking Start Pose - it should be defined approximately above the center of the bin. (Global Variable, it must be defined)
- - J_End - Bin Picking End Pose - it should be defined approximately above the center of the bin but it can be also shifted towards the placing area (Global Variable, it must be defined)
Reteach J_Start and J_End poses in the same way as in the case of PHOMAIN using Get Current Pose button.
3.5 PHOCLIENT Config
The only single line of code that needs to be edited in PHOCLIENT is the IP address and Port of Bin Picking Client.
Open PHOCLIENT and find "Try to establish the connection to BP Studio" section. Amend the IP address of Bin Picking Client and Port number here:
3.6 Gripper commands
In Photoneo Mitsubishi Module gripper command are implemented as subroutines directly in PHOMAIN program.
Scroll down in PHOMAIN program and find specific subroutine (Default routines: GripperAttach, GripperDetach)
4. MELFA V Language
The Photoneo Mitsubishi interface was designed to be easily integrated into existing applications written in MELFA V code.
4.1 MELFA API
The following API describes the functionality of requests provided by the Photoneo MITSUBISHI Interface. These requests are intended for high-level control of bin picking sequences and are usually called in PHOMAIN.prg
- InitReq - 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.
- *ScanReq - request to trigger the next scan and localization. Non-blocking request; the AS program continues immediately at the next line.
- *WaitForScan - 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.
- *TrajReq - request to start trajectory planning for current goal. Non-blocking function; the AS program continues immediately at the next line.
- *TrajRecv - function to receive requested bin picking trajectories (consisting of a sequence of trajectory and gripper operations). Blocking function; waits for motion data to be received.
- *ChangeSol - request to change currently deployed solution.
- *CalibStart - request to start current calibration for selected vision system and remove all previously added points (Not supported in this version)
- *CalibAdd - - request to add calibration point - a scan is triggered and the calibration is recalculated. (Not supported in this version)
- *CalibSet - request to save current calibration result to selected Vision System (Not supported in this version)
- *CalibReset - request to reset current calibration and remove all previously added points (Not supported in this version)
- *LocBin - request to localize bin position in the environment (Reserved for future use)
- *PickFail - request to notify bin picking studio that object picking has failed (Reserved for future use)
NOTE #1: The WaitForScan has to be called after the ScanReq. A user can perform standard robotic commands between these two calls but cannot perform any other Photoneo Bin Picking API calls. The WaitForScan function has to be finished first. For example - ScanReq followed by TrajReq results in communication error.
NOTE #2: The TrajRecv has to be called after the TrajReq. A user can perform standard robotic commands between these two calls but cannot perform any other Photoneo Bin Picking API calls. The TrajRecv function has to be finished first. For example - the TrajReq followed by the ScanReq results in a communication error.
4.2 MELFA CONFIG
Photoneo Mitsubishi Interface enables the user to configure several to implement gripper commands, to set trajectory speed and to make precision adjustments.
4.2.1 SUBROUTINES
- *PickObject - standard bin picking sequence. This flexible, operation-based implementation allows performing bin picking sequences, which consist of various numbers of operations to be performed. Do not edit !!!
- *PlaceObject - placing operation. Adapt placing sequence and poses to meet your application requirements
- *ConfigTraj1 - set JOvrd parameters for first trajectory - usually APPROACH
- *ConfigTraj2 - set JOvrd parameters for first trajectory - usually GRASP
- *ConfigTraj3 - set JOvrd parameters for first trajectory - usually DEAPPROACH
- *ConfigTraj4 - set JOvrd parameters for first trajectory - usually END
- *GripAttach - implement function for attaching object to the gripper here
- *GripDetach - implement function for detaching object from the gripper here
- *GripUser1 - implement custom user gripper command (reserved for future use)
- *GripUser2 - implement custom user gripper command (reserved for future use)
- *GripUser3 - implement custom user gripper command (reserved for future use)
- *GripUser4 - implement custom user gripper command (reserved for future use)
- *GripUser5 - implement custom user gripper command (reserved for future use)
- *GripUser6 - implement custom user gripper command (reserved for future use)
4.3 AS ERROR HANDLING
The Photoneo Mitsubishi interface provides basic error handling. If an error occurs during bin picking operations, an error code is available in M_Status global 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 PHOMAIN already includes basic error handling 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
' Copyright (c) 2019 Photoneo s.r.o. ' All rights reserved ' Description: Photoneo Mitsubishi Module v.1.3 - Main Program ' 'Redeclaration of array variables Dim M_OperBuff(30) Dim J_TrajBuff(10,100) Dim M_TrajSizes(10) Dim M_GripBuff(10) Dim M_InfoData(10) ' 'Load PHOCLIENT Module to Slot 2 XLoad 2,"PHOCLIENT" *Start If C_Prg(2)<>"PHOCLIENT" Then GoTo *Start XRun 2 Wait M_Run(2)=1 ' 'Wait for connection Wait M_Connect = 1 ' 'Safety Delay (Do Not Remove!) Dly 1.0 ' *ReInit ' Send Initialize Request GoSub *InitReq If(M_Status <> M_Ok) Then Hlt ' *ReScan 'Limit joint speed to 10% of MAX SPEED JOvrd 10 ' Move to Home Pose and Detach Gripper Mov JHome GoSub *GripDetach ' ' Send First Scan Request GoSub *ScanReq ' ' Wait for Scan Completition GoSub *WaitForScan If((M_Status = M_NotInit) Or (M_Status = M_ServiceErr)) Then *ReInit ' 'Initial Wait Dly 10 ' 'Request First Trajectory GoSub *TrajReq ' ' Main Loop *MainProg ' ' Wait For Trajectory to be Received GoSub *TrajRecv If((M_Status = M_NotInit) Or (M_Status = M_ServiceErr)) Then *ReInit If((M_Status = M_NoPart) Or (M_Status = M_PlanFail)) Then *ReScan If(M_Status = M_Ok) Then ' ' Pick Object GoSub *PickObject ' ' Move out of scanning volume Mov JOutOfScan ' ' Send Next Scan Request GoSub *ScanReq ' ' Place Object GoSub *PlaceObject ' ' Wait for Scan Completition GoSub *WaitForScan If((M_Status = M_NotInit) Or (M_Status = M_ServiceErr)) Then *ReInit ' ' Request Trajectory GoSub *TrajReq ' ' Return Back to Start Pose GoSub *BackToStart EndIf ' 'Continue in Next Loop GoTo *MainProg
5. Runtime
Once all changes have been uploaded to the robot controller, you are ready to start the bin picking application.
The first step is to select the program which will be run. Select PHOMAIN program: