Kawasaki Standard Interface Commands

The Kawasaki Standard Interface provides the following subroutines:

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

  • Multiple parameters should be separated by commas.

  • All parameters should be defined as local variables.

  • Parameters can be defined as input or output parameters.

  • Input arguments can be constants, global variables or local variables; output arguments can be global variables or local variables.

This Standard Interface is over the TCP/IP protocol.

Initialize Communication

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

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

Parameters

  • Input parameters

    Name

    Description

    .ip1 - .ip4

    IP address of the IPC

    .port

    Port number of the IPC, the default is 50000

    .time_out

    Wait time in seconds before stopping connection attempt

Example

CALL mm_init_skt(192,168,1,1,50000,60)

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

Start Mech-Vision Project

mm_start_vis(.job,.pos_num_need,.sendpos_type)

This subroutine is for applications that use Mech-Vision but not Mech-Viz. It runs the corresponding Mech-Vision project to acquire and process data.

Parameters

  • Input parameters

    Name

    Description

    .job

    Mech-Vision Project ID, from 1 to 99

    Can check and adjust in Mech-Center ‣ Deployment Settings ‣ Mech-Vision

    .pos_num_need

    Number of poses for Mech-Vision to send, from 0 to 20, where 0 means “send all”.

    .sendpos_type

    Set the image capturing pose for the robot to send, from 0 to 2

    0: Do not send image capturing pose (for Eye To Hand) 1: Send image capturing pose as joint positions 2: Send image capturing pose as robot flange pose

Example

CALL mm_start_vis(1,1,1)

This example runs Mech-Vision project No. 1, and asks the project to send over 1 pose, and the robot sends its joint positions when this subroutine is called as the image capturing pose to Mech-Center.

Get Vision Result

mm_get_visdata(.job,.pos_num,.ret)

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

Parameters

  • Input parameter

    Name

    Description

    .job

    Mech-Vision Project ID, from 1 to 99

    Can check and adjust in Mech-Center ‣ Deployment Settings ‣ Mech-Vision

  • Output parameters

    Name

    Description

    .pos_num

    Variable for storing the number of received poses

    .ret

    Variable for storing status code, refer to the Status Codes

Example

CALL mm_get_visdata(1,posnum,statuscode)

This example obtains the vision result from Mech-Vision project No. 1. The number of poses received is stored in posnum, and the status code is stored in statuscode.

Start Mech-Viz Project

mm_start_viz(.sendpos_type)

This subroutine is for applications that use both Mech-Vision and Mech-Viz. It runs the corresponding 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.

Parameter

  • Input parameter

    Name

    Description

    .sendpos_type

    The initial joint positions for the simulated robot in Mech-Viz, 0 or 1

    0: Set the initial joint positions of the simulated robot to [0,0,0,0,0,0] 1: Set the initial joint positions of the simulated robot to the current joint positions of the real robot

    Note

    When the scene contains object models that obstruct the robot to move from [0,0,0,0,0,0] to the first target point, this parameter must be set to 1.

Example

CALL mm_start_viz(1)

This example runs the corresponding Mech-Viz project, and sets the initial joint positions of the simulated robot to the current joint positions of the real robot.

Get Planned Path

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

This subroutine obtains the planned path from Mech-Viz.

Parameters

  • Input parameter

    Name

    Description

    .getpos_type

    Whether Mech-Viz should send target points as joint positions or TCPs, 1 or 2

    1: Mech-Viz sends joint positions 2: Mech-Viz sends TCPs

  • Output parameters

    Name

    Description

    .pos_num

    Variable for storing the number of received target points

    .vispos_num

    Variable for storing the position of the first visual_move target point in the path

    Example path: move-1, move-2, visual_move-3, move-3, visual_move-2 In this path, the position of the first visual_move target point is 3. If the path does not contain visual_move target point, the return value is 0.

    .ret

    Variable for storing status code, refer to the Status Codes

Example

CALL mm_get_vizdata(2,posnum,vis_index,statuscode)

This example obtains the planned path from Mech-Viz in the form of TCPs. The number of target points received is stored in posnum, the position of the visual_move target point is stored in vis_index, and the status code is stored in statuscode.

Obtain Pose

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

This subroutine stores a pose returned by Mech-Vision or a target point (as TCP) returned by Mech-Viz in the specified variable.

Parameters

  • Input parameter

    Name

    Description

    .index

    Specify the index of the pose to be stored

  • Output parameters

    Name

    Description

    .&targetpos

    Variable for storing the specified pose

    Must add “&” before the variable name to indicate the variable as transformation values

    .label

    Variable for storing the label corresponding to the specified pose

    .speed

    Variable for storing the speed corresponding to the specified pose

Example

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

This example stores the first received pose to pt[1], the corresponding label to pt_label[1], and the corresponding speed to pt_speed[1].

Obtain Joint Positions

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

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

Note

As Mech-Vision does not output joint position data, this subroutine can only be used with Mech-Viz.

Parameters

  • Input parameter

    Name

    Description

    .index

    Specify the index of the set of joint positions to be stored

  • Output parameters

    Name

    Description

    .#targetpos

    Variable for storing the specified set of joint positions

    Must add “#” before the variable name to indicate the variable as joint displacement values

    .label

    Variable for storing the label corresponding to the specified set of joint positions

    .speed

    Variable for storing the speed corresponding to the specified set of joint positions

Example

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

This example stores the first set of received joint positions to pt[1], the corresponding label to pt_label[1], and the corresponding speed to pt_speed[1].

Switch Mech-Vision Recipe

mm_switch_model(.job,.model_number)

This subroutine specifies which parameter recipe of the Mech-Vision project to use. For more information on parameter recipe, please see Parameter Recipe Configuration.

Note

  • This subroutine must be called BEFORE mm_start_vis.

  • The corresponding Mech-Vision project must have parameter recipes already configured and saved.

Parameters

  • Input parameters

    Name

    Description

    .job

    Mech-Vision Project ID, from 1 to 99

    Can check and adjust in Mech-Center ‣ Deployment Settings ‣ Mech-Vision

    .model_number

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

Example

CALL mm_switch_model(2,2)

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

Select Mech-Viz Branch

mm_set_branch(.branch_num,.exit_num)

This subroutine is used to select along which branch the Mech-Viz project should proceed. Such branching is achieved by adding branch_by_service_message Task(s) to the project. This subroutine specifies which out port such Task(s) should take.

Note

  • mm_start_viz must be called BEFORE this subroutine.

  • When the next Task to be executed in Mech-Viz is a branch_by_service_message Task, Mech-Viz will wait for this subroutine to send the out port number it should take.

  • The name of all branch_by_service_message Tasks in the Mech-Viz project must be changed to numbers between 1 and 99, and the names should be unique among all tasks in the project.

Parameters

  • Input parameters

    Name

    Description

    .branch_num

    Name of the branch_by_service_message Task, from 1 to 99

    .exit_num

    The number of the out port to take, from 1 to 99

Example

CALL mm_set_branch(1,3)

This example tells Mech-Viz to take out port 3 for the branch_by_service_message Task named 1.

Set Move Index

mm_set_index(.skill_num,.index_num)

This subroutine sets the value for the Current Index parameter of Mech-Viz Tasks. Tasks that have this parameter include move_list, move_grid, custom_pallet_pattern, and smart_pallet_pattern.

Note

  • mm_start_viz must be called BEFORE this subroutine.

  • The name of all Tasks with index parameters in the Mech-Viz project must be changed to numbers between 1 and 99, and the names should be unique among all tasks in the project.

Parameters

  • Input parameters

    Name

    Description

    .skill_num

    Name of the Task, from 1 to 99

    .index_num

    Value for the Current Index parameter when the Task is executed

Example

CALL mm_set_index(2,10)

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

Get Software Status

mm_get_status(.ret)

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

Parameter

  • Output parameter

    Name

    Description

    .ret

    Variable for storing the status code, refer to the Status Codes

Example

CALL mm_get_status(statuscode)

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

Input Object Dimensions to Mech-Vision

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

This subroutine inputs object dimensions to the Mech-Vision project.

Note

  • This subroutine must be called BEFORE mm_start_vis.

Parameters

  • Input parameters

    Name

    Description

    .job

    Mech-Vision Project ID, from 1 to 99

    Can check and adjust in Mech-Center ‣ Deployment Settings ‣ Mech-Vision

    .length

    Length of object in mm

    .width

    Width of object in mm

    .height

    Height of object in mm

Example

CALL 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

mm_get_dolist()

This subroutine obtains the planned DO Signal list for controlling multiple sections of a sectioned vacuum gripper.

Note

  • mm_get_vizdata must be called BEFORE this subroutine.

  • Please deploy the Mech-Viz project based on the template project in Mech-Center/tool/viz_project/suction_zone, and set the suction cup configuration file in the Mech-Viz project.

Parameters

No parameters.

Example

CALL mm_get_dolist

This example obtains the DO signal list planned by Mech-Viz and stores it in setdo[] array. The first array element is setdo[0] and the last is setdo[io_index-1].

Input TCP to Mech-Viz

mm_set_pos(.&pos)

This subroutine inputs TCP data to the outer_move Task.

Note

  • This subroutine must be called BEFORE mm_start_viz.

  • Please deploy the Mech-Viz project based on the template project in Mech-Centertoolviz_projectouter_move, and put the outer_move Task at a proper position in the workflow.

Parameter

  • Input parameter

    Name

    Description

    .&pos

    Variable for storing the TCP data to be sent to Mech-Viz

    Must add “&” before the variable name to indicate the variable as transformation values

Example

call mm_set_pos(&pos)

This example sends the TCP data stored in &pos to the outer_move task in the Mech-Viz project.

Calibration

calibrate()

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