YASKAWA Standard Interface Commands
This section introduces the standard interface commands used in TCP communications between a YASKAWA 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 |
|---|---|---|
Yes |
This command sets the IP address of the IPC, port number, and timeout period for robot communication. |
|
Yes |
This command establishes the TCP communication between the robot and the inline measurement system. |
|
Yes |
This command closes the TCP communication between the robot and the inline measurement system. |
|
No |
The robot informs Mech-Metrics to begin switching projects. |
|
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. |
|
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. |
|
Yes |
The robot informs Mech-Metrics that the measurement ends and requests the measurement result of the part. |
|
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. |
|
No |
Input the SN of the part to switch the main interface of Mech-Metrics to the data view of the part. |
|
Yes (automatic calibration program) |
Hand-eye calibration (extrinsic parameter calibration) |
Notes
Please note the following before starting:
-
Notes on calling YASKAWA robot commands:
-
Parameters in the parameter list of a command must be separated by semicolons (;).
-
By default, the input and output parameters of a command are string constants. The values of output parameters correspond to global variables in the background.
-
The commands for establishing and closing the communication are two individual commands (Establish TCP Communication and Close TCP Communication), preventing frequent disconnections and reconnections between the robot and the vision system.
-
-
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 the Communication
This command sets the IP address of the IPC, port number, and timeout period for robot communication.
Invocation Timing
After using this command, the user needs 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("IP_Address;Server_Port;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 to establish 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 Mech-MSR. The data type is num.
Time_Out
This parameter indicates the communication timeout period, in minutes.
Example
CALL JOB:MSR_INIT_SOCKET("192.168.1.20;50000;5")
In this example, the robot connects to the IPC at IP address 192.168.1.20 with port number 50000 and a timeout of 5 minutes.
Establish TCP Communication
This command establishes the TCP communication between the robot and the inline measurement system.
Invocation Timing
This command must be called immediately after initializing communication.
Command Format
MSR_OPEN_SOCKET
Example
CALL JOB:MSR_OPEN_SOCKET
In this example, the TCP communication between the robot and the inline measurement system is established.
Close TCP Communication
This command is used to disconnect the TCP communication between the robot and the inline measurement system.
Calling Sequence
After receiving the result from the Mech-MSR project, the user can call this command to close the connection and then store the result in the specified variable. If the connection remains open for a long time, the robot program may trigger an abnormal connection closure error.
Command Format
MSR_CLOSE_SOCKET
Switch Project
The robot informs Mech-Metrics to start switching projects.
Invocation Timing
Before switching the project.
Command Format
MSR_SWITCH_PROJECT ARGF"RobotID;Job; regStatus"
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.
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
regStatus
This parameter is an I variable that receives the status code.
8105: The command is executed successfully.
-99: Robot communication error.
Example
CALL JOB:MSR_SWITCH_PROJECT ARGF"1;1;80"
In this example, the system switches to the project with part ID 1 and project ID 1, and saves the command status code in I variable 80.
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; Qc_Mode; CustomData[0]; CustomData[1]; CustomData[2]; CustomData[3]; CustomData[4]; CustomData[5]; CustomData[6]; CustomData[7]; Reg_Num", "Piece_Name", "Piece_SN;regStatus")
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.
CustomData[0]-CustomData[7]
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:
-
In the ribbon at the top of the Mech-Metrics configuration interface, select to configure the meanings of the values (1 to 8) for the specified custom parameter (such as custom parameter 1).
-
Set the specified custom parameter in the command.
Output Parameters
Reg_Num
This parameter indicates the I register ID. This register is used to store whether the current execution, as returned by the software, is continuous execution or single execution.
0: Single execution.
1: Continuous execution.
If single execution is specified, the robot runs the following commands in sequence: Start Measurement Task→Run Feature Measurement→Stop 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 Task→Run Feature Measurement→Run Feature Measurement→Stop 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.
|
regStatus
This parameter is an I variable that receives the status code.
8100: The command is executed successfully.
-99: Robot communication error.
Example
CALL JOB:MSR_START_MEASURE ARGF"1;2;3;1;1;1;1;1;1;10;80" ARGF"Piece01" ARGF"STRING"
In this example, the robot informs Mech-Metrics to start measuring a new part and sends the part ID (1), partial inspection mode (2), 8 custom parameters (3;1;1;1;1;1;1;10), part name, and part SN to the software.
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_FEASURE("RobotID; Measure_Index; regStatus")
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
regStatus
This parameter is an I variable that receives the status code.
8101: The command is executed successfully.
-99: Robot communication error.
Example
CALL JOB:MSR_MEASURE_FEASURE ARGF"1;1;80"
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 I variable 80.
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("RobotID; Reg_Judge; Reg_Num1; Reg_Num2; Reg_Num3; regStatus")
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
Reg_Judge
This parameter indicates the ID of the I register for storing the judgment result of the part. 1 stands for OK, and 0 for NG.
Reg_Num1, Reg_Num2, Reg_Num3
This parameter indicates the ID of the I register for storing the number of measurement items of the part. The data type is num. The details are as follows:
-
Reg_Num1 Stores the number of measurement items that exceed tolerance 1.
-
Reg_Num2 Stores the number of measurement items that exceed tolerance 2.
-
Reg_Num3 Stores the number of measurement items that exceed tolerance 3.
regStatus
This parameter is an I variable that receives the status code.
8102: The command is executed successfully.
-99: Robot communication error.
Example
CALL JOB:MSR_END_MEASURE ARGF"1;11;31;32;33;80"
In this example, the robot informs Mech-Metrics to end the measurement (with part ID 1), and Mech-Metrics returns the measurement results. The part judgment result is stored in numeric register 11. The numbers of measurement items exceeding tolerance 1, tolerance 2, and tolerance 3 are stored in numeric registers 31, 32, and 33, respectively. The command status code is saved in numeric register 80.
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("RobotID;regStatus", "Piece_SN")
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_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
regStatus
This parameter is an I variable that receives the status code.
8103: The command is executed successfully.
-99: Robot communication error.
Example
CALL JOB:MSR_SET_PIECE_INFO ARGF"1;80" ARGF"STRING"
In this example, the robot sends the part SN 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("RobotID;regStatus", "Piece_SN")
Input Parameters
RobotID
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
regStatus
This parameter is an I variable that receives the status code.
8104: The command is executed successfully.
-99: Robot communication error.
Example
CALL JOB:MSR_VIEW_PIECE_DATA ARGF"1;80" ARGF"STRING"
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 numeric register 80.
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
MSR_CALIB("Move_Type;Pos_Jps;Wait_Time;Rnum;Ext;Pos")
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
CALL JOB:MSR_CALIB("2;1;2;6;0;99")
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. No external axes exist. The pose data of the calibration point is stored in P99.