KUKA Standard Interface Commands
The KUKA Standard Interface provides the following subprograms:
-
Multiple parameters should be separated by commas.
-
Variable-type parameters should use local variables, which take effect only in the program.
-
Parameters can be defined as IN parameters or OUT parameters.
The KUKA Standard Interface provides the following subprograms.
Initialize Communication
This subprogram sets the name of the XML file used for setting up the TCP/IP communication, flag for successful communication, flag for successful data reception, and wait time before the program stops trying to establish the communication.
Parameters
Name | Description |
---|---|
IN parameters |
|
XML_Name[] |
Name of the XML file, case-sensitive. |
Alive_Flag |
ALIVE flag number in the XML file. When the flag is set to ON, the communication is successfully established. |
Recv_Flag |
RECEIVE flag number in the XML file. When the flag is set to ON, the robot has successfully received data. |
Time_Out |
Wait time in seconds before stopping connection attempt. |
Start Mech-Vision Project
This subprogram is for applications that use Mech-Vision. It runs the corresponding project to acquire and process data. It applies for applications that use Mech-Vision but not Mech-Viz.
Parameters
Name | Description |
---|---|
IN parameters |
|
Job |
Mech-Vision Project ID, which can be checked and adjusted in the Project List panel of Mech-Vision. |
Pos_Num_Need |
The expected number of vision points for Mech-Vision to send. The vision point contains the vision pose, corresponding point cloud, label, scaling, etc. Value range: 0–20, in which 0 indicates that all vision points will be received. |
SendPos_Type |
The type of the robot pose to send to Mech-Vision, from 0 to 3.
|
MM_J |
E6AXIS variable for storing the joint positions of the start point when SendPose_Type = 3. |
Get Vision Target(s)
This subprogram is for applications that use Mech-Vision but not Mech-Viz. It obtains the vision result from the corresponding Mech-Vision project.
Parameters
Name | Description |
---|---|
IN parameters |
|
Job |
Mech-Vision Project ID, which can be checked and adjusted in the Project List panel of Mech-Vision. |
OUT parameters |
|
Last_Data |
Variable, indicating whether all vision points have been sent, 0 or 1. 0: NOT all vision points have been sent (more on the way). 1: All vision points have been sent. |
Pos_Num |
Variable for storing the number of received vision points. |
MM_Status |
Variable for storing the status code. Please see Status Codes and Troubleshooting for detailed information. |
Start Mech-Viz Project
This subprogram is for applications that use both Mech-Vision and Mech-Viz. It starts the Mech-Viz project that triggers the corresponding Mech-Vision project, and therefore the Mech-Viz project can plan the robot path based on the vision points received from Mech-Vision.
Parameters
Name | Description |
---|---|
IN parameters |
|
SendPos_Type |
Robot pose type. Value range: 0–2.
|
MM_J |
E6AXIS variable for storing the joint positions of the start point when SendPose_Type = 2. |
Get Planned Path
This subprogram obtains the planned path from Mech-Viz.
Parameters
Name | Description |
---|---|
IN parameters |
|
Jps_Pos |
Whether Mech-Viz should send waypoint poses as joint positions or TCPs, 1 or 2.
|
OUT parameters |
|
Last_Data |
Variable, indicating whether all vision points have been sent, 0 or 1. 0: NOT all vision points have been sent (more on the way). 1: All vision points have been sent. |
Pos_Num |
Variable for storing the number of received vision points. |
VisPos_Num |
Variable for storing the position of the first Vision Move waypoint in the path. For example, in the workflow “Fixed-Point Move 1, Fixed-Point Move 2, Vision Move 1, Fixed-Point Move 3”, the position of the first Vision Move waypoint is 3. If the path does not contain Vision Move waypoint, the returned value is 0. |
MM_Status |
Variable for storing the status code. Please see Status Codes and Troubleshooting for detailed information. |
Example
MM_Get_VizData(2,Last,Pose_Num,VisPos_Num,Status)
This example obtains the planned path from Mech-Viz in the form of TCPs. Whether all waypoints have been sent is stored in Last. The number of waypoints received is stored in Pose_Num. The position of the Vision Move waypoint is stored in VisPose_Num. The status code is stored in Status.
Obtain Pose
This subprogram stores a vision pose returned by Mech-Vision or a waypoint pose (as a TCP) returned by Mech-Viz in the specified variable.
Parameters
Name | Description |
---|---|
IN parameters |
|
Serial |
Specify the index of the pose to be stored. |
OUT parameters |
|
MM_P |
Variable for storing the specified pose. |
MM_Label |
Variable for storing the label corresponding to the specified pose. |
MM_Speed |
Variable for storing the velocity corresponding to the specified pose. |
Obtain Joint Positions (Available when Mech-Viz is used)
This subprogram stores a vision pose returned by Mech-Vision or the JPs of a waypoint returned by Mech-Viz in the specified position variable.
Parameters
Name | Description |
---|---|
IN parameters |
|
Serial |
Specify the index of the pose to be stored. |
OUT parameters |
|
MM_J |
Variable for storing the specified set of joint positions. |
MM_Label |
Variable for storing the label corresponding to the specified set of joint positions. |
MM_Speed |
Variable for storing the velocity corresponding to the specified set of joint positions. |
Switch Mech-Vision Recipe
This subprogram specifies which parameter recipe of the Mech-Vision project to use. Parameter recipes can be used to switch parameter settings, including point cloud model for matching, ROI, confidence threshold, etc, in the same Mech-Vision project when it is used to recognize different workpieces. This subprogram must be called BEFORE MM_Start_Vis.
Select Mech-Viz Branch
This subprogram is used to select along which branch the Mech-Viz project should proceed. Such branching is achieved by adding Branch by Msg Step(s) to the Mech-Viz project. This subprogram specifies which exit port such Step(s) should take. MM_START_VIZ must be called BEFORE this subprogram. Mech-Viz will wait for the Branch Exit Port sent by Command 203.
Parameters
Name | Description |
---|---|
IN parameters |
|
Branch_Num |
Step ID of the “Branch by Msg” Step, which is an integer. The Step ID can be viewed in the Step Parameters panel. |
Export_Num |
The number of the exit port to take plus 1. For example, to select exit port 0 in Mech-Viz, set the value of this parameter to 1. Value range: 1-99. |
Set Move Index
This subprogram sets the index value for move-type Steps that contain index parameters. These Steps include Move by List, Move by Grid, Custom Pallet Pattern, and Predefined Pallet Pattern. MM_Start_Viz must be called BEFORE this subprogram.
Parameters
Name | Description |
---|---|
IN parameters |
|
Skill_Num |
Step ID of the Step, which is an integer. The Step ID can be viewed in the Step Parameters panel. |
Index_Num |
The index value that should be set the next time this Step is executed. When this subprogram is sent, the current index value in Mech-Viz will become the parameter value minus 1. When the Mech-Viz project runs to the Step specified by this subprogram, the Current Index value in Mech-Viz will be increased by 1 to become the parameter’s value. |
Get Software Status
This subprogram is used to obtain the software execution status of Mech-Vision, Mech-Viz, and Communication Component. Currently, this subprogram can only be used to check whether Mech-Vision is ready to run.
Parameters
Name | Description |
---|---|
OUT parameters |
|
MM_Status |
Variable for storing the status code. Please see Status Codes and Troubleshooting for detailed information. |
Input Object Dimensions to Mech-Vision
This subprogram is used to dynamically input object dimensions into the Mech-Vision project. This subprogram must be called BEFORE MM_Start_Vis.
Get/Set DO Signal List
This subprogram obtains the planned DO Signal list for controlling multiple sections of a sectioned vacuum gripper in Mech-Viz. MM_Get_VizData must be called BEFORE this subprogram.
Please configure the Mech-Viz project based on the template project in XXXX/Communication Component-xxx/tool/viz_project/suction_zone
, and set the suction cup configuration file in the project.
Input TCP to Mech-Viz
This subprogram inputs TCP data to the *External Move* Step in {product-viz}. Please use this subprogram based on the template project in `XXXX/{product-center}-xxx/tool/viz_project/outer_move`, and place the *External Move* Step at a proper position in the workflow. This subprogram must be called BEFORE MM_Start_Viz.
Calibration
This subprogram is used for hand-eye calibration (camera extrinsic parameter calibration). It automates the calibration process in conjunction with the Camera Calibration function in Mech-Vision.
Parameters
Name | Description |
---|---|
IN parameters |
|
Move_Type |
The move type of the robot, 1 or 2. 1: MoveL. 2: MoveJ. |
PosJps |
Pose as flange pose or joint positions, 1 or 2. 1: Flange pose. 2: Joint positions. |
WaitTime |
The time the robot waits to avoid shaking after it moves to the calibration point; the default value is 2 (s). |
E1 |
Data of the external 7th axis in mm. |
Get Custom Output Data from Mech-Vision
This subprogram is used to obtain the vision result that includes custom port outputs from the corresponding Mech-Vision project. “Custom port outputs” refers to data output by ports other than poses and labels of the “Procedure Out” Step. The output ports can be customized if the Port Type parameter of the Step is set to “Custom”.
Save Vision Point to Specified Variables
This subprogram stores the data in a vision point returned by Mech-Vision in the specified variables. This subprogram should be called AFTER Mech-Vision MM_Get_Dy_Data.
Parameters
Name | Description |
---|---|
IN parameters |
|
Serial |
Specify the index of the vision point to be stored. |
OUT parameters |
|
MM_P |
Variable for storing the pose in the specified vision point. |
MM_Label |
REAL-typed variable for storing the label in the specified vision point. |
MM_UserData |
Predefined global variable for storing the custom port outputs in the specified vision point. The maximum length is 50. |
Get Waypoint from Mech-Viz
This subprogram is used to obtain the planned path from Mech-Viz. The waypoint may be for a Vision Move Step, or for one of the other move-type Steps. A waypoint may contain pose, velocity, gripper info, workobject info, etc.
Waypoints in a planned path can be divided into the following three types.
-
All waypoints contain the following data: motion type (joint motion or linear motion), tool number and velocity.
-
Vision move waypoints, including label, number of workobjects that have been picked, number of workobjects picked this time, edge/corner ID of the suction cup, the TCP offset, workobject pose, and dimensions of the work objects combined.
-
Vision move waypoints including custom data, where the port type of the “Procedure Out” Step of the Mech-Vision project should be “custom”.
Parameters
Name | Description |
---|---|
IN parameters |
|
Jps_Pos |
Expected format of the returned data, see the following table for explanations. |
OUT parameters |
|
Pos_Num |
Variable for storing the number of received waypoints. |
VisPos_Num |
Variable for storing the position of the first Vision Move waypoint in the path. |
MM_Status |
Variable for storing the status code. |
The relationship between the value of Jps_Pos and the format of the returned data is summarized below.
Jps_Pos value | Format of returned data (Explained below) |
---|---|
1 |
Pose (joint positions), motion type, tool number, velocity, number of custom ports, custom port output, custom port output, … custom port output |
2 |
Pose (TCP), motion type, tool number, velocity, number of custom ports, custom port output, custom port output, … custom port output |
3 |
Pose (joint positions), motion type, tool number, velocity, depalletizing planning data, number of custom ports, custom port output, custom port output, … custom port output |
4 |
Pose (TCP), motion type, tool number, velocity, depalletizing planning data, number of custom ports, custom port output, custom port output, … custom port output |
Pose
The pose of the waypoint, as joint positions (in degree) or TCP, which is composed of Cartesian coordinates (XYZ in mm) and Euler angles (ABC in degree).
Motion type
-
1
: joint motion, MOVEJ -
2
: linear motion, MOVEL
Tool number
The index number of the tool to be used at this waypoint. -1 means no tool is used.
Velocity
Velocity percentage of the waypoint, equals to the velocity setting in the corresponding move-type Step multiplied by the global velocity setting in Mech-Viz, in the format of percentage.
Depalletizing planning data Data used in planning multi-pick depalletizing tasks. These data are part of the waypoint of the “Vision Move” Step. The following data are included:
-
Label: Composed of 10 integers. If fewer than 10 labels are obtained, the rest of the digits are filled with 0.
-
Number of picked workobjects.
-
Number of workobjects to be picked this time.
-
Edge-corner ID of vacuum gripper: Specify the gripper corner to which the workobject is aligned. Can be checked by double-clicking the corresponding tool in the Resources panel in Mech-Viz and then selecting Configure control logic.
-
TCP offset: The offset between the tool pose at the center of the to-pick workobject and the actual tool pose.
-
Work object orientation: Whether the X-axis of the workobject reference frame is aligned with the X-axis of the tool reference frame (value: 0 or 1).
-
Dimensions of the workobject combined.
Number of custom ports
The number of output keys excluding poses and labels when the Port Type parameter of the “Procedure Out” Step in the Mech-Vision project is set to “Custom”.
Custom port outputs
The outputs excluding poses and labels when the Port Type parameter of the “Procedure Out” Step in the Mech-Vision project is set to “Custom”. The custom port outputs are arranged in alphabetical order of the custom port names.
Example
MM_GET_PLANDATA(2,Pose_Num,VisPos_Num,Status)
This example obtains the planned path that includes custom port outputs from Mech-Viz, and the value of Jps_Pos is 2. The number of waypoints received is stored in Pose_Num. The position of the Vision Move waypoint is stored in VisPose_Num. The status code is stored in Status.
Save Waypoint to Specified Variables
These subprograms are called after getting waypoint from Mech-Viz. These subprograms store the data in a waypoint returned by Mech-Viz in the specified variables.
Subprogram
MM_Get_PlanPose(Serial:IN,Jps_Pos:IN,MM_P:OUT,MM_MoveType:OUT,MM_ToolNum:OUT,MM_Speed:OUT) (when the value of Jps_Pos is 2 or 4)
MM_Get_PlanJps(Serial:IN,Jps_Pos:IN,MM_J:OUT,MM_MoveType:OUT,MM_ToolNum:OUT,MM_Speed:OUT) (when the value of Jps_Pos is 1 or 3)
Parameters
Name | Description |
---|---|
IN parameters |
|
Serial |
Specify the index of the waypoint to be stored. |
Jps_Pos |
Expected format of the returned data. Must be the same value as in MM_GET_PLNDT |
OUT parameters |
|
MM_P |
Variable for storing the TCP in the specified waypoint. |
MM_J |
Variable for storing the joint positions in the specified waypoint. |
MM_MoveType |
Variable for storing the motion type in the specified waypoint. 1: joint motion. 2: linear motion. |
MM_ToolNum |
Variable for storing the tool number in the specified waypoint. -1 indicates no tool is used. |
MM_Speed |
Variable for storing the velocity in the specified waypoint. |
MM_UserData |
Predefined global variable for storing the custom port outputs in the specified waypoint. The current length is 50. |
MM_Plan_Results |
Predefined global variable for storing the depalletizing planning data in the specified waypoint. The current length is 20. |
Example
-
Example 1
MM_Get_PlanPose(1,4,XP1,MoveType,ToolNum,Pose_Speed)
This example stores the TCP in the first received waypoint to XP1, the corresponding motion type to MoveType, the corresponding tool number to ToolNum, the corresponding velocity to Pose_Speed, the corresponding custom port outputs to MM_UserData, and the corresponding depalletizing planning data to MM_Plan_Results.
-
Example 2
MM_Get_PlanJps(1,3,JP1,MoveType,ToolNum,Pose_Speed)
This example stores the joint position in the first received waypoint to P1, the corresponding motion type to MoveType, the corresponding tool number to ToolNum, the corresponding velocity to Pose_Speed, the corresponding custom port outputs to MM_UserData, and the corresponding depalletizing planning data to MM_Plan_Results.
Get Result of Step “Path Planning” in Mech-Vision
This subprogram obtains the collision-free path planned by the “Path Planning” Step from the corresponding Mech-Vision project.
The Port Type parameter of the “Procedure Out” Step in the Mech-Vision project must be set to “Predefined (robot path)”.
Parameters
Name | Description |
---|---|
IN parameters |
|
Job |
Mech-Vision Project ID, which can be checked and adjusted in the Project List panel of Mech-Vision. |
Jps_Pos |
Specify the type of waypoint pose returned by the “Path Planning” Step.
|
OUT parameters |
|
Last_Data |
Variable, indicating whether all waypoints have been sent, 0 or 1.
|
Pos_Num |
Variable for storing the number of received waypoints. |
VisPos_Num |
Variable for storing the position of the first Vision Move waypoint in the path. For example, if the path is composed of Steps Fixed-Point Move_1, Fixed-Point Move_2, Vision Move and Fixed-Point Move_3 sequentially, the position of Vision Move is 3. If the path does not contain “Vision Move”, the value of this parameter is 0. |
MM_Status |
Variable for storing the status code. |
Example
MM_GET_VISPATH(1,1,Last,Pose_Num,VisPos_Num,Status)
This example obtains the planned path from Mech-Vision project No.1 in the form of joint positions. Whether all waypoints have been sent is stored in Last. The number of waypoints received is stored in Pose_Num. The position of the Vision Move waypoint is stored in VisPose_Num. The status code is stored in Status.