KUKA Standard Interface Commands

This section introduces the standard interface commands used in TCP communications between a KUKA robot and Mech-Mind Inline Measurement System. The robot (the client) sends commands to Mech-Mind Inline Measurement System (the server), and Mech-Mind Inline Measurement System returns the processed data to the robot.

Command Overview

Command name Required Description

Initialize the communication

Yes

This command sets the IP address of the IPC, port number, and timeout period for robot communication.

Switch Project

No

The robot informs Mech-Metrics to begin switching projects.

Start Measurement Task

Yes

The robot informs Mech-Metrics to start measuring the new part, and sends the part name, part SN, and other part information to Mech-Metrics.

Run Feature Measurement

Yes

This command triggers the Mech-MSR project that corresponds to the feature to be measured to run. If you need to perform multiple measurements, call this command multiple times.

Stop Measurement Task

Yes

The robot informs Mech-Metrics that the measurement ends and requests the measurement result of the part.

Input Part SN During Measurement

No

In some scenarios, the SN code of the part cannot be obtained at the beginning of measurement. For example, it needs to be scanned during measurement. This command is used to input the part SN during the measurement.

Query Part Historical Data

No

Input the SN of the part to switch the main interface of Mech-Metrics to the data view of the part.

Calibration

Yes (automatic calibration program)

Hand-eye calibration (extrinsic parameter calibration)

Notes

Please note the following before starting:

  • Notes on calling KUKA robot commands:

    • Parameters in the parameter list of a command must be separated by commas (,).

    • Each parameter of a command is defined as a local variable and takes effect only within the command.

    • The parameter list of commands supports input and output parameters.

    • For KUKA robots, commands other than Initialize Communication already contain logic for establishing and disconnecting the TCP communication, which will automatically establish and disconnect before and after execution.

  • Data units in commands:

    • The unit of joint positions is degree (°).

    • The robot flange pose or tool pose consists of position and orientation. The position (XYZ coordinates) is measured in millimeters (mm), and the orientation is represented by Euler angles in degrees (°).

Initialize Communication

This command establishes the TCP communication between the robot and the inline measurement system.

Command format

MM_Init_Socket(XML_Name,Alive_Flag,Recv_Flag,Time_Out)

Input parameters

XML_Name

This parameter specifies the name of the network configuration file in string format. The name is case-sensitive. Here, the network configuration file refers to XML_Kuka_MSR.xml. The file is loaded to the robot during communication setup. The file content is as follows.

<ETHERNETKRL>
  <CONFIGURATION>
    <EXTERNAL>
      <IP>192.168.174.1</IP>
      <PORT>4000</PORT>
    </EXTERNAL>
    <INTERNAL>
      <ALIVE Set_Flag="20"/>
      <BUFFERING Mode="FIFO" Limit="256"/>
      <BUFFSIZE Limit="65534"/>
      <TIMEOUT Connect="2000" Receive="5000"/>
      <MESSAGES Display="enable" Logging="warning"/>
    </INTERNAL>

  </CONFIGURATION>
  <RECEIVE>
    <RAW>
      <ELEMENT Tag="Buffer" Type="STREAM" Set_Flag="30" EOS="13,10|13|10"/>
    </RAW>
  </RECEIVE>
</ETHERNETKRL>

In this file, ensure that the value in the <IP> tag is the IP address of the IPC, and the value in the <PORT> tag is the host port number set in the Robot Communication Configuration (in the toolbar of Mech-MSR).

Alive_Flag

This parameter indicates the value of Set_Flag in the <ALIVE> tag in the XML_Kuka_MSR.xml file. In the above example, the value must be 20. When the signal corresponding to this parameter value is ON, it indicates that the inline measurement system and the robot have communicated successfully.

Recv_Flag

This parameter indicates the value of Set_Flag in the <RECEIVE> tag in the XML_Kuka_MSR.xml file. In the above example, the value must be 30. When the signal corresponding to this parameter value is ON, it indicates that the robot has received the data sent by the inline measurement system.

Time_Out

This parameter specifies the communication timeout period, in seconds.

Example

MM_Init_Socket("XML_Kuka_MSR",20,30,60)

In this example, the TCP communication is established between the inline measurement system and the robot using the configuration information in the XML_Kuka_MSR.xml file.

Switch Project

The robot informs Mech-Metrics to start switching projects.

Invocation Timing

Before switching the project.

Command Format

MSR_SW_PROJ(Robot_Id:IN,Job:IN,MSR_Status:OUT)

Input Parameters

Robot_Id

This parameter indicates the part ID. The part ID is an integer between 1 and 99. The specified part ID must have been configured in the Configure Part ID window. The data type is num.

Job

This parameter indicates the project ID. The specified project ID must have been configured through project switching rules. The data type is num.

Output Parameters

MSR_Status

This parameter stores the command status code.

8105: The command is executed successfully.

-99: Robot communication error.

Example

MSR_SW_PROJ(1,1,MSR_Status)

In this example, the system switches to the project with part ID 1 and project ID 1, and saves the command status code in MSR_Status.

Start Measurement Task

The robot informs Mech-Metrics to start measuring the new part, and sends the part name, part SN, and other part information to Mech-Metrics.

Invocation Timing

This command is sent when the measurement of a new part begins.

Command Format

MSR_Start_Measure(RobotID:IN,Piece_Name:IN,Piece_SN:IN,Qc_Mode:IN,Custom_int1:IN,Custom_int2:IN,Custom_int3:IN,Custom_int4:IN,Custom_int5:IN,Custom_int6:IN,Custom_int7:IN,Custom_int8:IN,MSR_Continuous_Mode:OUT,MSR_Status:OUT)

Input Parameters

RobotID

This parameter indicates the part ID. The part ID is an integer between 1 and 99. The specified part ID must have been configured in the Configure Part ID window. The data type is num.

Piece_Name

This parameter indicates the name of the part to be measured. The part name can contain letters and digits and cannot exceed 20 characters in length. The data type is string.

Piece_SN

This parameter indicates the part SN. The part SN, also known as the part serial number, is the unique identifier of the part. The part SN can contain letters and digits and cannot exceed 30 characters in length. The data type is string.

Qc_Mode

This parameter indicates the quality inspection mode of the part. The data type is num. The meaning of each parameter value is as follows:

  • 1: Full inspection.

  • 2: Partial inspection.

  • Others: Use existing settings.

Custom_int1-Custom_int8

This parameter is optional and provides custom information about the part. The data type is num. Custom parameters are used only when more part information needs to be provided to Mech-Metrics. This command supports up to 8 custom parameters. The value of each custom parameter is an integer between 1 and 8.

To use a custom parameter:

  1. In the ribbon at the top of the Mech-Metrics configuration interface, select Communication  Configure Communication Command to configure the meanings of the values (1 to 8) for the specified custom parameter (such as custom parameter 1).

  2. Set the specified custom parameter in the command.

Output Parameters

MSR_Continuous_Mode

This parameter indicates whether the current run is continuous execution or single execution. The data type is num.

0: Single execution.

1: Continuous execution.

If single execution is specified, the robot runs the following commands in sequence: Start Measurement TaskRun Feature MeasurementStop Measurement Task. To measure multiple features, please run the feature measurement command multiple times. For example, if you want to measure two features, the robot runs the following commands in sequence: program starts→Start Measurement TaskRun Feature MeasurementRun Feature MeasurementStop Measurement Task→program stops.

If continuous execution is specified, after the robot executes one round of commands, it returns to Start Measurement Task and repeats. If Start Measurement Task in a round returns single execution, the robot program stops after that round is completed.

  • By default, Mech-Metrics returns 0 to the robot, indicating that the current execution is single execution.

  • In semi-dynamic repeatability testing, Mech-Metrics returns 1 to the robot, indicating that the current execution is continuous execution. Since manual movement of the robot or clamping of the part is not required during semi-dynamic repeatability testing, the robot can continuously execute multiple rounds of commands.

MSR_Status

This parameter stores the command status code.

8100: The command is executed successfully.

-99: Robot communication error.

Example

MSR_Start_Measure(1,"zcl","ABC",2,10,20,30,40,50,60,70,80,MSR_Continuous_Mode,MSR_Status)

In this example, the system starts measuring the part with part ID 1, part name zcl, and part SN ABC, and specifies 8 custom parameters.

Run Feature Measurement

This command triggers the execution of the corresponding Mech-MSR project for the measurement feature.

Invocation Timing

The robot reaches the feature’s image-taking position.

Command Format

MSR_Measure_Feature("RobotID:IN","Index_Num:IN","MSR_Status:OUT")

Input Parameters

RobotID

This parameter indicates the part ID. The part ID is an integer between 1 and 99. The specified part ID must have been configured in the Configure Part ID window. The data type is num.

Index_Num

This parameter specifies the ID of the feature to be measured. The data type is num. The ID uniquely identifies the feature. The feature ID is an integer between 1 to 999.

Output Parameters

MSR_Status

This parameter stores the command status code.

8101: The command is executed successfully.

-99: Robot communication error.

Example

MSR_Measure_Feature(1,1,MSR_Status)

In this example, the robot triggers the Mech-MSR project to run, with part ID 1 and feature ID 1. The status code is stored in MSR_Status.

Stop Measurement Task

The robot informs Mech-Metrics that the measurement ends and requests the measurement result of the part.

Invocation Timing

This command is sent after the last measurement feature has been photographed and the part measurement is complete.

Command Format

MSR_End_Measure(Robot_ID:IN,Judge:OUT,Failed_Count[]:OUT,MSR_Status:OUT)

Input Parameters

Robot_ID

This parameter indicates the part ID. The part ID is an integer between 1 and 99. The specified part ID must have been configured in the Configure Part ID window. The data type is num.

Output Parameters

Judge

This parameter indicates the result of the part. 1 stands for OK, and 0 for NG. The data type is num.

Failed_Count[]

This parameter indicates the ID of the numeric register for storing the number of measurement items of the part. The data type is num. The details are as follows:

  • Failed_Count[1] Stores the number of measurement items that exceed tolerance 1.

  • Failed_Count[2] Stores the number of measurement items that exceed tolerance 2.

  • Failed_Count[3] Stores the number of measurement items that exceed tolerance 3.

MSR_Status

This parameter stores the command status code.

8102: The command is executed successfully.

-99: Robot communication error.

Example

MSR_End_Measure(1,MSR_Judge,Failed_Count[],MSR_Status)

In this example, the robot informs Mech-Metrics to end the measurement (with part ID 1). The judgment result of the part is stored in MSR_Judge, the number of measurement items is stored in Failed_Count[], and the command status code is stored in MSR_Status.

Input Part SN During Measurement

In some scenarios, the part SN cannot be obtained at the beginning of measurement. For example, it needs to be scanned during measurement. This command is used to input the part SN during the measurement.

Invocation Timing

The command can be sent at any point during the current part measurement process.

Command Format

MSR_Set_Piece_Info(Robot_Id:IN,Piece_Sn:IN,MSR_Status:OUT)

Input Parameters

Robot_Id

This parameter indicates the part ID. The part ID is an integer between 1 and 99. The specified part ID must have been configured in the Configure Part ID window. The data type is num.

Piece_Sn

This parameter indicates the part SN. The part SN, also known as the part serial number, is the unique identifier of the part. The part SN can contain letters and digits and cannot exceed 30 characters in length. The data type is string.

Output Parameters

MSR_Status

This parameter stores the command status code.

8103: The command is executed successfully.

-99: Robot communication error.

Example

MSR_Set_Piece_Info(1,"ert",MSR_Status)

In this example, the robot sends the part with SN ert to Mech-Metrics (with part ID 1).

Query Part Historical Data

This command accepts part SN and switches the main interface of Mech-Metrics to the data view of the corresponding part.

Invocation Timing

The command can be sent at any point when no measurement is in progress.

Command Format

MSR_View_Piece_Data(Robot_Id,Piece_Sn:IN,MSR_Status:OUT)

Input Parameters

Robot_Id

This parameter indicates the part ID. The part ID is an integer between 1 and 99. The data type is num.

Piece_Sn

This parameter indicates the part SN. The part SN, also known as the part serial number, is the unique identifier of the part. The part SN can contain letters and digits and cannot exceed 30 characters in length. The data type is string.

Output Parameters

MSR_Status

This parameter stores the command status code.

8104: The command is executed successfully.

-99: Robot communication error.

Example

MSR_View_Piece_Data(1,"ert",MSR_Status)

In this example, the robot sends the part SN to Mech-Metrics (with part ID 1), switches the main interface to the corresponding part view, and stores the command status code in MSR_Status.

Calibration

This command is used for hand-eye calibration (extrinsic calibration). This command needs to be used in conjunction with the 3D Camera Calibration tool in the Camera menu bar of Mech-MSR.

Calling Sequence

This command is called for hand-eye calibration before the actual measurement.

Command Format

MM_Calib(Move_Type,PosJps,WaitTime,E1)

Input Parameters

{Move_Type}

This parameter specifies the motion type of the robot. Valid values: 1 and 2.

  • 1: Linear motion (MOVEL).

  • 2: Joint motion (MOVEJ).

{Pos_Jps}

This parameter specifies the type of calibration point poses to be obtained. Valid values: 1 and 2.

  • 1: Tool pose.

  • 2: Joint angles.

{Wait_time}

This parameter specifies the waiting time after the robot moves to the calibration point (to prevent robot vibration). The unit is seconds, and the default value is 2 seconds. The data type is num.

{Ext}

This parameter specifies the external axis data, in millimeters. If a 7th axis exists and is controlled by the robot on site, this parameter must be set to the specific external axis data. Otherwise, this parameter must be set to 0.

Output Parameters

TOP_Status

This parameter stores the command status code.

Example

MM_Calib(2,1,2,0)

In this example, the pose of the calibration point is specified as a tool pose. The robot moves to the calibration point in joint motion mode and then waits for 2 seconds.

Is this page helpful?

You can give a feedback in any of the following ways:

We Value Your Privacy

We use cookies to provide you with the best possible experience on our website. By continuing to use the site, you acknowledge that you agree to the use of cookies. If you decline, a single cookie will be used to ensure you're not tracked or remembered when you visit this website.