Standard Interface Commands

This section describes standard interface commands used in TCP communications between a ABB 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.

Establish TCP Communication

Yes

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

Close TCP Communication

Yes

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

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 ID, and other part information to Mech-Metrics.

Run Feature Measurement

Yes

This command triggers the Mech-MSR project that corresponds to the to-be-measured feature 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.

Import Part ID 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 ID during the measurement.

Query Part Historical Data

No

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

Calibration

Yes (automatic calibration program)

Hand-eye calibration (extrinsic parameter calibration)

Notes

Before you call the commands, take note of the following items:

  • When programming a ABB robot, take note of the following items:

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

    • Variable-type parameters of a command should use local variables and take effect only in the command.

    • Input and output parameters can be customized in commands.

    • Two individual commands are developed to establish (Establish TCP Communication) and close (Close TCP Communication) the communication, preventing frequent disconnections and reconnections between the robot and the vision system.

  • Unit of data:

    • 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 the Communication

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

Timing of calling

After using this command, you need to call Establish TCP Communication to establish TCP communication between the robot and the inline measurement system. Initialization only needs to be performed once.

Command format

MSR_Init_Socket(string IP_Address,num Server_Port,num Time_Out)

Input parameters

IP_Address

This parameter specifies the IP address of the IPC. The data type is string.

Server_Port

This parameter indicates the port number used by the IPC to establish the communication between the IPC and the robot. This parameter value must be consistent with the host port number set in the TCP ASCII service communication configuration (Standard Interface communication mode) of the Mech-MSR. The data type is num.

Time_Out

This parameter specifies the communication timeout period. Unit: seconds. The data type is num.

Example

MSR_Init_Socket "192.168.1.20", 50000, 300;

In the preceding example, the IP address of the IPC that you want to connect to the robot is 192.168.1.20, the port number is 50000, and the timeout period is 300 seconds.

Establish TCP Communication

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

Timing of calling

This command must be called immediately after initializing communication.

Command Format

MSR_Open_Socket(num MSR_Status)

Output Parameters

MSR_Status

This parameter stores the command status code.

-99: Abnormal Communication with the Robot.

Close TCP Communication

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

Calling sequence

After you receive the result of the Mech-MSR project, you can call this command to disconnect the communication, and then store the result in the specified variables. If the communication is not closed for a long time, an error that indicates that communication was abnormally closed may be returned for robot programs.

Command format

MSR_Close_Socket

Switch Project

The robot tells the Mech-Metrics to start switching projects.

Timing of calling

Before switching the project.

Command Format

MSR_SW_PROJ(num Robot_Id,num Job,INOUT num MSR_Status)

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: Abnormal Communication with the Robot.

Example

MSR_SW_PROJ 1,1,MSR_Status;

The above example indicates that 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 ID, and other part information to Mech-Metrics.

Timing of calling

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

Command format

MSR_Start_Measure(num RobotId,string PieceName,string PieceSn,num QcMode,num CustomValue1,num CustomValue2,num CustomValue3,num CustomValue4,num CustomValue5,num CustomValue6,num CustomValue7,num CustomValue8,INOUT num ContinuousMode,INOUT num MSR_Status)

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.

PieceName

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.

PieceSn

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 meanings of each parameter value are as follows:

  • 1: Full inspection.

  • 2: Partial inspection.

  • Others: Use existing settings.

CustomValue1-CustomValue8

This parameter is optional. This parameter provides custom information of 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 upper-part ribbon of Mech-Metrics, select Communication  Configure Communication Command to configure the meaning for values (1 to 8) of the custom parameter (such as custom parameter 1).

  2. Add the custom parameter to the command.

Output parameters

ContinuousMode

This parameter indicates whether the execution is loop execution or one-time execution. The data type is num.

0: One-time execution.

1: Loop execution.

If one-time 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 loop-execution is specified, the robot executes multiple command sets. The command set starts from Start Measurement Task. If one-time execution is returned by a Start Measurement Task command in a command set, the robot program stops after the command set is executed.

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

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

MSR_Status

This parameter stores the command status code.

8100: The command is executed successfully.

-99: Abnormal Communication with the Robot.

Example

MSR_Start_Measure 1,"Piece01","ABC",2,1,2,3,4,5,6,7,8,outvalue,MSR_Status;

In the preceding example, the robot with an ID of 1 starts to measure the part named Piece01 and the part SN is ABC, sets the detection mode to partial inspection (2), specifies 8 custom parameters (1, 2, 3, 4, 5, 6, 7, 8), and then stores the output value at the outvalue position. The command status code is stored in MSR_Status.

Run Feature Measurement

This command triggers the Mech-MSR project that corresponds to the to-be-measured feature to run.

Timing of calling

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

Command format

MSR_Measure_Feature(num RobotId,num Measure_Index,INOUT num MSR_Status)

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.

Measure_Index

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: Abnormal Communication with the Robot.

Example

MSR_Measure_Feature 1,1,MSR_Status;

In this example, the robot side triggers the Mech-MSR project whose part ID is 1 and whose measurement feature is 1 to run, and stores the status code in MSR_Status.

Stop Measurement Task

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

Timing of calling

The last feature of the part has been photographed. The measurement of the part has been completed.

Command format

MSR_End_Measure(num RobotId, INOUT num MeasureResult, INOUT num FailedCount{*},INOUT num MSR_Status)

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.

Output parameters

MeasureResult

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

FailedCount{pass:[*]}

This parameter stores the number of measurement items of the part. The data type is num. The details are as follows:

  • FailedCount1 Store the number of measurement items where the part is beyond the first tolerance level.

  • FailedCount2 Store the number of measurement items where the part exceeds the secondary tolerance.

  • FailedCount3 Store the number of measurement items where the part exceeds the three-level tolerance.

MSR_Status

This parameter stores the command status code.

8102: The command is executed successfully.

-99: Abnormal Communication with the Robot.

Example

MSR_End_Measure 1,measure_result,FailedCount;

In the preceding example, the Mech-Metrics with an ID of 1 stops measurement, and the judgment result of the part is stored in measure_result, and the number of measurement items is stored in FailedCount, and the command status code is stored in MSR_Status.

Import Part ID During Measurement

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 ID during the measurement.

Timing of calling

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

Command format

MSR_Set_Piece_Info(num RobotId, string PieceSn,INOUT num MSR_Status)

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.

PieceSn

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: Abnormal Communication with the Robot.

Example

MSR_Set_Piece_Info 1,"ABC",MSR_Status;

In this example, the robot sends the target object with part SN ABC to the Mech-Metrics, and stores the command status code in the numeric register MSR_Status.

Query Part Historical Data

This command inputs a part SN to allow Mech-Metrics to display the input part data in the main interface.

Timing of calling

The command can be sent at any point when the measurement is not started.

Command format

MSR_View_Piece_Data(num RobotId, string PieceSn,INOUT num MSR_Status)

Input Parameters

RobotId

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

PieceSn

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: Abnormal Communication with the Robot.

Example

MSR_View_Piece_Data 1,"ABC",MSR_Status;

The above example indicates that the part SN (ABC) is sent to Mech-Metrics, the main interface of the Mech-Metrics is switched to the data view of this part, and the command status code is saved in MSR_Status.

Calibration

This command is used for hand-eye 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

MSR_Calib Move_Type,Pos_Jps,Wait_time\Ext;

Input Parameters

{Move_Type}

This parameter indicates 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 positions.

{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. Unit: millimeters. If a 7th axis exists and is controlled by the robot on site, this parameter must be set.

Output Parameters

TOP_Status

This parameter stores the command status code.

Example

  • Example 1:

    MSR_Calib 2,1,2;

    The above example indicates that the pose of the calibration point is specified as a tool pose. The robot moves to the calibration point based on the joint positions of the robot and then waits for 2 seconds.

  • Example 2:

    MSR_Calib 2,1,2\EXT:=Axis7;

    In the preceding example, the pose data of the calibration point is represented in tool pose. The robot moves to the calibration point based on the joint positions of the robot and then waits for 2 seconds. The 7th-axis value is Axis7.

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.