Difference between revisions of "Bin Picking Tutorial: Setting up Photoneo Bin Picking Studio with ABB robots"
(→4.4.3 calibration()) |
(→4.6 Vision System ID) |
||
(10 intermediate revisions by the same user not shown) | |||
Line 203: | Line 203: | ||
'''pho_receive_trajectory(\num wait_time)''' - function to receive requested bin picking trajectories (consisting of a sequence of trajectory and gripper operations). This is usually called inside ''pho_bin_picking()'' function by default. Blocking function; waits for motion data to be received. | '''pho_receive_trajectory(\num wait_time)''' - function to receive requested bin picking trajectories (consisting of a sequence of trajectory and gripper operations). This is usually called inside ''pho_bin_picking()'' function by default. Blocking function; waits for motion data to be received. | ||
− | |||
− | |||
'''pho_request_calib_start (num vision_system_id)''' - request to start calibration. '''Currently unsupported. Prepared for future use.''' | '''pho_request_calib_start (num vision_system_id)''' - request to start calibration. '''Currently unsupported. Prepared for future use.''' | ||
Line 216: | Line 214: | ||
'''pho_other_req (num data{*}, num size, num vision_system_id)''' - request used to send additional data to Vision Controller. | '''pho_other_req (num data{*}, num size, num vision_system_id)''' - request used to send additional data to Vision Controller. | ||
− | + | ||
− | ' | + | '''pho_request_bin_locator (num vision_system_id) ''' - request to start localization of the bin containing parts to be picked. Bin CAD model position is adjusted in environment. '''Currently unsupported. Prepared for future use.''' |
− | ''pho_request_bin_locator (num vision_system_id) ''' - request to start localization of the bin containing parts to be picked. Bin CAD model position is adjusted in environment. '''Currently unsupported. Prepared for future use.''' | ||
'''pho_request_send_pick_failed (num vision_system_id) ''' - notify Vision Controller about failed pick to lower preference of the part during object-to-pick selection process. | '''pho_request_send_pick_failed (num vision_system_id) ''' - notify Vision Controller about failed pick to lower preference of the part during object-to-pick selection process. | ||
Line 268: | Line 265: | ||
'''PHO_TIMEOUT := 5''' - Communication failure due to socket timeout. | '''PHO_TIMEOUT := 5''' - Communication failure due to socket timeout. | ||
+ | |||
+ | '''PHO_UNKNOWN_ERR := 99''' - Unspecified internal error | ||
'''PHO_PLANNING_FAILED := 201''' - Trajectory planning has failed | '''PHO_PLANNING_FAILED := 201''' - Trajectory planning has failed | ||
Line 277: | Line 276: | ||
'''PHO_PART_LOST := 204''' - Part has been lost during motion execution | '''PHO_PART_LOST := 204''' - Part has been lost during motion execution | ||
− | '''PHO_COLLISION_DETECT := 205''' - Collision has been detected | + | '''PHO_COLLISION_DETECT := 205''' - Collision has been detected.Available only when using non-standard |
− | + | module CollisionDetect.mod | |
− | |||
+ | '''PHO_WRONG_BP_CONFIG := 255''' - Wrong Binpicking configuration. For more details see Binpicking Studio | ||
+ | console on Deployment Page | ||
=== 4.4 MAIN MODULE === | === 4.4 MAIN MODULE === | ||
Line 409: | Line 409: | ||
'''NOTE: This feature is currently unavailable.''' | '''NOTE: This feature is currently unavailable.''' | ||
− | This procedure is used when you need to perform calibration from robot controller. Please note that recommended way of calibration is using Binpicking studio calibration wizard. To execute the calibration comment out '''bin_picking''' task in procedure '''main()''' inside '''MainModule.mod''' and uncomment task '''calibration'''. Revert the changes after finishing calibration. | + | This procedure is used when you need to perform calibration from robot controller. Please note that recommended way of calibration is using Binpicking studio calibration wizard. |
+ | To execute the calibration comment out '''bin_picking''' task in procedure '''main()''' inside '''MainModule.mod''' and uncomment task '''calibration'''. Revert the changes after finishing calibration. | ||
Line 512: | Line 513: | ||
ENDPROC | ENDPROC | ||
+ | |||
+ | === 4.5 Placing === | ||
+ | |||
+ | For the purpose of orientated placing you can use information about picked object stored in following | ||
+ | variables: | ||
+ | |||
+ | '''pho_tool_point_invariance''' - Tool invariance ID. | ||
+ | '''pho_gripping_point_id ''' - Gripping point ID. | ||
+ | '''pho_gripping_point_invariance ''' - Gripping point invariance ID. | ||
+ | |||
+ | === 4.6 Vision System ID === | ||
+ | |||
+ | Some requests need an argument '''vision_system_id''' that defines selected vision system. Provided value | ||
+ | must be the same as the ID of wanted vision system in Binpicking Studio. Studio starts indexing the vision | ||
+ | systems from 1, but you can choose your preferred ID. | ||
+ | |||
+ | [[File: VS page 8ClVplw.png|frame|none|alt=Alt text| Figure 4.1]] | ||
+ | |||
+ | In the following example we demonstrate basic usage of the main requests when using multiple vision | ||
+ | systems. | ||
+ | |||
+ | ''NOTE: You can define different start/end pose for each vision system'' | ||
+ | |||
+ | |||
+ | !send bin picking initialization request to the Vision Controller (first vision system | ||
+ | pho_request_init start_bin_picking_jointtarget, end_bin_picking_jointtarget, 1; | ||
+ | ! | ||
+ | !send bin picking initialization request to the Vision Controller (second vision system | ||
+ | pho_request_init start_bin_picking_jointtarget, end_bin_picking_jointtarget, 2; | ||
+ | ! | ||
+ | !call scan request to start localization for first vision system | ||
+ | pho_request_scan 1; | ||
+ | ! | ||
+ | !wait for scan completition | ||
+ | pho_wait_for_scan_completion; | ||
+ | ! | ||
+ | !call trajectory request and move to start pose | ||
+ | pho_request_trajectory 1; | ||
+ | MoveAbsJ start_bin_picking_jointtarget, v1000, z200, tool0; | ||
+ | ! | ||
+ | !receive trajectory and execute picking procedure | ||
+ | pho_receive_trajectory; | ||
+ | pho_bin_picking; | ||
+ | ! | ||
+ | |||
+ | In next cycle you can call scan and trajectory requests for the second vision system or adapt program that | ||
+ | better suits your needs. | ||
== 5. Runtime == | == 5. Runtime == |
Latest revision as of 10:36, 7 May 2019
NOTE: Users are strongly recommended to read the general introduction to robot interfaces prior to installing specific robot modules.
Contents
1. Prerequisities
Photoneo ABB Interface is compatible with RobotWareOS versions 5.13 and higher.
In addition to compatible system version, the following conditions must also be met:
- (616-6) PC Interface Module available
- (672-1) Multitasking Module available
Go to System Info -> System Properties -> Control Module -> Options to check if these options are available within your system:
NOTE: Use of Robot Studio v.6.06 or higher is highly recommended for Photoneo ABB Interface setup.
2. ABB Controller setup
The following tutorial gives a step by step guide of how to configure your ABB IRC5 controller and install all necessary RAPID files you will need to get the robot interface for Photoneo Binpicking Studio up and running.
This tutorial was originally written using the latest RobotWare v.6.06, however it should be compatible with older versions with minor changes.
2.1 Network configuration
NOTE: The network configuration procedure described below only works with RobotWareOS v.6 or higher. If you have an older version of RobotWareOS and need to change an IP address, please contact local ABB support.
Turn on the IRC5 Controller, wait for the Initialization Screen to appear, open the Menu screen and select the Control Panel option:
In the Control Panel pane, select Controller Settings:
Select Settings and choose the Network option:
The Network Settings window should now appear. Use the Touch Panel Keypad to set the IP address of the IRC5 WAN port:
Choose OK button and restart the Controller to apply the new settings:
3 Robot Studio Setup
3.1 Connect to IRC5 Controller from Robot Studio
Set your local PC network settings to DHCP, plug an Ethernet cable into the Service Port of the IRC5 Controller and launch Robot Studio.
For a direct connection to the Robot Controller, select the Controller tab and select the One Click Connect option:
3.2 Transfer RAPID files
The first step in the installation of Photoneo ABB Interface is to copy the RAPID files from Photoneo ABB Module Archive which you received with Photoneo BP Studio to the Robot Controller.
You can copy the files directly from the USB stick using the Pendant, however the most convenient method to transfer the RAPID files is to use the Robot Studio File Transfer tool.
Go to the Controller tab and select the File Transfer tool from the menu:
The Photoneo ABB Interface consists of four RAPID files:
- MainModule.mod
- CustomerDefinitions.mod
- PhotoneoStateServer.mod
- PhotoneoCommon.sys
All of these files need to be transferred to the HOME:/Photoneo/ folder created within the Robot Controller file system as is shown in the figure below:
3.3 Create State Server Task
In order to ensure the full functionality of the State Server, open PhotoneoStateServer.mod and check that the robot_task_id and pho_state_server_port variables are valid with respect to your system configuration.
(For example, multi axes systems use T_ROB1 and T_ROB2 tasks; your network configuration might prevent using port 11005 etc). If you are not comfortable about making these changes to your system, please stick to the default values.
The next step in the setup is to create State Server Task. Select the Request Write Access option on the Controller tab in Robot Studio and the Grant Access option on the Pendant:
The State Server Task which runs in the background and will report the current state of the robot to the Vision Controller.
On the Left pane, select the Controller option, right click on the Task item in the list and select New Task...:
The following dialogue should appear. Change the settings to those shown in the figure below:
(String to Copy & Paste: Task: PHO_STATE_SERVER, Main Entry: pho_state_server_main)
3.4 Automatic Loading of Modules
Now we need to configure the ABB system to automatically load StateServer.mod during the boot.
Right Click on Automatic Loading of Modules and select New Automatic Loading of Modules as shown in the figure below:
Configure the module for PhotoneoState Server.mod as is shown in the figure below:
(String to Copy & Paste: File: HOME://Photoneo/PhotoneoStateServer.mod)
Repeat the same procedure for PhotoneoCommon.sys as a system module:
(String to Copy & Paste: File: HOME://Photoneo/PhotoneoCommon.sys)
Also repeat the same procedure for CustomerDefinitions.mod containing user settings:
(String to Copy & Paste: File: HOME://Photoneo/CustomerDefinitions.mod)
3.5 Load Main Module
We are now ready to manually load MainModule.mod to T_ROB1 task. You can load the MainModule.mod file from your PC or directly from the Controller.
Right Click on T_ROB1 task and select Load Module or Load Module From Controller:
Installation of the Photoneo ABB Interface is now complete. Your RAPID left panel should now look like this. Restart the Controller to apply all configuration changes:
At this point your Robot Controller is configured to work with Photoneo Binpicking Studio. However your RAPID code must be adopted to meet your application requirements - 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 as well as a detailed explanation of Photoneo RAPID API.
4. RAPID
Photoneo ABB interface was designed to be easily integrated into existing application written in RAPID code. It provides two means which influence the final robot behavior:
- RAPID API - set of RAPID requests (or procedures) used to control the bin picking sequence. Requests are defined in PhotoneoCommon module and used within MainModule
- RAPID CONFIG - CustomerDefinitions.mod holds an application specific settings such as gripper commands, motion speed, precision and overall bin picking sequence definition.
4.1 RAPID API
Module PhotoneoCommon.sys contains API calls (requests) provided by Photoneo ABB Interface. These requests are intended for high level control of bin picking sequences and are usually called in module MainModule.mod.
pho_request_init(jointtarget pho_start_bin_picking_pose, jointtarget pho_end_bin_picking_pose) - request to initialize binpicking application from the Vision Controller side. Start and End Poses defined by the operator from the RAPID side are transferred to the Vision Controller and used in the trajectory planning pipeline as start and terminus points.
pho_wait_for_server((string server_ip, \num port_number, \num wait_time, \switch sys_stop | switch sys_restart) - function to establish a connection to the Vision Controller. Blocking function; suspends the program until a proper connection is established. If the server running on the Vision Controller side is not running or does not respond, an error is raised and the RAPID program is terminated. We recommend ommiting optional parameter port_number (default value will be used). If you need to use specific port value please contact support@photoneo.com to help you with configuring port in Binpicking Studio.
pho_request_scan(num vision_system_id) - request to trigger the next scan and localization. Nonblocking request; the RAPID program continues immediately at the next line.
pho_wait_for_scan_completition(\num wait_time) - function to wait for scan to be finished. This should be called after triggering the scan, but not immediately.
pho_request_trajectory(num vision_system_id) - request to start trajectory planning for current goal. Non-blocking function; the RAPID program continues immediately at the next line.
pho_receive_trajectory(\num wait_time) - function to receive requested bin picking trajectories (consisting of a sequence of trajectory and gripper operations). This is usually called inside pho_bin_picking() function by default. Blocking function; waits for motion data to be received.
pho_request_calib_start (num vision_system_id) - request to start calibration. Currently unsupported. Prepared for future use.
pho_request_calib_add_point() - 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. Currently unsupported. Prepared for future use.
pho_request_calib_set() - request to set current calibration result to the PhoXi Scanner. Currently unsupported. Prepared for future use.
pho_request_calib_reset() - request to reset current calibration and remove all previously added points. Currently unsupported. Prepared for future use.
pho_other_req (num data{*}, num size, num vision_system_id) - request used to send additional data to Vision Controller.
pho_request_bin_locator (num vision_system_id) - request to start localization of the bin containing parts to be picked. Bin CAD model position is adjusted in environment. Currently unsupported. Prepared for future use.
pho_request_send_pick_failed (num vision_system_id) - notify Vision Controller about failed pick to lower preference of the part during object-to-pick selection process.
pho_request_change_solution (num solution_id) - request to change deployed solution. Currently unsupported. Prepared for future use.
4.2 RAPID CONFIG
CustomerDefinitions module enables the user to configure several bin picking settings, including gripper command implementations, trajectory speed and precision adjustments.
- gripper_attach() - implement function for attaching object to the gripper here
- gripper_detach() - implement function for detaching object from 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)
- binpicking_settings() - specify speed and precision settings for bin picking trajectories. Adopt the suitable number of trajectories to meet your bin picking setup. (the default setting is 4 trajectories)
- pho_bin_picking_simple() - a very basic bin picking sequence (for experimental purposes)
- pho_bin_picking() - executes standard bin picking sequence which consist of various number of operations to be performed. Blocking function; the program does not continue until the whole sequence has finished. Always make sure that the robot is in start_bin_picking_jointtarget before calling this function (DO NOT EDIT!)
4.3 RAPID ERROR HANDLING
Photoneo ABB interface provides basic error handling. If an error occurs during bin picking operations, the PHO_OCCURED_ERR flag is set to true. The PHO_ERR_CODE variable contains the code of the specific error which will helps to identify the source of the problem.
PHO_NO_ERR := 0 - Service response from Vision Controller is valid
PHO_SERVICE_ERR := 1 - Service response from Vision Controller is invalid.
PHO_UNKNOWN_REQ := 2 - The Vision Controller received an unknown request.
PHO_COM_FAILURE := 3 - Communication failure due to socket closure.
PHO_BAD_DATA := 4 - Data validation check has failed.
PHO_TIMEOUT := 5 - Communication failure due to socket timeout.
PHO_UNKNOWN_ERR := 99 - Unspecified internal error
PHO_PLANNING_FAILED := 201 - Trajectory planning has failed
PHO_NO_PART_FOUND := 202 - No part has been localized
PHO_NOT_INITIALIZED := 203 - Bin picking application has not been properly initialized on Vision Controller
PHO_PART_LOST := 204 - Part has been lost during motion execution
PHO_COLLISION_DETECT := 205 - Collision has been detected.Available only when using non-standard module CollisionDetect.mod
PHO_WRONG_BP_CONFIG := 255 - Wrong Binpicking configuration. For more details see Binpicking Studio console on Deployment Page
4.4 MAIN MODULE
The following section provides a detailed explanation of MainModule.mod - the module through which the user's application and Photoneo Bin Picking API are integrated together.
NOTE: If you use a pre-generated program from Robot Studio simulation do not use MainModule.mod directly. The following description serves only as an example of how to use Photoneo RAPID API.
4.4.1 main()
The main() procedure is simply a selection of which particular sub-procedure is about to be executed. Comment bin_picking if you want to execute calibration comment calibration line if you want to execute bin picking. (NOTE: Calibration is currently unavailable).
MODULE MainModule ! Copyright (c) 2018 Photoneo s.r.o. ! All rights reserved ! Description: Main bin picking module ! ! Home, start and end binpicking target variables VAR robtarget home_pose; VAR robtarget start_bin_picking_robtarget; VAR robtarget end_bin_picking_robtarget; VAR jointtarget start_bin_picking_jointtarget; VAR jointtarget end_bin_picking_jointtarget; ! Error handling variables VAR num err_counter; CONST num MAX_ERR_COUNT := 2; PROC main() !calibration; ! If bin picking is about to be executed comment this line bin_picking; ! If calibration is about to be executed comment this line ENDPROC
4.4.2 bin_picking()
This is a basic bin picking template. The main program loop is defined here. The user is can reteach bin picking start and end positions, set IP Address and Port of Vision Controller and adopt the placing part of the code to meet specific workcell and application requirements here.
! BIN PICKING ! This is a basic bin picking template. The main program loop is defined here. User is expected to reteach ! bin picking start and end positions, set IP Address and Port of Vision Controller and adopt placing part ! of the code to meet specific workcell and application requirements here. ! PROC bin_picking() ! Clear error counter for err_handling procedure err_counter := 0; PHO_ERR_CODE := PHO_PLANNING_FAILED; ! ! RETEACH home position for your application home_pose := [[99999.0, 99999.0, 99999.0],[0, 0, 0, 1],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]; ! ! RETEACH bin picking start and end pose start_bin_picking_robtarget := [[99999.0, 99999.0, 99999.0],[0, 0, 0, 1],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]; end_bin_picking_robtarget := [[99999.0, 99999.0, 99999.0],[0, 0, 0, 1],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]; ! ! Convert cartesian position to jointtarget start_bin_picking_jointtarget := CalcJointT(start_bin_picking_robtarget, tool0); end_bin_picking_jointtarget := CalcJointT(end_bin_picking_robtarget, tool0); ! ! Connect to the the Vision Controller, adopt Vision Controller IP address and port here if needed pho_wait_for_server "192.168.1.6", 11004 ; ! ! Send bin picking initialization request to the Vision Controller, ! start and end poses defined above will be used in trajectory planning pipeline pho_request_init start_bin_picking_jointtarget, end_bin_picking_jointtarget; ! ! Move robot away from scanning area - reteach this position for your robot and workcell MoveJ home_pose, v500, z30, tool0; ! ! When robot is away from scanning area, trigger first scan and localization pho_request_scan; ! WHILE true DO scan_again: !==================== PHOTONEO BIN PICKING START =========================== ! Wait until scanning is completed pho_wait_for_scan_completion; ! ! Handle errors if occured IF (PHO_OCCURRED_ERR = TRUE) THEN err_handling; GOTO scan_again; ENDIF ! ! Trigger trajectory planning pho_request_trajectory; ! ! While trajectory is being calculated, move robot to bin picking start position MoveAbsJ start_bin_picking_jointtarget, v1000, z200, tool0; ! ! Execute bin picking application, calculated trajectory is received here pho_bin_picking; !==================== PHOTONEO BIN PICKING END =========================== ! ! Handle errors if occured IF (PHO_OCCURRED_ERR = TRUE) THEN err_handling; GOTO scan_again; ELSE ! Clear error counter for err_handling procedure err_counter := 0; ! !==================== PLACING START================================== ! Move robot from bin picking end position away from scanning area - reteach this position for your robot and workcell ! MoveJ [[171.40,-618.92,669.19],[9.66315E-05,-0.862481,-0.50609,-2.74185E-05],[-1,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]], v500, z30, tool0; ! ! Triger next scan and localization, trajectory for next cycle is calculated while object is being placed pho_request_scan; ! ! Commands for actual part placing - reteach positions for your robot and workcell ! MoveJ [[171.40,-618.92,669.19],[9.66315E-05,-0.862481,-0.50609,-2.74185E-05],[-1,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]], v500, z30, tool0; ! open_gripper; ! MoveJ [[171.40,-618.92,669.19],[9.66315E-05,-0.862481,-0.50609,-2.74185E-05],[-1,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]], v500, z30, tool0; !==================== PLACING END=================================== ENDIF ENDWHILE ENDPROC
4.4.3 calibration()
NOTE: This feature is currently unavailable.
This procedure is used when you need to perform calibration from robot controller. Please note that recommended way of calibration is using Binpicking studio calibration wizard. To execute the calibration comment out bin_picking task in procedure main() inside MainModule.mod and uncomment task calibration. Revert the changes after finishing calibration.
Reteach calibration positions and call pho_request_calib_add_point() requests after reaching each calibration pose. Users are recommended to run calibration in MANUAL mode in order to have full control over the process. Always make sure that the robot does not collide with the workcell during transitions between specific waypoints.
! CALIBRATION ! Reteach calibration positions and call add calibration point request after reaching each calibration pose ! It it recomended to run calibration in MANUAL mode step by step to have a proper control over the process. ! Always make sure that robot does not collide with workcell during transitions between specific waypoints PROC calibration() ! Connect to the the Vision Controller, adopt Vision Controller IP address and port here if needed pho_wait_for_server "192.168.1.6", 11004; ! ! 1. calibration waypoint MoveJ [[726.48,-170.77,397.89],[0.100326,-0.586168,0.431152,-0.678565],[-1,0,-2,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]], v100, fine, tool0; pho_request_calib_add_point; ! ! 2. calibration waypoint MoveJ [[784.48,103.21,289.54],[0.015591,-0.569148,0.439403,-0.694804],[0,0,-2,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]], v100, fine, tool0; pho_request_calib_add_point; ! ! 3. calibration waypoint MoveJ [[612.57,314.22,592.92],[0.191405,-0.613209,0.508347,-0.573517],[0,0,-2,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]], v100, fine, tool0; pho_request_calib_add_point; ! ! 4. calibration waypoint MoveJ [[1007.35,-482.44,270.24],[0.566579,-0.514948,0.502784,0.40128],[-1,0,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]], v100, fine, tool0; pho_request_calib_add_point; ! ! 5. calibration waypoint MoveJ [[975.17,-513.44,199.63],[0.615751,-0.53949,0.418442,0.393329],[-1,0,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]], v100, fine, tool0; pho_request_calib_add_point; ! ! 6. calibration waypoint MoveJ [[813.58,-34.08,404.19],[0.317364,-0.830642,0.138416,-0.436068],[-1,1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]], v100, fine, tool0; pho_request_calib_add_point; ! ! Finally set calibration result to the PhoXi Scanner TPWrite "Setting calibration result to the PhoXi Scanner!"; pho_request_calib_set; TPWrite "Calibration complete!"; EXIT; ENDPROC
4.4.4 err_handling()
Several error situations might occur during bin picking procedures. Some problems are more serious, some less. For example, if no part is found or the trajectory planning fails, the program simply attempts to repeat the whole sequence. However, if a communication failure is detected, the program is halted immediately. PHO_ERR_CODE contains the error state from the last response from the Vision Controller.
! ERROR HANDLING ! Shit happens. Several error situations might occur during bin picking procedure. Some of them are more serious some are less. ! For example if no part is found or trajectory planning fails, program just tries to repeat the whole sequence. However if ! communication failure is detected, program is halted immediately. It is possible to adopt this behavior here if needed PROC err_handling() !--Release gripper if needed !open_gripper; ! Move robot to home pose MoveJ home_pose, v500, z30, tool0; !--Display error TPWrite pho_err_info(PHO_ERR_CODE); IF err_counter >= MAX_ERR_COUNT THEN ErrLog 4800, "Photoneo internal error", pho_err_info(PHO_ERR_CODE), "Please reboot the Vision controller and restart application"," ", " "; EXIT; ENDIF ! If planning failed or no part was found, notify user and continue by next scan (Adopt if needed) IF (PHO_ERR_CODE = PHO_PLANNING_FAILED OR PHO_ERR_CODE = PHO_NO_PART_FOUND) THEN TPWrite "NO PART FOUND OR PLANNING PATH FAILED"; pho_request_scan; ! If bin picking has not been initialized or service returned error response, reinitialize and trigger new scan (Adopt if needed) ELSEIF(PHO_ERR_CODE = PHO_NOT_INITIALIZED) THEN pho_request_init start_bin_picking_jointtarget, end_bin_picking_jointtarget; pho_request_scan; ! If bin picking service returned error response, reinitialize and trigger new scan (Adopt if needed) ELSEIF (PHO_ERR_CODE = PHO_SERVICE_ERR ) THEN Waittime 10; pho_request_init start_bin_picking_jointtarget, end_bin_picking_jointtarget; pho_request_scan; ! In case of communication failure, rapid program is terminated immediatelly ELSEIF (PHO_ERR_CODE = PHO_BAD_DATA OR PHO_ERR_CODE = PHO_TIMEOUT OR PHO_ERR_CODE = PHO_COM_FAILURE ) THEN ErrLog 4800, "Photoneo internal error", "Communication failure!", "Please reboot the Vision controller"," "," "; EXIT; ! Otherwise trigger next scan and try to continue ELSE pho_request_scan; ENDIF err_counter := err_counter + 1; ! reset error flag for next cycle PHO_OCCURRED_ERR := FALSE; ENDPROC
4.5 Placing
For the purpose of orientated placing you can use information about picked object stored in following variables:
pho_tool_point_invariance - Tool invariance ID. pho_gripping_point_id - Gripping point ID. pho_gripping_point_invariance - Gripping point invariance ID.
4.6 Vision System ID
Some requests need an argument vision_system_id that defines selected vision system. Provided value must be the same as the ID of wanted vision system in Binpicking Studio. Studio starts indexing the vision systems from 1, but you can choose your preferred ID.
In the following example we demonstrate basic usage of the main requests when using multiple vision systems.
NOTE: You can define different start/end pose for each vision system
!send bin picking initialization request to the Vision Controller (first vision system pho_request_init start_bin_picking_jointtarget, end_bin_picking_jointtarget, 1; ! !send bin picking initialization request to the Vision Controller (second vision system pho_request_init start_bin_picking_jointtarget, end_bin_picking_jointtarget, 2; ! !call scan request to start localization for first vision system pho_request_scan 1; ! !wait for scan completition pho_wait_for_scan_completion; ! !call trajectory request and move to start pose pho_request_trajectory 1; MoveAbsJ start_bin_picking_jointtarget, v1000, z200, tool0; ! !receive trajectory and execute picking procedure pho_receive_trajectory; pho_bin_picking; !
In next cycle you can call scan and trajectory requests for the second vision system or adapt program that better suits your needs.
5. Runtime
Apply RAPID changes, restart the Robot Controller; if everything is set correctly, you should see the following info screen on the Pendant:
Make sure that your solution on the Deployment page of Binpicking Studio is running and Binpicking Status is in Waiting for a connection state as shown in the figure below:
Open Main Menu, browse to Production Window and Set PP to Main - at the beginning of the main function:
Choose if you want to run the application in AUTO or MANUAL mode and adopt the speed override if required:
Hit the Play button in AUTO mode or Enable + Play button in MANUAL mode and you should see the following application output:
You should notice that Binpicking Status has changed to the Connected state. It means that the Vision Controller has established a successful connection to the robot controller:
The robot should now start sending requests to the Vision Controller and execute bin picking movements.
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.