Standard Interface Commands
This section describes standard interface commands used in TCP communications between a FANUC 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. |
|
No |
The robot informs Mech-Metrics to begin switching projects. |
|
Yes |
Before starting the measurement task, the robot sets custom information for the start measurement command. |
|
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. |
|
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. |
|
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 ID during the measurement. |
|
No |
Input the SN of part to allow the main interface of Mech-Metrics to display the data view of the part. |
|
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 FANUC robot, take note of the following items:
-
Parameters in the parameter list of the program are automatically separated by commas.
-
Each parameter variable can be directly inserted with values of the corresponding type.
-
Values can be obtained indirectly through the R register and the SR register.
-
For FANUC 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.
-
-
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_SKT(C_Tag,Ip_Addr,Svr_Port,Time_Out)
Input parameters
C_Tag
Ip_Addr
This parameter specifies the IP address of the IPC. The data type is string.
Svr_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.
|
If the robot system version is V10, the value range for Svr_Port is 1 to 32767. |
Time_Out
This parameter indicates the communication timeout period. Unit: minutes.
Example
CALL MSR_INIT_SKT ('1', '192.168.1.20', 30000, 5)
In the preceding example, the IP address of the IPC to which you want to connect robot port 1 is 192.168.1.20, the port number of the IPC is 30000, and the timeout period of the IPC is 5 minutes.
Switch Project
The robot tells the Mech-Metrics to start switching projects.
Timing of calling
Before switching the project.
Command Format
MSR_SW_PROJ(RobotID, Job,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.
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 R register ID of the command status code.
8105: The command is executed successfully.
-99: Abnormal Communication with the Robot.
Example
CALL MSR_SW_PROJ(1, 2, 53)
The above example indicates that the system switches to the project with part ID 1 and project ID 2, and saves the command status code in numeric register R[53].
Set Custom Info
This command sets custom information for the start measurement task command.
Timing of calling
This command must be called before you start the measurement task to set the custom information for the measurement.
Command format
MSR_MEAS_PARM(CustomData[0]; CustomData[1]; CustomData[2]; CustomData[3]; CustomData[4]; CustomData[5]; CustomData[6]; CustomData[7])
Input parameters
CustomData[0]-CustomData[7]
This parameter indicates the custom information of the part. 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 0 and 8. 0 indicates that the custom parameter is not needed.
To use a custom parameter:
-
In the upper-part ribbon of Mech-Metrics, select to configure the meaning for values (1 to 8) of the custom parameter (such as custom parameter 1).
-
Add the custom parameter to the command.
Example
CALL MSR_MEAS_PARM(1,1,1,1,1,1,1,1)
In this example, 8 custom values of the part are set in advance, and the custom values are all integers 1.
Start Measurement Task
The robot informs the Mech-Metrics to start measuring the new part, and sends the part name, part SN, 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_ST_MEAS(RobotID, SReg_Num1, SReg_Num2, Qc_Mode, Reg_Num, MSR_Status)
Input parameters
RobotID
This parameter indicates the part ID. The part ID is an integer between 1 and 99.
SReg_Num1
This parameter indicates the ID of the string register that stores the name of the part (Piece_Name) you want to measure. The part name can contain letters and digits and cannot exceed 20 characters in length.
SReg_Num2
This parameter indicates the ID of the string register that stores the SN of the part (Piece_Sn) you want to measure. 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.
Qc_Mode
This parameter indicates the quality inspection mode of the part. QC is called Quality Control. The meanings of each parameter value are as follows:
-
1: Full inspection.
-
2: Partial inspection.
-
Others: Use existing settings.
Reg_Num
This parameter indicates the ID of the numeric register that is used to store whether the operation mode, as returned by the software, is a loop execution or a one-time execution.
0: One-time execution.
1: Loop execution.
If one-time 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 use the run 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 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.
|
MSR_Status
ID of the R register for storing the command status code.
8100: Successfully executed.
-99: Abnormal Communication with the Robot.
Example
CALL MSR_ST_MEAS(1,1,2,1,10,53)
In this example, the robot informs the Mech-Metrics to start measuring a new part, sends the part ID 1, the part name in the string register 1, the part SN in the string register 2, and the quality inspection mode 1 to the software. Meanwhile, the current operation mode of the Mech-Metrics software is stored in the numeric register 10, and the status code is stored in numeric register R[53].
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_MEAS_FEA(RobotID, Measure_Index,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 R register ID of the command status code.
8101: The command is executed successfully.
-99: Abnormal Communication with the Robot.
Example
CALL MSR_MEAS_FEAT(1, 3, 53)
In this example, the robot triggers the Mech-MSR project to run, with part ID 1 and feature ID 3. The status code is stored in numeric register R[53].
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_MEAS(RobotID,Reg_Judge,Reg_Num1,Reg_Num2,Reg_Num3,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
Reg_Judge
This parameter indicates the ID of the numeric register for storing the judgment result of the part. 0 stands for OK, and 1 for NG.
Reg_Num1, Reg_Num2, Reg_Num3
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:
-
Reg_Num1 Store the number of measurement items where the part is beyond the one-level tolerance.
-
Reg_Num2 Store the number of measurement items where the part exceeds the secondary tolerance.
-
Reg_Num3 Store the number of measurement items where the part exceeds the three-level tolerance.
MSR_Status
This parameter stores the R register ID of the command status code.
8102: The command is executed successfully.
-99: Abnormal Communication with the Robot.
Example
CALL MSR_END_MEAS(1,11,12,13,14,53)
The above example indicates that the robot informs Mech-Metrics to end the measurement (for part ID 1), and at the same time, 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 12, 13, and 14, respectively. The status code is saved in numeric register R[53].
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_WP(RobotID, SReg_Num2, 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 ID of the string register that stores the SN of the part. 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.
Output Parameters
MSR_Status
This parameter stores the R register ID of the command status code.
8103: The command is executed successfully.
-99: Abnormal Communication with the Robot.
Example
CALL MSR_SET_WP(1, 2, 53)
In this example, the robot with an ID of 1 sends the part SN recorded in the string register with an ID of 2 to the Mech-Metrics and stores the status code in the numeric register R[53].
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_WP(RobotID, SReg_Num2, 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 ID of the string register that stores the SN of the part. 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.
Output Parameters
MSR_Status
This parameter stores the R register ID of the command status code.
8104: The command is executed successfully.
-99: Abnormal Communication with the Robot.
Example
CALL MSR_VIEW_WP(1, 2, 53)
The above example indicates that when the robot is not performing measurement, the part SN stored in string register 2 (with part ID 1) is sent to Mech-Metrics, the main interface of Mech-Metrics is switched to the data view of this part, and the status code is saved in numeric register R[53].
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,PosJps,WaitTime,AxisNum,AxisVal,Reg_CalibPos,Reg_CalibMov)
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.
AxisNum
This parameter specifies the number of the robot axes.
{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 to the specific external exist data. Otherwise, this parameter must be set to 0.
| The robot’s external axis type must be configured as Auxiliary Linear Axis. This command is currently not applicable to other types of external axes. |
Reg_CalibPos
This parameter indicates the position register ID used for the calibration start point in MSR_AUTO_CALIB.
Reg_CalibMov
This parameter represents the position register ID used by Mech-MSR to calculate the pose of the calibration point. This parameter is only used within the MSR_CALIB command for MSR_MOVEJ and MSR_MOVEL.
Output Parameters
TOP_Status
This parameter stores the command status code.
Example
CALL MSR_CALIB (2,1,2,6,0,100,99)
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. No external axes exist. The calibration start point is stored in register PR[100].