Kawasaki Standard Interface Commands

This section describes standard interface commands used in TCP communications between a Kawasaki robot and Mech-Mind Vision System. The robot (the client) sends commands to Mech-Mind Vision System (the server), and Mech-Mind Vision System returns the processed data to the robot.

send receive

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

  • When programming a Kawasaki robot, pay attention to 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. Local variables take effect only in the command.

    • Input and output parameters can be customized in commands.

    • Arguments in a command: The input arguments can be constants, global variables, or local variables. The output arguments can be global variables or local variables.

  • Unit of data:

    • The unit of joint positions is degree (°).

    • A robot’s flange pose or TCP consists of the position and pose. The position is represented in XYZ coordinates and is measured in millimeters (mm); the pose is represented in Euler angles and is measured in degrees (°).

  • Vision point and waypoint:

    • Vision point: An object recognized by Mech-Vision. A vision point has information including the object pose, label, velocity, dimensions, and custom port output data.

    • Waypoint: Each point that the robot reaches when moving along the planned path. A waypoint has information including the robot pose, label, motion type, and velocity. Waypoints can be divided into two categories:

      • Vision Move waypoints, which refer to the waypoints corresponding to the Vision Move Step.

      • Non-Vision Move waypoints, which refer to the waypoints corresponding to Move-type Steps other than the Vision Move Step.

Initialize Communication

Command

This command establishes the TCP communication between the robot and the vision system.

Command Format

mm_init_skt(.ip1,.ip2,.ip3,.ip4,.port)

Input Parameters

.ip1~.ip4

Indicate four field values in the IP address of the IPC.

.port

This parameter specifies the port number used by the IPC to establish the communication between the IPC and the robot. This port number must be consistent with the host port number that is specified for robot communication in the toolbar of Mech-Vision.

Example

call mm_init_skt(192,168,1,121,50000)

In this example, the IP address of the IPC to which you want to connect the robot is 192.168.1.121 and the port number is 50000.

Run Mech-Vision Project

Command

This command triggers the Mech-Vision project to run. When the Mech-Vision project is running, the vision system triggers the camera to capture images and then process the returned images with algorithms to produce a series of vision points or waypoints.

  • Vision point: An object recognized by Mech-Vision. A vision point has information including the object pose, label, velocity, dimensions, and custom port output data.

  • Waypoint: Each point that the robot reaches when moving along the planned path. A waypoint has information including the robot pose, label, motion type, and velocity.

Calling Sequence

Command Format

mm_start_vis(.job,.pos_num_need,.sendpos_type,.#start_vis)

Input Parameters

.job

This parameter specifies the Mech-Vision project ID. You can view the project ID of a Mech-Vision project in the Project List section of Mech-Vision. The project ID is the number before the project name.

.pos_num_need

This parameter specifies the expected number of vision points or waypoints to be obtained from the Mech-Vision project. Value range: 0 to the largest positive integer.

If the Mech-Vision project has a Path Planning Step, this parameter specifies the expected number of waypoints. Otherwise, it specifies the expected number of vision points.
  • 0: Obtain all vision points or waypoints from the Mech-Vision project.

  • A positive integer: Obtain the specific number of vision points or waypoints from the Mech-Vision project.

    • If the total amount of vision points or waypoints output by the Mech-Vision project is smaller than the parameter value, this command will obtain the number of all vision points or waypoints.

    • If the total amount of vision points or waypoints output by the Mech-Vision project is larger than or equal to the parameter value, this command will obtain the number of vision points or waypoints as specified by this parameter.

  • Vision points or waypoints will not be returned after Run Mech-Vision Project is called. To obtain vision points, call Get Vision Result or Get Mech-Vision Custom Output Data. To obtain waypoints, call Get Planned Path in Mech-Vision.

  • The default maximum number of vision points or waypoints that the vision system sends at a time is 20. To modify the default maximum number of poses to obtain each time as needed, go to Robot Communication Configuration  Next  Advanced Settings in the toolbar of Mech-Vision. The upper limit is 30.

set number

.sendpos_type

This parameter specifies the way in which the real robot pose is sent to the Mech-Vision project. Valid values: 0, 1, 2, and 3. The following table describes the details.

.sendpos_type Description Applicable scenario

0

The command does not send the robot pose data to the Mech-Vision project.

This setting is recommended when the camera is mounted in the Eye To Hand method. If the Path Planning Step is used in the Mech-Vision project, the starting point of the planned path will be the Home point set in the path planning tool.

1

The robot joint positions and flange pose must be input to the Mech-Vision project.

This setting is recommended when the camera is mounted in the Eye In Hand method. Applicable for most robot types except gantry robots.

2

The robot flange pose must be input to the Mech-Vision project.

This setting is recommended when the camera is mounted in the Eye In Hand method. The robot has the flange pose but no joint positions, such as a gantry robot.

3

This command sends custom joint positions to the Mech-Vision project.

This setting is recommended when the camera is mounted in the Eye To Hand method, and the Mech-Vision project contains the Path Planning Step, whose starting point needs to be set at the robot side.

.#start_vis

This parameter specifies the custom joint position data.

  • If .sendpos_type is set to 3, the custom joint position data is sent to the Path Planing Step of the Mech-Vision project as the starting waypoint.

  • If .sendpos_type is set to a parameter value other than 3, this parameter can be set to #start_vis.

Example

CALL mm_start_vis(1,1,1,#start_vis)

In the preceding example, the Mech-Vision project whose ID is 1 is run, and one vision point is expected to be returned by the Mech-Vision project. At the same time, the robot sends the current joint position and flange pose data to the Mech-Vision project.

Get Vision Result

Command

This command obtains vision result, namely, a series of vision points, from Mech-Vision. The object pose of the vision point (namely, the output of the poses port of the Procedure Out Step) will be automatically converted to the robot’s TCP by the vision system. The process is as follows.

get tcp
  1. Convert the object pose from a quaternion to Euler angles.

  2. Rotate the object’s pose around the X-axis by 180° to orient its Z-axis downward.

    convert tcp
  3. Add the vertical offset to fit the base point defined by the robot manufacturer.

    increase height

Calling Sequence

This command should be called after Run Mech-Vision Project. After you call this command, call Store vision result or planned path (TCP-typed pose data) to access pose data.

Command Format

mm_get_visdata(.job,.pos_num,.ret)

Input Parameters

.job

This parameter specifies the Mech-Vision project ID. You can view the project ID of a Mech-Vision project in the Project List section of Mech-Vision. The project ID is the number before the project name.

Output Parameters

.pos_num

This parameter stores the number of vision points returned by Mech-Vision.

.ret

This parameter stores the status code of this command. If the command is successfully executed, the status code is 1100. If a command fails to be called, a specific error code is returned. For details, see Status Codes and Troubleshooting.

By default, after the robot sends this command, the vision system returns the result in 10 seconds. If the vision system fails to return any result in 10 seconds, a timeout error code is returned. To modify the default timeout period as needed, go to Robot Communication Configuration  Next  Advanced Settings in the toolbar of Mech-Vision.

set vis time

Example

CALL mm_get_visdata(1,posnum,statuscode)

In the preceding example, the vision result of the Mech-Vision project with an ID of 1 is returned, the vision point quantity is stored in posnum, and the command execution status code is stored in statuscode.

Store vision result or planned path (TCP-typed pose data)

Command

This command stores the TCP data, label, and velocity of the vision point or waypoint in the variables.

Command Format

mm_get_pose(.index,.&targetpos,.label,.speed)

Input Parameters

.index

This parameter specifies the index of the vision point or waypoint. The TCP data, label, and velocity of the vision point or waypoint that corresponds to the index are stored in the variables. Indexes start with 1.

Output Parameters

.&targetpos

This parameter stores the TCP data of the vision point or waypoint that corresponds to the index. The & sign indicates that the parameter value is TCP data.

.label

This parameter stores the label of the vision point or waypoint that corresponds to the index.

.speed

This parameter stores the velocity of the vision point or waypoint that corresponds to the index.

Example

CALL mm_get_pose(1,.&pt[1],pt_label[1],pt_speed[1])

In the preceding example, the TCP data of the first vision point or waypoint is stored in pt[1], the label is stored in pt_label[1], and the velocity is stored in pt_speed[1].

Store Planned Path (joint position-typed pose data)

Command

This command stores the joint positions, label, and velocity of the waypoint in the variables.

Command Format

mm_get_jps(.index,.#targetpos,.label,.speed)

Input Parameters

.index

This parameter specifies the index of the waypoint. The joint positions, label, and velocity of the waypoint that corresponds to the index are stored in the variables. Indexes start with 1.

Output Parameters

.#targetpos

This parameter stores the joint positions of the waypoint that corresponds to the index. The # sign indicates that the parameter value is joint position data.

.label

This parameter stores the label of the waypoint that corresponds to the index.

.speed

This parameter stores the velocity of the waypoint that corresponds to the index.

Example

CALL mm_get_jps(1,.#pt[1],pt_label[1],pt_speed[1])

In the preceding example, the joint positions of the first waypoint are stored in #pt[1], the label is stored in pt_label[1], and the velocity is stored in pt_speed[1].

Switch Mech-Vision parameter recipe

Command

This command triggers Mech-Vision to switch the parameter recipe used by the project. The image below shows how to manually switch the parameter recipe for a Mech-Vision project. For details, see the parameter recipe guide.

set recipe

Calling Sequence

This command should be called before Run Mech-Vision Project.

Command Format

mm_switch_model(.job,.model_number)

Input Parameters

.job

This parameter specifies the Mech-Vision project ID. You can view the project ID of a Mech-Vision project in the Project List section of Mech-Vision. The project ID is the number before the project name.

.model_number

This parameter specifies the parameter recipe ID in the Mech-Vision project. For information about how to view the parameter recipe ID, see View the Parameter Recipe ID.

Example

CALL mm_switch_model(1,1)

In the preceding example, the parameter recipe of the Mech-Vision project whose ID is 1 is switched to recipe 1.

Get Planned Path in Mech-Vision

Command

This command obtains the path planned by the Mech-Vision project as a series of waypoints. The path is planned by the path planning tool, which you may enter by clicking Open the editor as shown in the image below. For details, see Path Planning.

Set the Port Type parameter of the Procedure Out Step in Mech-Vision to Predefined (robot path).
get plan path step

Calling Sequence

This command should be called after Run Mech-Vision Project. After you call this command, call Store vision result or planned path (TCP-typed pose data) or Store Planned Path (joint position-typed pose data) to access pose data.

Command Format

mm_get_vispath(.job,.getpos_type,.pos_num,.vispos_num,.ret)

Input Parameters

.job

This parameter specifies the Mech-Vision project ID. You can view the project ID of a Mech-Vision project in the Project List section of Mech-Vision. The project ID is the number before the project name.

.getpos_type

This parameter specifies the type of waypoint poses to be obtained. The parameter value can be set to 1 or 2.

Output Parameters

.pos_num

This parameter stores the number of waypoints returned by the vision system. By default, the vision system can send 20 waypoints at most. As such, the maximum default value of this parameter is 20. To modify the default maximum number of poses to obtain each time as needed, go to Robot Communication Configuration  Next  Advanced Settings in the toolbar of Mech-Vision. The upper limit is 30.

set number
Before you call Get Planned Path in Mech-Vision, set .pos_num_need of Run Mech-Vision Project to 0 to reduce the number of Get Planned Path in Mech-Vision calls. If .pos_num_need of Run Mech-Vision Project is set to 1, only one waypoint is obtained each time you call Get Planned Path in Mech-Vision. You need to call Command 105 for several times to obtain all waypoints.

.vispos_num

The position ID of the Vision Move waypoint corresponding to the Vision Move step of the path planning tool in the path. If the waypoint does not exist in the path, the petameter value is 0.

If the planned path consists of the following waypoints in sequence: Fixed-Point Move_1, Fixed-Point Move_2, Vision Move, and Fixed-Point Move_3, the position ID of the Vision Move waypoint is 3.

.ret

This parameter stores the status code of this command. If the command is successfully executed, the 1103 status code is returned. If a command fails to be called, a specific error code is returned. For details, see Status Codes and Troubleshooting.

By default, after the robot sends this command, the vision system returns the result in 10 seconds. If the vision system fails to return any result in 10 seconds, a timeout error code is returned. To modify the default timeout period as needed, go to Robot Communication Configuration  Next  Advanced Settings in the toolbar of Mech-Vision.

set vis time

Example

CALL mm_get_vispath(2,2,posnum,vis_index,statuscode)

In the preceding example, the planned path of the 2 Mech-Vision project is returned, the waypoints of the path are stored in the TCP format, the number of waypoints is stored in posnum, the position IDs of Vision Move waypoints in the planned path are stored in vis_index, and the command execution status code is stored in statuscode.

Get Mech-Vision Custom Output Data

Command

This command obtains data from the custom port(s) of the Procedure Out Step in Mech-Vision. One command call saves all port data of the Procedure Out Step to robot memory.

Select the Procedure Out step, set Port Type to Custom, and then click Open the editor to go to the custom port configuration window. The Customized Keys section of the window displays custom port names, such as customeData1 and customeData2 as shown in the following figure.

  1. Data output from Predefined Keys, such as poses, labels, sizes, offsets, is not custom data.

  2. You must set Port Type of the Procedure Out step to Custom and select the poses port in the Predefined Keys section in Mech-Vision.

custom data

Calling Sequence

This command should be called after Run Mech-Vision Project. After you call this command, call mm_get_pose to obtain the pose data, label, and velocity of vision points.

Command Format

mm_get_dydata(.job,.pos_num,.count,.ret)

Input Parameters

.job

This parameter specifies the Mech-Vision project ID. You can view the project ID of a Mech-Vision project in the Project List section of Mech-Vision. The project ID is the number before the project name.

Output Parameters

.pos_num

This parameter stores the number of vision points returned by Mech-Vision.

.count

This parameter stores the number of custom elements.

The custom number of elements indicates the total number of elements in the data output of all custom ports. For example, the following table displays the output data of the ports of the Procedure Out step. customData1 and customData2 are custom ports, with 3 and 2 columns in their respective output data. Therefore, the number of elements in custom output data is 5 (3 + 2).

Port name

poses

labels

customData1

customData2

Output data

[

[0, 0, 0, 1, 0, 0, 0],
[0, 0, 0, 1, 0, 0, 0]

]

[

"0",
"1"

]

[

[0, 0, 1],
[1, 0, 0]

]

[

[0, 0],
[1, 1]

]

Number of rows (i.e. number of items in the list)

2

2

2

2

Number of columns (i.e. number of elements in each item of the list)

7

1

3

2

The custom output data obtained by this command is stored in two-dimensional array vis_custom_data[]. For example, [0, 0, 1] of the customData1 port is stored in vis_custom_data[1,1], vis_custom_data[1,2], and vis_custom_data[1,3] respectively and [0, 0] of the customData2 port is stored in vis_custom_data[1,4] and vis_custom_data[1,5] respectively.

.ret

This parameter stores the status code of this command. If the command is successfully executed, the status code is 1100. If a command fails to be called, a specific error code is returned. For details, see Status Codes and Troubleshooting.

Example

CALL mm_get_dydata(2,pos_num,count,statuscode)

In the preceding example, the custom data of the Mech-Vision 2 project is obtained, the number of vision points is stored in pos_num, and the status code of the Custom number of data items are stored as count. command are stored in statuscode.

Get Gripper DO List

Command

This command obtains the control signal list for the multi-section vacuum gripper from the Mech-Vision or Mech-Viz project. This command returns 64 DO signals. The valid DO signal is a non-negative integer, ranging from 0 to 999. -1 is an invalid DO signal that serves as a placeholder. The robot applies the DO signals obtained by Set Gripper DO List as the tool.

For example, valid DO signals in the table below are 1, 3, 5, and 6, which means that the robot will set the values of these DO signals to ON.

1st

2nd

3rd

4th

5th

6th

7th

8th

63rd

64th

1

3

5

6

-1

-1

-1

-1

-1

-1

You should configure DO signals before calling this command.

  • Configure DO signals in the Mech-Vision project

    Select the Path Planning Step, click Open the editor in the step parameter panel, and then double-click the name of the robot tool. In the pop-up window, select Depalletizing vacuum gripper for Tool type, click Configure depalletizing vacuum gripper, and then configure DO signals according to needs.

    sucker vis
  • Configure DO signals and the Set DO Step in the Mech-Viz project

    • In Mech-Viz, double-click the tool name, select Depalletizing vacuum gripper for Tool type, click Configure depalletizing vacuum gripper, and then configure the DO signal values according to needs.

      sucker viz
    • Configure the Set DO Step

      • The Set DO Step should be after the Vision Move Step.

      • Select Standard Interface for Receiver.

      • In the Operation Mode area, select Visual Move for the Source parameter, and select the Vision Move Step that the Set DO Step is connected to for the Select Vision Move parameter. In the image below, Vision Move_1 is selected.

        get do

Calling Sequence

Command Format

mm_get_dolist(.resource)

Input Parameters

.resource

This parameter specifies the source of the DO signal list. Value range: 0 to the largest positive integer.

  • 0: Get DO signal list from Mech-Viz.

  • A positive integer: Get DO signal list from Mech-Vision. The positive integer is the Mech-Vision project ID.

Example

CALL mm_get_dolist(0)

This example obtains the DO signal list from Mech-Viz and stores it in the robot memory.

Set Gripper DO List

Command

This command applies the obtained gripper DO signals as the tool.

Calling Sequence

This command should be called after Get Gripper DO List.

Command Format

mm_set_dolist()

Example

CALL mm_get_vizdata(2,posnum,vis_index,statuscode) ;receive path
CALL mm_get_dolist(0) ;receive DO from viz
CALL mm_get_pose(vis_index,pt1,label1,speed1) ; save the pick point to pt1
LAPPRO pt1,200
LMOVE pt1 ;move to pick point
CALL mm_set_dolist ;turn on DO for picking
twait 1 ;wait for gripping
LDEPART 200

In the preceding example, after the robot moves to the Vision Move waypoint, mm_set_dolist is called to set the specific DO signals of the gripper to ON.

Run Mech-Viz project

Command

This command triggers the Mech-Viz project to run. Mech-Viz plans the robot’s motion path based on the vision result output by Mech-Vision.

Right-click the project name in the project resource panel in Mech-Viz and select Autoload Project.

Calling Sequence

You should set Step parameters before starting a Mech-Viz project. Therefore, call Read Mech-Viz Step Parameter or Set Mech-Viz Step Parameter before calling Run Mech-Viz project.

Command Format

mm_start_viz(.sendpos_type,.#start_viz)

Input Parameters

.sendpos_type

This parameter specifies the way in which the real robot pose is sent to the Mech-Viz project. Valid values: 0, 1, and 2. The following table describes the details.

Robot pose type Description Applicable scenario

0

The command does not need to send the robot pose to the Mech-Viz project. The simulated robot in Mech-Viz moves from the initial pose (joint positions = [0, 0, 0, 0, 0, 0]) to the first waypoint.

This setting is recommended when the camera is mounted in the Eye To Hand method.

1

In this command, the robot sends its current joint positions and flange pose to the Mech-Viz project. The simulated robot in Mech-Viz moves from the input joint positions to the first waypoint.

This setting is recommended when the camera is mounted in the Eye In Hand method.

2

In this command, the robot sends the joint positions of a teaching point (the custom joint positions), instead of the current joint positions, to the Mech-Viz project. The Mech-Viz project uses the joint positions to plan the next path in advance while the robot is not in the camera capture region, as shown below. The simulated robot in Mech-Viz moves from the input joint positions to the first waypoint.

This setting is recommended when the camera is mounted in the Eye To Hand method.

Why robot pose type 2 is recommended when the camera is mounted in the Eye To Hand method?

In the Eye To Hand method, the camera can perform image capturing for the next round of path planning before the robot returns to the image capture region and picking region, thus shortening the cycle time. The image below demonstrates how a robot works in the placing region.

If .sendpos_type is set to 1, the robot will send the current pose to Mech-Viz. It is possible that the real robot moves to other positions before reaching the first waypoint. However, the simulated robot moves directly to the first waypoint of the Mech-Viz project from the pose sent by the robot. Consequently, there may be a mismatch between the paths of the real robot and simulated robot. This mismatch can potentially lead to unpredicted safety hazards, especially if collision is detected in the path of the simulated robot.

On the other hand, if .sendpos_type is set to 2, the robot will send the image-capturing pose set by teaching to Mech-Viz. Thus, the real robot can trigger the next round of path planning in Mech-Viz when the real robot is in the image-capturing region and the cycle time can be shortened.

In conclusion, robot pose type should be set to 2 for projects in the Eye To Hand method.

robot example

.#start_viz

This parameter specifies the custom joint position data.

  • If .sendpos_type is set to 2, the custom joint position data is sent to the Mech-Viz project as the starting waypoint for planning.

  • If .sendpos_type is set to a parameter value other than 2, this parameter can be set to #start_viz.

Example

CALL mm_start_viz(1,#start_viz)

In the preceding example, the joint position data and flange pose of the robot are input to the Mech-Viz project for the Mech-Viz project to run.

Set Exit Port for Branch by Msg Step in Mech-Viz

Command

This command sets the exit port for the Branch by Msg Step. When the next Step is a Branch by Msg Step, the Mech-Viz project will wait for this command to specify the exit port.

set branch

Calling Sequence

This command should be called after Run Mech-Viz project.

Command Format

mm_set_branch(.branch_num,.exit_num)

Input Parameters

.branch_num

This parameter specifies the Step ID of the Branch by Msg Step. The value is a positive integer. The Step ID is displayed in the Step parameter panel. For example, the Step ID of the Step in the image above is 1.

.exit_num

This parameter specifies the exit port ID of the Branch by Msg Step. The value is a positive integer. When the parameter value is set to N, the Mech-Viz project exits from the port with an ID of N-1 of the Branch by Msg Step.

Example

CALL mm_set_branch(1,3)

In the preceding example, the Mech-Viz project with an ID of 1 exits from the port with an ID of 2 of the Branch by Msg Step.

Set Current Index in Mech-Viz

Command

This command sets the value of the Current Index parameter of index-type Steps. Steps that include the Index section include Move by Grid, Move by List, Custom Pallet Pattern, and Predefined Pallet Pattern.

set index

Calling Sequence

Index-type Steps are often preceded by a Branch by Msg Step. The robot should call commands in this order: Run Mech-Viz project, Set Current Index in Mech-Viz, and Set Exit Port for Branch by Msg Step in Mech-Viz. This is to ensure that Mech-Viz has enough time to set the Current Index value.

Command Format

mm_set_index(.skill_num,.index_num)

Input Parameters

.skill_num

This parameter specifies the Step ID of the Index-type Step. The value is a positive integer. The Step ID is displayed in the Step parameter panel. For example, the Step ID of the Step in the image above is 3.

.index_num

This parameter specifies the current index for a Index-type Step. The value is a positive integer. When this parameter value is set to N, the current index of the corresponding Step is N-1.

Example

CALL mm_set_index(2,10)

In the preceding example, the current index of the Step with an ID of 2 of the Mech-Viz project is 9.

Get Planned Path in Mech-Viz

Command

This command obtains the path planned by the Mech-Viz project as a series of waypoints.

Waypoint: Each point that the robot reaches when moving along the planned path. A waypoint has information including the robot pose, label, motion type, and velocity. Waypoints can be divided into two categories:

  • Vision Move waypoints, which refer to the waypoints corresponding to the Vision Move Step.

  • Non-Vision Move waypoints, which refer to the waypoints corresponding to Move-type Steps other than the Vision Move Step.

Calling Sequence

This command should be called after Run Mech-Viz project. After you call this command, call Store vision result or planned path (TCP-typed pose data) or Store Planned Path (joint position-typed pose data) to access pose data.

Command Format

mm_get_vizdata(.getpos_type,.pos_num,.vispos_num,.ret)

Input Parameters

.getpos_type

This parameter specifies the type of waypoint poses to be obtained. The parameter value can be set to 1 or 2.

Output Parameters

.pos_num

This parameter stores the number of waypoints that are returned by the vision system. By default, the vision system sends no more than 20 waypoints at a time. Therefore, the maximum default value of this parameter is 20. To modify the default maximum number of poses to obtain each time as needed, go to Robot Communication Configuration  Next  Advanced Settings in the toolbar of Mech-Vision. The upper limit is 30.

set number

.vispos_num

The position ID of the Vision Move waypoint (i.e., the waypoint corresponding to the Vision Move step in the Mech-Viz project) in the path. If the waypoint does not exist in the path, the petameter value is 0.

If the planned path consists of the following waypoints in sequence: Fixed-Point Move_1, Fixed-Point Move_2, Vision Move, and Fixed-Point Move_3, the position ID of the Vision Move waypoint is 3.

.ret

This parameter stores the status code of this command. If the command is successfully executed, the status code is 2100. If a command fails to be called, a specific error code is returned. For details, see Status Codes and Troubleshooting.

By default, after the robot sends this command, the vision system returns the result in 10 seconds. If the vision system fails to return any result in 10 seconds, a timeout error code is returned. To modify the default timeout period as needed, go to Robot Communication Configuration  Next  Advanced Settings in the toolbar of Mech-Vision.

set viz time

Example

CALL mm_get_vizdata(2,posnum,vis_index,statuscode)

In the preceding example, the planned path of the Mech-Viz project is obtained, the pose type of the waypoints is TCP, the number of waypoints is stored in posnum, the position IDs of Vision Move waypoints in the planned path are stored in vis_index, and the status code of the command are stored in statuscode.

Get Vision Move Output Data or Custom Output Data

Command

This command obtains Vision Move output data from the Mech-Vision project, or the Vision Move output data or custom output data from the Mech-Viz project. One command call stores all data in robot memory.

  • Mech-Vision projects: Vision Move data refers to data output by the Vision Move Step in the path planning tool, which you may enter from the Path Planning Step. Vision Move data includes labels of picked workobjects, number of picked workobjects, number of workobjects to be picked this time, edge or corner ID of vacuum gripper, TCP offset, orientation of workobject group, orientation of workobject, and dimensions of workobject group.

  • Mech-Viz projects:

    • Vision Move data refers to data output by the Vision Move Step in Mech-Viz, including the labels of picked workobjects, number of picked workobjects, number of workobjects to be picked this time, edge or corner ID of vacuum gripper, TCP offset, orientation of workobject group, orientation of workobject, and dimensions of workobject group.

    • Custom output data refers to data output by the custom port(s) of the Procedure Out Step in Mech-Vision and then forwarded by Mech-Viz. Select the Procedure Out step, set Port Type to Custom, and then click Open the editor to go to the custom port configuration window. The Customized Keys section of the window displays custom port names, such as customeData1 and customeData2 as shown in the following figure.

  1. Data output from Predefined Keys, such as poses, labels, sizes, offsets, is not custom data.

  2. You must set Port Type of the Procedure Out step to Custom and select the poses port in the Predefined Keys section in Mech-Vision.

custom data

Calling Sequence

This command should be called after Run Mech-Vision Project or Run Mech-Viz project.

Command Format

mm_get_plandata(.resource,.getpos_type,.pos_num,.vispos_index,.ret)

Input Parameters

.resource

This parameter specifies the source of Vision Move planned data. Value range: 0 to the largest positive integer.

  • 0: Get Vision Move data from Mech-Viz.

  • A positive integer: Get Vision Move data from Mech-Vision. The positive integer is the Mech-Vision project ID.

.getpos_type

This parameter specifies the expected returned data format.

  • If .resource is set to 0, the valid value range of .getpos_type is 1 to 4.

    Parameter value of .getpos_type Description of expected returned data (Each field is explained below. If the Mech-Vision project does not have a custom port, no elements of custom output data are returned.)

    1

    Pose (joint positions), motion type, tool ID, velocity, element 1 in custom output data, … element N in custom output data

    2

    Pose (TCP), motion type, tool ID, velocity, element 1 in custom output data, … element N in custom output data

    3

    Pose (joint positions), motion type, tool ID, velocity, Mech-Viz Vision Move data, element 1 in custom output data, … element N in custom output data

    4

    Pose (TCP), motion type, tool ID, velocity, Mech-Viz Vision Move data, element 1 in custom output data, … element N in custom output data

  • If .resource is set to a positive integer, .getpos_type can be set to 1 to 2.

    Parameter value of .getpos_type Description of expected returned data (Each field is explained below.)

    1

    Pose (joint positions), motion type, tool ID, velocity, Mech-Vision Vision Move data

    2

    Pose (TCP), motion type, tool ID, velocity, Mech-Vision Vision Move data

Pose

The pose of a waypoint can be joint positions (measured in degrees) or TCP (measured in millimeters for three-dimensional coordinates and in degrees for Euler angles) of the robot.

Motion type

The motion type of the robot. Valid values: 1 and 2.

  • 1: Joint motion (MOVEJ)

  • 2: Linear motion (MOVEL)

Tool ID

The ID of the tool to be used at this waypoint. A value of -1 means that no tool is used at this waypoint.

Velocity

The meaning of velocity varies based on the project type.

  • For Mech-Vision projects, velocity indicates the Simulation Speed value in the path planning tool, in the form of percentage.

  • For Mech-Viz projects, velocity, represented in percentage, indicates the velocity set for the motion-type Steps multiplied by the global velocity set in Mech-Viz.

Vision Move data

Data output by the Vision Move Step in Mech-Vision or Mech-Viz, including labels of picked workobjects, number of picked workobjects, number of workobjects to be picked this time, edge or corner ID of vacuum gripper, TCP offset, orientation of workobject group, orientation of workobject, and dimensions of workobject group.

Name Description Number of Elements

Labels of picked workobjects

A label consists of 10 integers. The default value is ten 0s.

10

Number of picked workobjects

The total number of picked workobjects.

1

The number of workobjects to be picked this time.

The number of workobjects to be picked this time.

1

Edge or corner ID of vacuum gripper

The ID of the edge or corner used to pick workobjects this time.

1

TCP offset

The XYZ offset between the center of the workobject group and the tool pose center.

3

Orientation of workobject group

The relative position between the workobject group and the length of the vacuum gripper. The value is 0 or 1, where 0 stands for parallel and 1 for vertical.

1

Orientation of workobject

The relative position between the length of a workobject and that of the vacuum gripper. The value is 0 or 1, where 0 stands for parallel and 1 for vertical.

1

Dimensions of workobject group

The length, width, and height of the workobject group to be picked this time.

3

Elements in custom output data

The data of all custom ports of a single vision point. For example, data output from ports of the Procedure Out Step is presented in the following table. The elements in custom output data of the first vision point are [0, 0, 1] and [0, 0]; and the elements in custom output data of the second vision point are [1, 0, 0] and [1, 1].

Port name

poses

labels

customData1

customData2

Output data

[

[0, 0, 0, 1, 0, 0, 0],
[0, 0, 0, 1, 0, 0, 0]

]

[

"0",
"1"

]

[

[0, 0, 1],
[1, 0, 0]

]

[

[0, 0],
[1, 1]

]

First vision point

[0, 0, 0, 1, 0, 0, 0]

0

[0, 0, 1]

[0, 0]

Second vision point

[0, 0, 0, 1, 0, 0, 0]

1

[1, 0, 0]

[1, 1]

Output Parameters

.pos_num

This parameter stores the number of waypoints that are returned by the vision system.

.vispos_index

The position ID of the Vision Move waypoint (i.e., the waypoint corresponding to the Vision Move step in the Mech-Viz project) in the path. If the waypoint does not exist in the path, the petameter value is 0.

If the planned path consists of the following waypoints in sequence: Fixed-Point Move_1, Fixed-Point Move_2, Vision Move, and Fixed-Point Move_3, the position ID of the Vision Move waypoint is 3.

.ret

This parameter stores the status code of this command. If the command successfully obtained Vision Move output data of the Mech-Vision project, the status code is 1103. If the command successfully obtained the Vision Move output data or custom output data from the Mech-Viz project, the status code is 2100. If a command fails to be called, a specific error code is returned. For details, see Status Codes and Troubleshooting.

If this command is called successfully, the returned data is stored in variables as shown below.

Value Variable (both i and j start from 1)

Joint positions (J1 - J6)

vis_pos_j1[i],vis_pos_j2[i],vis_pos_j3[i],vis_pos_j4[i],vis_pos_j5[i],vis_pos_j6[i]

TCP (XYZOAT)

vis_pos_x[i],vis_pos_y[i],vis_pos_z[i],vis_pos_o[i],vis_pos_a[i],vis_pos_t[i]

Velocity

vis_pos_spd[i]

Motion type

vis_pos_type[i]

Tool ID

vis_pos_tool[i]

Vision Move waypoint or not

If vis_pos_vismove[i] is 1, the waypoint is a Vision Move waypoint. Otherwise, it is a non-Vision Move waypoint.

Custom output data of Mech-Vision

vis_custom_data[i,j]

  • Only when vis_pos_vismove[i] is 1, vis_custom_data[i,j] has a value.

  • The j value is the number of elements in custom output data and is stored in num_customdata[i].

Vision Move data of Mech-Vision or Mech-Viz

vis_plan_result[i,j]

Only when vis_pos_vismove[i] is 1, vis_plan_result[i,j] has a value.

Content of the vis_plan_result[i,j] variable is explained in the table below.

Value Description Variable

Labels of picked workobjects

A label consists of 10 integers. The default value is ten 0s.

vis_plan_result[i,1] ~ vis_plan_result[i.10]

Number of picked workobjects

The total number of picked workobjects.

vis_plan_result[i,11]

Number of workobjects to be picked this time

Number of workobjects to be picked this time

vis_plan_result[i,12]

Edge or corner ID of vacuum gripper

The ID of the edge or corner used to pick workobjects this time.

vis_plan_result[i,13]

TCP offset

The XYZ offset between the center of the workobject group and the tool pose center.

vis_plan_result[i,14] ~ vis_plan_result[i,16]

Orientation of workobject group

The relative position between the workobject group and the length of the vacuum gripper. The value is 0 or 1, where 0 stands for parallel and 1 for vertical.

vis_plan_result[i,17]

Orientation of workobject

The relative position between the length of a workobject and that of the vacuum gripper. The value is 0 or 1, where 0 stands for parallel and 1 for vertical.

vis_plan_result[i,18]

Dimensions of workobject group

The length, width, and height of the workobject group to be picked this time.

vis_plan_result[i,19] ~ vis_plan_result[i,21]

Example

CALL mm_get_plandata(0,4,pos_num,vispos_index,statuscode)

In the preceding example, the Vision Move output data or custom output data is obtained from the Mech-Viz project. The number of waypoints is stored in pos_num, the position IDs of Vision Move waypoints in the path are stored in vispos_index, and the status codes of the command are stored in statuscode.

Read Mech-Viz Step Parameter

Command

This command reads the parameter value of a specific Step in the Mech-Viz project.

Calling Sequence

This command should be called before Run Mech-Viz project.

Command Format

mm_get_property(.group_num,.return_value)

Input Parameters

.group_num

This parameter corresponds to the Config ID field defined in the property_config file.

From the toolbar of Mech-Vision, go to Robot Communication Configuration  Next  Advanced Settings. Click Property Configuration to open the property_config file.

get property config

Before calling this function, users should define a Config ID and its corresponding Step ID and parameter key name in the following format in the property_config file.

read, Config ID, Step ID, parameter key name

read

Indicates that this line is used to read the parameter value of a Step.

Config ID

Specifies a unique ID, which in a positive integer. One Config ID corresponds to only one parameter value of a Step. To read multiple parameter values, you should set different Config IDs.

Step ID

The Step ID of the Step whose parameter is to be read.

Parameter key name

Specifies the key name of the parameter whose value the robot requires to read.

  • User can check the parameter key name in the Key Query Tool. From the menu bar of Mech-Viz, go to Tools  Key Query Tool. Click a Step icon, and all key names of the Step will be displayed in the middle column. Each key name corresponds to a Step parameter name displayed in the parameter panel. You can also click a key name and check its corresponding parameter name in the “Details” panel.

    parameter key name
  • In the property_config file, lines starting with “#” are comments, which will not be executed by the program.

  • Remember to save the file after editing, and then restart the interface service on the toolbar of Mech-Vision.

The property_config file can have multiple read commands. The Config ID in these commands must be different.

Output Parameters

.return_value

This parameter stores the parameter value of the Step.

Example

In the line below, 5 is the Config ID; 3 is the Step ID; and xCount is the parameter key name. Add this line to the property_config file.

read,5,3,xCount

When the robot sends the command below, the robot receives the value of the parameter whose key name is xCount.

CALL mm_get_property(5,param_value)

In the preceding example, the value of the xCount parameter of the Step with an ID of 3 of the Mech-Viz project is stored in param_value.

Set Mech-Viz Step Parameter

Command

This command sets parameter value of a Step in the Mech-Viz project.

Calling Sequence

This command should be called before Run Mech-Viz project.

Command Format

mm_set_property(.group_num)

Input Parameters

.group_num

This parameter corresponds to the Config ID field defined in the property_config file.

From the toolbar of Mech-Vision, go to Robot Communication Configuration  Next  Advanced Settings. Click Property Configuration to open the property_config file.

get property config

Before sending this command, users should define a Config ID and its corresponding Step ID, parameter key name and parameter value in the following format in the property_config file.

write, Config ID, Step ID, parameter key name, parameter value

write

Indicates that this line is used to set the parameter value of a Step.

Config ID

Specifies an ID, which is a positive integer and can be used repeatedly.

Step ID

Specifies the Step whose parameter value the robot requires to read.

Parameter key name

Specifies the key name of the parameter whose value the robot requires to set.

Parameter value

Specifies the value that the robot sets for the parameter.

  • The property_config file can contain more than one “write” command, and these commands can use a Config ID repeatedly. That is, one Config ID can be used to set values for multiple parameters.

  • User can check the parameter key name in the Key Query Tool. From the menu bar of Mech-Viz, go to Tools  Key Query Tool. Click a Step icon, and all key names of the Step will be displayed in the middle column. Each key name corresponds to a Step parameter name displayed in the parameter panel. You can also click a key name and check its corresponding parameter name in the “Details” panel.

    parameter key name
  • In the property_config file, lines starting with “#” are comments, which will not be executed by the program.

  • Remember to save the file after editing, and then restart the interface service on the toolbar of Mech-Vision.

Example

In the line below, 1 is the Config ID and 3 is the Step ID. xOffset, yOffset and zOffset are parameter key names; and 10, 20 and 30 are their respective values. Add this line to the property_config file.

write,1,3,xOffset,10
write,1,3,yOffset,20
write,1,3,zOffset,30

When the robot sends the command below, Mech-Viz sets the values of the parameters whose key names are xOffset, yOffset and zOffset respectively to 10, 20 and 30.

CALL mm_set_property(1)

In the preceding example, the values of the parameters whose key names are xOffset, yOffset and zOffset are respectively set to 10, 20, and 30.

Input Object Dimensions to Mech-Vision Project

Command

This command dynamically inputs object dimensions into the Mech-Vision project. The object dimensions are the values of the Box Size Settings parameters in the Read Object Dimensions Step.

read object dimensions

Calling Sequence

This command should be called before Run Mech-Vision Project.

Command Format

mm_set_boxsize(.job,.length,.width,.height)

Input Parameters

.job

This parameter specifies the Mech-Vision project ID. You can view the project ID of a Mech-Vision project in the Project List section of Mech-Vision. The project ID is the number before the project name.

.length, .width, and .height

The preceding three parameters sequentially input the length, width, and height of the object to the Mech-Vision project. The length, width, and height are measured in millimeters (mm). These values are read by the Read Object Dimensions Step and set for the parameters Length on X-axis, Length on Y-axis and Length on Z-axis.

Example

CALL mm_set_boxsize(1,500,300,200)

In the preceding example, the length, width, and height of the object of the Read Object Dimensions Step in the Mech-Vision project are 500 mm, 300 mm, and 200 mm respectively.

Get Message from Notify Step

Command

When the Mech-Vision project or Mech-Viz project is executing the Notify Step, the vision system returns the message predefined in the Notify Step.

Before sending this command, complete the following settings:

  • For a Notify Step in the Mech-Vision project:

    1. Connect the Notify Step to the right side of another Step. The Procedure Out Step is used in the example in the image below.

      notify 1
    2. Select Trigger Control Flow Given Output in the parameter panel of the Procedure Out Step.

      notify 5
    3. In the parameter panel of the Notify Step, enter Standard Interface Notify (a required value) for Service Name. Enter a positive integer for Message, for example, 1001.

      notify 2
  • For a Notify Step in the Mech-Viz project:

    1. Connect the Notify Step to a proper Step in the workflow.

      notify 3
    2. In the parameter panel of the Notify Step, select Standard Interface. Enter a positive integer for Message, for example, 1000.

      notify 4

Calling Sequence

This command should be called after Run Mech-Vision Project or Run Mech-Viz project.

Command Format

mm_get_notify(.msg)

Output Parameters

.msg

This parameter stores the message from the Notify Step. Only integers are supported at the moment.

Example

CALL mm_get_notify(notifymsg)

In the preceding example, the message obtained from the Notify Step is stored in NotifyMsg.

Calibration

Command

This command is used for hand-eye calibration. This command must be used together with the Camera Calibration (Standard) setting to complete automatic calibration. You can find Camera Calibration (Standard) in the toolbar of Mech-Vision. For more information, see Kawasaki Automatic Calibration.

Command Format

calibrate()

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.