YASKAWA Inline Measurement Example Program

Program Introduction

Description

You trigger Mech-Metrics from the robot side to perform measurement using Mech-MSR and return the measurement results to Mech-Metrics.

File path

You can navigate to the installation directory of Mech-MSR and Mech-Metrics by using the Mech-MSR/center/MSR_Interface/YASKAWA/MSR_Metrics_Sample1.JBI path.

Resource requirements

Mech-MSR solution and Mech-Metrics project

Prerequisites

  • Prepare on the inline measurement system side:

    • The current part is associated with the Mech-MSR solution in Mech-Metrics.

    • The current feature is associated with the Mech-MSR project in Mech-Metrics.

    • The Mech-MSR solution and project are open in Mech-MSR.

  • Prepare the robot side:

    • The operations in Set up Standard Interface Communication with YASKAWA have been completed.

    • The operations in Automatic YASKAWA calibration have been completed.

    • The measurement positions have been taught.

    • The robot has been moved to the first measurement position.

    • The robot and camera have been preheated for 30 minutes before starting the measurement.

    • External lighting and temperature are stable before starting the measurement.

This example program is provided for reference only. Before using the program, please modify the program according to the actual scenario.

Program Description

The following is the code of the MSR_Metrics_Sample1 example program and the related explanation.

/JOB
//NAME MSR_Metrics_Sample1
//POS
///NPOS 0,0,0,3,0,0
///TOOL 1
///POSTYPE ROBOT
///RECTAN
///RCONF 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
P00000=354.297,-0.839,29.373,179.7929,0.0507,-0.0083
P00001=354.297,-0.839,29.373,179.7929,0.0507,-0.0083
P00002=354.297,-0.839,29.373,179.7929,0.0507,-0.0083
//INST
///DATE 2024/05/29 14:15
///ATTR SC,RW
///GROUP1 RB1
NOP
CALL JOB:MSR_INIT_SOCKET ARGF"192.168.10.40;50000;5"
CALL JOB:MSR_OPEN_SOCKET
CALL JOB:MSR_START_MEASURE ARGF"1;2;2;3;1;1;1;1;1;1;10" ARGF"Piece01" ARGF"STRING;80"
CALL JOB:MSR_SET_PIECE_INFO ARGF"1;80" ARGF"STRINGU"
MOVJ P000 VJ=50.00
CALL JOB:MSR_MEASURE_FEASURE ARGF"1;2;80"
MOVJ P001 VJ=50.00
CALL JOB:MSR_MEASURE_FEASURE ARGF"1;2;80"
MOVJ P002 VJ=50.00
CALL JOB:MSR_MEASURE_FEASURE ARGF"1;2;80"
CALL JOB:MSR_END_MEASURE ARGF"1;11;31;32;33;80"
CALL JOB:MSR_VIEW_PIECE_DATA ARGF"1;80" ARGF"STRINGU"
CALL JOB:MSR_CLOSE_SOCKET
END

The table below explains the above example program.

Workflow Code and description

Set position Information

///NPOS 0,0,0,3,0,0
///TOOL 1
///POSTYPE ROBOT
///RECTAN
///RCONF 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
P00000=354.297,-0.839,29.373,179.7929,0.0507,-0.0083
P00001=354.297,-0.839,29.373,179.7929,0.0507,-0.0083
P00002=354.297,-0.839,29.373,179.7929,0.0507,-0.0083
  • //POS: Set the position information.

  • ///NPOS 0,0,0,3,0,0: Specify three measurement positions.

  • ///TOOL 1: Specify the ID of the tool in use.

  • ///POSTYPE ROBOT: Specify to use the robot reference frame.

  • P00000=354.297, -0.839,29.373,179.7929,0.0507, -0.0083: Define the coordinates of the first measurement position, including X, Y, Z, Rx, Ry, and Rz. Unit: position (mm) and orientation (degree).

  • P00001=354.297,-0.839,29.373,179.7929,0.0507,-0.0083: Define the coordinates of the second measurement position, including X, Y, Z, Rx, Ry, and Rz. Unit: position (mm) and orientation (degree).

  • P00002=354.297,-0.839,29.373,179.7929,0.0507,-0.0083: Define the coordinates of the third measurement position, including X, Y, Z, Rx, Ry, and Rz. Unit: position (mm) and orientation (degree).

Set program attributes

///DATE 2024/05/29 14:15
///ATTR SC,RW
///GROUP1 RB1
NOP
  • //INST: Start setting program information.

  • ///DATE 2024/05/29 14:15: Set the program creation time.

  • ///ATTR SC,RW: Set program attributes. The details are as follows:

    • SC: Single cycle.

    • RW: Read and write.

  • ///GROUP1 RB1: Specify the robot group 1 (RB1).

  • NOP: Empty operation for placeholder or logical separation.

Initialize communication

CALL JOB:MSR_INIT_SOCKET ARGF"192.168.10.40;50000;5"
  • CALL JOB:MSR_INIT_SOCKET ARGF"192.168.10.40;50000;5": Set the IP address and port number of the IPC for robot communication, as well as the communication timeout period.

    • CALL: Call a specific command or program.

    • JOB: Specify the command or program to call.

    • ARGF"192.168.10.40;50000;5": Specify the IP address of the IPC, the port number of the IPC, and the connection timeout period. The details are as follows:

      • 192.168.10.40: The IP address of the IPC.

      • 50000: The port number of the IPC.

      • 5: The connection timeout period. Unit: minutes.

        Please modify the IP address and port number of the IPC according to the actual situation. The IP address and port number must be consistent with those set in Mech-MSR.

Establish the communication

CALL JOB:MSR_OPEN_SOCKET
  • CALL JOB:MSR_OPEN_SOCKET: Establish the TCP communication between the robot and the inline measurement system.

Start measurement task

CALL JOB:MSR_START_MEASURE ARGF"1;2;2;3;1;1;1;1;1;1;10" ARGF"Piece01" ARGF"STRING;80"
  • CALL JOB:MSR_START_MEASURE ARGF"1;2;2;3;1;1;1;1;1;1;10" ARGF"Piece01" ARGF"STRING;80": Start the measurement task.

    • ARGF"1;2;2;3;1;1;1;1;1;1;10": Set the parameters for the measurement task. The details are as follows:

      • First 1: The part ID.

      • First 2: Quality inspection mode. 1 stands for full inspection, and 2 stands for partial inspection.

      • Second 2: Continuous_Mode.

      • 3;1;1;1;1;1;1;10: The custom parameters used to customize the part information. Custom parameters are used only when more part information needs to be provided to Mech-Metrics.

      • ARGF "Piece01": Used to specify the part name Piece01.

      • ARGF"STRING;80": Used to specify the SN and regStatus register IDs of the part. In the above example, STRING stands for part SN, and 80 stands for the ID of the register used to store the status code.

The custom parameters and detection mode set here must be consistent with those set in the Mech-Metrics.

Input part to Mech-Metrics

CALL JOB:MSR_SET_PIECE_INFO ARGF"1;80" ARGF"STRINGU"
  • CALL JOB:MSR_SET_PIECE_INFO ARGF"1;80" ARGF"STRINGU": Input the part SN. Specify the ID of the register for storing the command status code.

    • ARGF"1;80": Specify the part ID and the ID of the regStatus register. In the above example, 1 is the part ID, and 80 is the ID of the register used to store the status code.

    • ARGF "STRINGU": Used to specify the part SN.

Move the robot to a specified position and perform feature measurement

MOVJ P000 VJ=50.00
CALL JOB:MSR_MEASURE_FEASURE ARGF"1;2;80"
MOVJ P001 VJ=50.00
CALL JOB:MSR_MEASURE_FEASURE ARGF"1;2;80"
MOVJ P002 VJ=50.00
CALL JOB:MSR_MEASURE_FEASURE ARGF"1;2;80"
  • MOVJ P000 VJ=50.00: Move the robot to position P000 with a joint speed of 50.00.

    • MOVJ: The joint position-based motion command.

    • P000: The ID of the position that is taught to the robot.

    • VJ=50.00: The joint velocity. Joint velocity is represented as a proportion of the maximum velocity.

  • CALL JOB:MSR_MEASURE_FEASURE ARGF"1;2;80": The robot side triggers the Mech-MSR project whose part ID is 1 and whose measurement feature is 2 to run, and stores the command status code in register 80.

  • MOVJ P001 VJ=50.00: Move the robot to position P001 with a joint speed of 50.00.

  • MOVJ P002 VJ=50.00: Move the robot to position P002 with a joint speed of 50.00.

    You need to teach the measurement positions P000, P001, and P002 in advance. For information about how to teach the waypoint, see the Teach Calibration Start Point section in the YASKAWA Automatic Calibration.

End measurement

CALL JOB:MSR_END_MEASURE ARGF"1;11;31;32;33;80"
  • CALL JOB:MSR_END_MEASURE ARGF"1;11;31;32;33;80": End the measurement task and process the measurement result.

    • ARGF"1;11;31;32;33;80": Used to set the part ID and some measurement parameters. The details are as follows:

      • 1: Part ID.

      • 11: The register ID for storing the result of the part. 0 stands for OK, and 1 for NG.

      • 31: The ID of the register for storing the number of part measurement items whose value exceeds tolerance 1.

      • 32: The ID of the register for storing the number of part measurement items whose value exceeds tolerance 2.

      • 33: The ID of the register for storing the number of part measurement items whose value exceeds tolerance 3.

      • 80: The ID of the Data Register for storing the status code (regStatus).

Query history data

CALL JOB:MSR_VIEW_PIECE_DATA ARGF"1;80" ARGF"STRINGU"
  • CALL JOB:MSR_VIEW_PIECE_DATA ARGF"1;80" ARGF"STRINGU": By inputting the part SN through external software, the main interface of Mech-Metrics is switched to display the data of the corresponding part.

    • ARGF"1;80": Used to specify the part ID and regStatus register ID. In the above example, 1 is the part ID, and 80 is the ID of the register used to store the status code.

    • ARGF "STRINGU": Used to specify the part SN.

In YASKAWA-related commands, RobotID indicates the part ID, and regStatus indicates the command status code.

Close the communication

CALL JOB:MSR_CLOSE_SOCKET
END
  • CALL JOB:MSR_CLOSE_SOCKET: Disconnect the TCP communication between the robot and the inline measurement system.

  • END: End the program.

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.