Add Global Function
First, you need to fill out and add the global function to be used in the skill of the gripper before creating the skill.
You can create global functions that can be used in common in various WCI & Skills. Using Global Function helps you to avoid writing duplicated codes by functionalizing common functions. The function prepared can be imported from ‘Workcell Item Writer’ or ‘Skill Writer’.
You can add ‘Global function’ and ‘Global Variable’ from the ‘Function & Variable Writer’ menu. Please refer to the below items for the detail.
In this example, it explains how to prepare and add Global Function.
- CaloffsetPos() : It is a function to calculate a location that is a certain distance away from a random point.
- MoveFn() : It is an example code of a function to select and execute motion instructions. You can select among movel, movej, or movejx.
- AppRet_Motion_v2() : It is a function to perform motion moving between the approach pose and the retreat pose that is a certain distance away from the reference pose.
Create Global Function
- Select 'Function & Variable Writer' → 'Global Function’ in the upper bar menu.
You can create a new ‘Global Function’ or edit the existing ‘Global Function’.
- Click ‘Add New’ button to create a new 'Global function’.
- Check one item from the existing 'Global Function' list and click ‘Edit’ button to edit the existing ‘Global Function’.
Fill out and edit Global Function
Check how to prepare and edit and register the example codes below as Global Function.
- Enter the name and description of the ‘Global Function’ in ‘Function Name’ and ‘Description’, respectively.
- Enter the ‘Input parameter’ to be used in the function in ‘Parameter Name’.
Set the ‘Return Type’.
- Select ‘Dynamic’ if there is a return value.
- Select ‘None’ if there is no return value.
Set the ‘Visibility Type’.
- Select ‘Internal’ for the function to allow internal access only.
- Select ‘Public’ for the function to allow external access.
Enter the contents of the Global Function using DRL Codes(Python) in the text editor.'
- You need to use the Python function form in the text editor.
- Check if the ‘Function Name’ and ‘Parameter Name’ match on the screen and the text editor.
- The text editor can be extended and the Python grammar check is available.
You can fill out the code while referring to the DRL Command Guide by clicking the button.
Save the Global Function and click ‘Confirm’.
Check Global Function List
Once the Global Function is saved, you can check the list as below.