Build subprograms with outputs¶
What you will learn
- Create a program which returns output parameters.
- Use the program as a subprogram in another program.
- Use the output parameters of the subprogram as input parameters of a function block.
This tutorial will explain how to build a program producing a position as output which will be used in other program as subprogram.
Create the subprogram¶
- Create program which consists of one
Get Flange Pose
function block. - Select on the function block.
- Press the Link all values button next to Pose.
- Create a new output parameter under Parent Program Outputs by entering a name and pressing the Add-button.
- Link the pose to the output parameter by clicking the tick .
- Save the program.
Use the subprogram¶
- Create a program which consists of the previous program as a subprogram followed by a
Move Cartesian
function block. - Select
Move Cartesian
function block.
on the - Switch to the Parameter Editor by clicking on the top right.
- Click the three dots next to Pose Reference to expand the options.
- Now press the Link all values button next to Pose Reference.
- Select the pose output of the subprogram under Outputs of other function blocks by clicking the tick .
- Now enter appropriate values for Speed and Acceleration and values for the Goal Pose.
e.g. Position = [0, 0, -0.1] and Orientation = [0, 0, 0] moves the robot up by 100 mm. - Running the program now moves a robot relative to the flange pose of the robot.