YASKAWA Standard Interface Commands

You are viewing an old version of the documentation. You can switch to the documentation of the latest version by clicking the top-right corner of the page.

When writing your own program, pay attention to the following:

  • Multiple parameters should be separated by semi-colons.

  • When calling jobs, the input parameter is a string by default, and the output parameter is a string by default. Each element in the string corresponds to a global variable in the background.

  • For Mech-Center prior to version 1.6.1, every Standard Interface job encapsulates codes that initialize the communication and disconnect the communication.

  • For Mech-Center 1.6.1 and above, the following changes have been made:

    • To facilitate testing, only MM_INIT_SOCKET keeps codes used for communication establishment and disconnection. The MM_INIT_SOCKET job only needs to be called once and the set IP address will be valid globally.

    • Codes used for communication establishment and disconnection are divided into two individual jobs, which are MM_OPEN_SOCKET and MM_CLOSE_SOCKET. The communication is established when MM_OPEN_SOCKET is called and remains alive until MM_CLOSE_SOCKET is called to disconnect it. With these two jobs, frequent reconnection of communication between the robot and the vision system can be avoided.

The following is the instruction in standard interface commands.

Initialize Communication

This job sets the IP address and port number of the IPC and wait time before the program stops trying to establish the communication.

Job

MM_INIT_SOCKET("IP_Address;Server_Port;Time_Out")

Parameters

Name Description

Input parameters

IP_Address

IP address of the IPC.

Server_Port

Port number of the IPC. The default is 50000.

Time_Out

Wait time in minutes before stopping connection attempt.

Example

CALL JOB:MM_INIT_SOCKET("192.168.1.1;50000;5")

This example sets the IP address and port number of the IPC to 192.168.1.1:50000 and wait time to 5 minutes.

Start TCP Socket

This job begins the communication between the robot and the vision system. The MM_INIT_SOCKET job should be called before this job to set the IP address and port number of the IPC correctly.

Job

MM_OPEN_SOCKET

Parameters

No parameters.

Example

CALL JOB:MM_OPEN_SOCKET

Close TCP Socket

This job ends the communication between the robot and the vision system. User can end communication with the vision system by calling this job after the communication is finished.

Job

MM_CLOSE_SOCKET

Parameters

No parameters.

Example

CALL JOB:MM_CLOSE_SOCKET

Start Mech-Vision Project

This job starts the Mech-Vision project that executes image capturing and performs vision recognition. This command is for applications that use only Mech-Vision but not Mech-Viz.

Job

MM_START_VIS("job;pos_num_need;sendpos_type;prNum")

Parameters

Name Description

Input parameters

job

Mech-Vision Project ID, which can be checked and adjusted in the Project List panel of Mech-Vision.

pos_num_need

The expected number of vision points for Mech-Vision to send. The vision point contains the vision pose, corresponding point cloud, label, scaling, etc. The value range is 0 to 20, in which 0 indicates that all vision points will be received.

sendpos_type

The type of the robot pose to send to Mech-Vision, from 0 to 3.

  • 0: No robot pose will be sent to the vision system. When the project is in the Eye-To-Hand mode, image capturing has nothing to do with the robot pose. If the “Path Planning” Step is used, the planned path starts at the Home point set in the path planning tool.

  • 1: Robot pose in current joint positions together with current flange pose will be sent to the vision system. This setting is recommended for projects in the Eye-In-Hand mode. Applicable to most robots (excluding truss robots). When this parameter is being used, the “Path Planning” Step in the Mech-Vision project will use the joint positions sent by the robot. If the flange pose is all zero, please ignore the flange pose data.

  • 2: Robot pose in current flange pose will be sent to the vision system. It is recommended to set this value when the camera is mounted in the Eye-In-Hand mode or other scenarios where only the flange pose data is available (such as truss robots).

  • 3: Robot pose in predefined joint positions set by the user will be sent to the vision system. This setting is recommended for projects in the Eye-To-Hand mode. When the Mech-Vision project contains the “Path Planning” Step, the joint positions sent by the robot will be used as the start pose.

prNum

P variable for storing the joint positions of the start point when sendpos_type=3. The data type of the P variable should be set to PULSE, otherwise the error message “MM:PVAR_SET_ERROR” will be raised.

Example

CALL JOB:MM_START_VIS("1;1;1")

This example triggers Mech-Vision project No.1 to run, and asks the Mech-Vision project to send over one vision point. The robot sends its current joint positions and flange pose when this job is called as the image-capturing pose.

Obtain Vision Targets

This job is for applications that use Mech-Vision but not Mech-Viz. It obtains the vision result from the corresponding Mech-Vision project.

Job

MM_GET_VISDATA("Job;Last_Data;Pose_Num;MM_Status")

Parameters

Name Description

Input parameters

Job

Mech-Vision Project ID, which can be checked and adjusted in the Project List panel of Mech-Vision.

Output Parameters

Last_Data

I variable, indicating whether all vision points have been sent, 0 or 1.

  • 0: NOT all vision points have been sent (more on the way).

  • 1: All vision points have been sent.

Pose_Num

I variable for storing the number of received vision points.

MM_Status

I variable for storing status code. Please see Mech-Mind Status Codes and Troubleshooting.

Example

CALL JOB:MM_GET_VISDATA("1;50;51;52")

This example obtains the vision result from Mech-Vision project No.1. Whether all vision points have been sent is stored in I50, the number of vision points received is stored in I51, and the status code is stored in I52.

Start Mech-Viz Project

This job is for applications that use both Mech-Vision and Mech-Viz. It runs the Mech-Viz project which triggers the corresponding Mech-Vision project to run, and sets the initial joint positions of the simulated robot in Mech-Viz.

Job

MM_START_VIZ("sendpos_type;prNum")

Parameters

Name Description

Input parameters

sendpos_type

Robot pose type. Value range: 0 to 2.

  • 0: No robot pose will be sent to Mech-Viz. This setting is recommended for projects in the Eye-To-Hand mode. The simulated robot in Mech-Viz moves from joint positions [0, 0, 0, 0, 0, 0] to the first waypoint.

  • 1: Current joint positions and flange pose of the robot will be sent to Mech-Viz. This setting is recommended for projects in the Eye-In-Hand mode. The simulated robot in Mech-Viz moves from the current joint positions of the real robot to the first waypoint.

  • 2: Joint positions of a specific start point will be sent to Mech-Viz. This setting is recommended for projects in the Eye-To-Hand mode. The simulated robot in Mech-Viz moves from the predefined joint positions to the first waypoint.

prNum

P variable for storing the joint positions of the start point when SendPos_Type = 2. The data type of the P variable should be set to PULSE, otherwise the error message “MM:PVAR_SET_ERROR” will be raised.

Example

CALL JOB:MM_START_VIZ("1")

This example runs the corresponding Mech-Viz project, and send the current joint positions and flange pose of the robot to Mech-Viz.

Get Planned Path

This job obtains the planned path from Mech-Viz.

Job

MM_GET_VIZDATA("GetPos_Type;Last_Data;Pos_Num;VisPos_Num;MM_Status")

Parameters

Name Description

Input parameters

GetPos_Type

Whether Mech-Viz should send waypoint poses as joint positions or TCPs, 1 or 2.

1: The pose type returned by Mech-Viz is joint positions.

2: The pose type returned by Mech-Viz is the TCP.

Output Parameters

Last_Data

I variable, indicating whether all waypoints have been sent, 0 or 1. 0: NOT all waypoints have been sent (more on the way). If the value is 0, call this JOB again until all are sent. 1: All waypoints have been sent.

Pose_Num

I variable for storing the number of received waypoints.

VisPos_Num

I variable for storing the position of the first Vision Move waypoint in the path. For example, in the workflow “Fixed-Point Move 1, Fixed-Point Move 2, Vision Move 1, Fixed-Point Move 3”, the position of the first Vision Move waypoint is 3. If the path does not contain Vision Move waypoint, the returned value is 0.

MM_Status

I variable for storing status code. Please see Status Codes and Troubleshooting for detailed information.

Example

CALL JOB:MM_GET_VIZDATA("2;50;51;52;53")

This example obtains the planned path from Mech-Viz in the form of TCPs. Whether all waypoints have been sent is stored in I50, the number of waypoints received is stored in I51, the position of the Vision Move waypoint is stored in I52, and the status code is stored in I53.

Obtain Pose

This job stores a vision pose returned by Mech-Vision or a waypoint pose returned by Mech-Viz in the specified variable.

Job

MM_GET_POSE("Index;Robtarget;Label;Pose_Speed")

Parameters

Name Description

Input parameters

Index

Specify the index of the pose to be stored.

Output Parameters

Robtarget

P variable for storing the specified pose.

Label

I variable for storing the label corresponding to the specified pose.

Pose_Speed

I variable for storing the velocity corresponding to the specified pose.

Example

CALL JOB:MM_GET_POSE("1;60;61;62")

This example stores the first received pose to P60, the corresponding label to I61, and the corresponding velocity to I62.

Obtain Joint Positions (Available when Mech-Viz is used)

This job stores a set of joint positions returned by Mech-Viz in the specified variable.

Job

MM_GET_JPS("Index;Jointtarget;Label;Pose_Speed")

Parameters

Name Description

Input parameters

Index

Specify the index of the pose to be stored.

Output Parameters

Jointtarget

P variable for storing the specified set of joint positions.

Label

I variable for storing the label corresponding to the specified set of joint positions.

Pose_Speed

I variable for storing the velocity corresponding to the specified set of joint positions.

Example

CALL JOB:MM_GET_JPS("1;60;61;62")

This example stores the first set of received joint positions to P60, the corresponding label to I61, and the corresponding velocity to I62.

Switch Mech-Vision Recipe

This job specifies which parameter recipe of the Mech-Vision project to use. This job must be called BEFORE MM_START_VIS.

Job

MM_SET_MODEL("Job;Model_number")

Parameters

Name Description

Input parameters

Job

Mech-Vision Project ID, which can be checked and adjusted in the Project List panel of Mech-Vision.

Model_number

The ID of a parameter recipe in the Mech-Vision project, from 1 to 99.

Example

CALL JOB:MM_SET_MODEL("1;1")

This example switches the parameter recipe used to No.1 in Mech-Vision project No.1.

Select Mech-Viz Branch

This command is used to select along which branch the Mech-Viz project should proceed. Such branching is achieved by adding Branch by Msg Step(s) to the project. This command specifies which exit port such Step(s) should take. MM_START_VIZ must be called BEFORE this job. When the Mech-Viz project executes to the “Branch by Msg” Step, it will wait for Command 203 to send the exit port of the branch.

Job

MM_SET_BRANCH("Branch_Num;Exit_Num")

Parameters

Name Description

Input parameters

Branch_Num

Step ID of the “Branch by Msg” Step, which is an integer. The Step ID can be viewed in the Step Parameters panel.

Exit_Num

The number of the exit port to take plus 1. For example, to select exit port 0 in Mech-Viz, set the value of this parameter to 1. Value range: 1 to 99. This parameter value should be 1 plus the exit port number displayed in the Step. For example, to select exit port 0, you should set the value of this parameter to 1.

Example

CALL JOB:MM_SET_BRANCH("1;3")

This example tells Mech-Viz to take exit port 3 for the “Branch by Msg” Step whose Step ID is 1.

Set Move Index

This job sets the value for the Current Index parameter of Steps. Steps that have this parameter include Move by List, Move by Grid, Custom Pallet Pattern, and smart_pallet_pattern. mm_start_viz must be called BEFORE this job.

Job

MM_SET_INDEX("Skill_Num;Index_Num")

Parameters

Name Description

Input parameters

Skill_Num

Step ID of the Step, which is an integer. The Step ID can be viewed in the Step Parameters panel.

Index_Num

The index value that should be set the next time this Step is executed.

When this command is sent, the current index value in Mech-Viz will become the parameter value minus 1.

When the Mech-Viz project runs to the Step specified by this command, the Current Index value in Mech-Viz will be increased by 1 to become the parameter’s value.

Example

CALL JOB:MM_SET_INDEX("2;10")

This example sets the Current Index value to 9 for the Step whose Step ID is 2. When the Step is executed, the Current Index value will be added 1 and become 10.

Get Software Status

This job is currently capable of checking whether Mech-Vision ready to run projects. In the future, this job can be used for obtaining the execution status of Mech-Vision, Mech-Viz, and Mech-Center.

Job

MM_GET_STATUS("Status")

Parameters

Name Description

Output Parameters

Status

I variable for storing status code. Please see Status Codes and Troubleshooting for detailed information.

Example

CALL JOB:MM_GET_STATUS("70")

This example obtains the status code and stores it in I70.

Input Object Dimensions to Mech-Vision

This job inputs object dimensions to the Mech-Vision project. This job must be called BEFORE MM_START_VIS.

Job

MM_SET_BOXSIZE("Job;Length;Width;Height")

Parameters

Name Description

Input parameters

Job

Mech-Vision Project ID, which can be checked and adjusted in the Project List panel of Mech-Vision.

Length

Length of object in mm.

Width

Width of object in mm.

Height

Height of object in mm.

Example

CALL JOB:MM_SET_BOXSIZE("1;500;300;200")

This example sets the object dimensions in the Read Object Dimensions Step in the Mech-Vision project No.1 to 500×300×200 mm.

Get DO Signal List

This job obtains the planned DO Signal list for controlling multiple sections of a sectioned vacuum gripper in Mech-Viz. MM_GET_VIZDATA must be called BEFORE this job.

Job

MM_GET_DOLIST

Example

CALL JOB:MM_GET_DOLIST

This example obtains the DO signal list planned by Mech-Viz and writes the values in setdo[]. Valid data starts from setdo[0] and ends with setdo[io_index-1].

Set DO

This job set the DoList sent by Mech-Viz as common output signals. At most 4 groups of GO signals are supported. Each group of GO signals contains 16 bits. If more than one GO group is needed, repeat calling the job. This job must be called AFTER MM_GET_DOLIST.

Job

MM_SET_DOLIST

Example

CALL JOB:MM_SET_DOLIST

This example obtains the DO signal list planned by Mech-Viz and writes the values of Signals 0 to 15 in OT1 to OT16.

Input TCP to Mech-Viz

This job dynamically inputs TCP data to the* External Move* Step in Mech-Viz. Please use this job based on the template project in XXXX/Mech-Center-xxx/tool/viz_project/outer_move, and place the External Move Step at a proper position in the workflow. MM_GET_VIZDATA must be called BEFORE this job.

Job

MM_SET_POSE("Pos")

Parameters

Name Description

Input parameters

Pos

P variable for storing the TCP data to be sent to Mech-Viz.

Example

CALL JOB:MM_SET_POSE("10")

This example sends the TCP data stored in P10 to the External Move Step in the Mech-Viz project.

Calibration

This job is used for hand-eye calibration (camera extrinsic parameter calibration). This job can be used in the MM_Calibration() program. It automates the calibration process in conjunction with the Camera Calibration function in Mech-Vision. For detailed instructions, see YASKAWA Calibration Program.

Job

MM_CALIB("Move_Type;Pos_Jps;Wait_Time;Rnum;Ext;Pos")

Parameters

Name Description

Input parameters

Move_Type

Motion type, 1 or 2. 1: MOVL. 2: MOVJ.

Pos_Jps

Pose as flange pose or joint positions, 1 or 2. 1: flange pose. 2: Joint positions.

Wait_Time

The time the robot waits to avoid shaking after it moves to the calibration point; the default value is 2 (s).

Rnum

Number of robot axes.

Ext

Data of the external 7th axis in mm, optional.

Pos

Start point for the calibration, P99 by default.

Example

CALL JOB:MM_CALIB("2;1;2;6;0;99")

This example moves the robot with MOVJ, receives pose data in the form of flange pose, and sets the wait time to 2 seconds to avoid the robot from shaking after it moves to the calibration point. This robot has 6 axes and does not have an external axis installed. The start point for the calibration is stored in P99.

Get Custom Output Data from Mech-Vision

This job is used for obtaining the vision result that includes custom port outputs from the corresponding Mech-Vision project. “Custom port outputs” refers to data output by ports other than poses and labels of the “Procedure Out” Step. The output ports can be customized if the Port Type parameter of the Step is set to “Custom”.

Calling this job once will store all the obtained data to the robot.

Job

MM_GET_DYDATA("job;regPosNum;regStatus")

Parameters

Name Description

Input parameters

job

Mech-Vision Project ID, which can be checked and adjusted in the Project List panel of Mech-Vision.

Output Parameters

regPosNum

I variable for storing the number of received vision points.

regStatus

I variable for storing status code. Please see Status Codes and Troubleshooting.

Example

CALL JOB:MM_GET_DYDATA("2;60;61")

This example obtains the vision result that includes custom port outputs from Mech-Vision project No.2. The number of vision points received is stored in I60, and the status code is stored in I61.

Save Vision Point to Specified Variables

This job stores the data in the vision point returned by Mech-Vision in the specified variables. This job is called AFTER MM_GET_DYDATA.

Job

MM_GET_DYPOSE("serial;prNum;regLabel;rrNum")

Parameters

Name Description

Input parameters

serial

Specify the index of the vision point to be stored.

Output Parameters

prNum

P variable for storing the pose in the specified vision point.

regLabel

I variable for storing the label in the specified vision point.

rrNum

The first R variable for storing the custom port outputs in the specified vision point. Data are stored in R variables consecutive to the input one. Reserve enough R variables.

Example

CALL JOB:MM_GET_DYPOSE("2;60;60;60")

This example stores the pose in the second received vision point to P60 (in the format of Euler angles converted from quaternions), the corresponding label to I60, and the corresponding custom port outputs to R60-RN.

Get Waypoint from Mech-Viz

This job is used for obtaining the planned path from Mech-Viz. The waypoint may be for a Vision Move Step, or for one of the other move-type Steps. A waypoint may contain pose, velocity, gripper info, workobject info, etc.

Calling this job once will store all the obtained data to the robot.

Waypoints in a planned path can be divided into the following three types.

  1. All waypoints contain the following data: motion type (joint motion or linear motion), tool number and velocity.

  2. Vision move waypoints, including label, number of workobject that have been picked, number of work objects picked this time, edge/corner ID of the suction cup, the TCP offset, workobject pose, and dimensions of the workobject combined.

  3. Vision move waypoints including custom data, where the port type of the Procedure Out step of the Mech-Vision project should be “custom”.

Job

MM_GET_PLANDATA("jpsPos;regPosNum;visPosNum;regStatus")

Parameters

Name Description

Input parameters

jpsPos

Expected format of the returned data, from 1 to 4. See the following table for explanations.

Output Parameters

regPosNum

I variable for storing the number of received waypoints.

visPosNum

I variable for storing the position of the first Vision Move waypoint in the path. Example path: Move_1, Move_2, Vision Move_3, Move_3, Vision Move_2. In this path, the position of the first Vision Move waypoint is 3. If the path does not contain Vision Move waypoint, the return value is 0.

regStatus

I variable for storing status code. Please see Status Codes and Troubleshooting.

The relationship between the value of Jps_Pos and the format of the returned data is summarized below.

jpsPos value Format of returned data (Explained below)

1

Pose (joint positions), motion type, tool number, velocity, number of custom ports, custom port output, custom port output, … custom port output

2

Pose (TCP), motion type, tool number, velocity, number of custom ports, custom port output, custom port output, … custom port output

3

Pose (joint positions), motion type, tool number, velocity, depalletizing planning data, number of custom ports, custom port output, custom port output, … custom port output

4

Pose (TCP), motion type, tool number, velocity, depalletizing planning data, number of custom ports, custom port output, custom port output, … custom port output

Pose

The pose of the waypoint, as joint positions (in degree) or TCP, which is composed of Cartesian coordinates (XYZ in mm) and Euler angles (ABC in degree).

Motion type

  • 1: joint motion, MOVEJ

  • 2: linear motion, MOVEL

Tool number

The index number of the tool to be used at this waypoint. -1 means no tool is used.

Velocity

Velocity of the waypoint, equals to the velocity setting in the corresponding move-type Step multiplied by the global velocity setting in Mech-Viz, in the format of percentage.

Depalletizing planning data

Data used in planning multi-pick and depalletizing tasks. These data are part of the waypoint of the “Vision Move” Step. The following data are included:

  • Label: Composed of 10 integers. If fewer than 10 labels are obtained, the rest of the digits are filled with 0.

  • Number of picked workobjects.

  • Number of workobjects to be picked this time.

  • Edge-corner ID of vacuum gripper: Specify the gripper corner to which the workobject is aligned. Can be checked by double-clicking the corresponding tool in the Resources panel in Mech-Viz and then selecting Configure control logic.

  • TCP offset: The offset between the tool pose at the center of the to-pick workobject and the actual tool pose.

  • Workobject orientation: Whether the X-axis of the workobject reference frame is aligned with the X-axis of the tool reference frame (value: 0 or 1).

  • Dimensions of the workobject combined.

Number of custom ports

The number of output keys excluding poses and labels when the Port Type parameter of the “Procedure Out” Step in the Mech-Vision project is set to “Custom”.

Custom port outputs

The outputs excluding poses and labels when the Port Type parameter of the “Procedure Out” Step in the Mech-Vision project is set to “Custom”. These data are part of the waypoint of the “Vision Move” Step. The custom port outputs are arranged in alphabetical order of the custom port names.

Example

CALL JOB:MM_GET_PLANDATA("4;60;61;62")

This example obtains the planned path that includes custom port outputs from Mech-Viz, and the poses obtained are in the form of TCPs. The number of waypoints received is stored in I60, the position of the Vision Move waypoint is stored in I61, and the status code is stored in I62.

Save Waypoint to Specified Variables

This job stores the waypoints returned by Mech-Viz in the specified variables.

Job

MM_GET_PLANPOSE("serial;prNum;brNum;rrNum")

Parameters

Name Description

Input parameters

serial

Specify the index of the waypoint to be stored.

Output Parameters

prNum

P variable for storing the poses in the specified waypoint.

  • If Jps_Pos in MM_GET_PLANDATA is 1 or 3, set the data type of the P variable to PULSE. The program will turn the joint positions to pulse for the robot.

  • If Jps_Pos in MM_GET_PLANDATA is 2 or 4: set the data type of the P variable to ROBOT.

brNum

The first B variable for storing the motion type, tool number and velocity in the specified waypoint. Make sure the next two B variables are free for storing the above data.

rrNum

The first R variable for storing the depalletizing planning data and custom port outputs in the specified waypoint. Omit for waypoints not of the Vision Move Step. Data are stored in R variables consecutive to the input one. Reserve enough R variables. The depalletizing planning data occupies 20 variables.

Example

CALL JOB:MM_GET_PLANPOSE("2;60;60;60")

This example stores the TCP in the second received waypoint to P60, and stores the corresponding motion type, tool number and velocity to B60, B61 and B62. Waypoints that are not vision move points will be neglected. Waypoint that are vision move points will be stored in R60-RN in the data receiving format as the description in MM_GET_PLANDATA.

Get Result of Step “Path Planning” in Mech-Vision

This job obtains the collision-free path planned by the “Path Planning” Step from the corresponding Mech-Vision project.

The Port Type parameter of the “Procedure Out” Step in the Mech-Vision project must be set to “Predefined (robot path)”.

Job

MM_GET_VISPATH("job;GetPos_Type;Last_Data;Pos_Num;VisPos_Num;MM_Status")

Parameters

Name Description

Input parameters

job

Mech-Vision Project ID, which can be checked and adjusted in the Project List panel of Mech-Vision.

GetPos_Type

This parameter specifies the type of waypoint pose returned by the “Path Planning” Step.
1: Waypoints in joint positions will be returned. 2: Waypoints in TCPs will be returned.

Output Parameters

Last_Data

I variable, indicating whether all waypoints have been sent, 0 or 1.

  • 0: NOT all waypoints have been sent (more on the way).

  • 1: All waypoints have been sent.

Pos_Num

I variable for storing the number of received waypoints.

VisPos_Num

I variable for storing the position of the first Vision Move waypoint in the path. For example, if the path is composed of Steps Fixed-Point Move_1, Fixed-Point Move_2, Vision Move and Fixed-Point Move_3 sequentially, the position of Vision Move is 3. If the path does not contain Vision Move waypoint, the return value is 0.

MM_Status

I variable for storing status code. Please see Status Codes and Troubleshooting.

Example

CALL JOB:MM_GET_VISPATH("1;2;50;51;52;53")

This example obtains the planned path from Mech-Vision project No.1 in the form of TCPs. Whether all waypoints have been sent is stored in I50, the number of waypoints received is stored in I51, the position of the Vision Move waypoint is stored in I52, and the status code is stored in I53.

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.