Siemens PLC

..Mech-Mind Software Suite can communicate with Siemens SIMATIC S7 PLCs through the Siemens S7 Standard Interface. For setup instructions, please refer to Siemens PLC Client - TIA Portal and Siemens PLC Client - SIMATIC STEP 7.

The commands are as follows:

Command 101: Start Mech-Vision Project

This command starts the running of the Mech-Vision project, which executes image capturing, and performs vision recognition.

If the project works in the eye-in-hand mode, the robot pose for image capturing will be transmitted by this command into the project.

This command is for scenarios using only Mech-Vision.

Command Sent

Parameter

DB offset

Command code 101

2.0

Project number

8.0

Number of vision points

6.0

Robot pose type

4.0

Robot pose

12.0 (JPS) or 36.0 (flange pose)

Project number

The integer ID number of the Mech-Vision project in Mech-Center, i.e., the number shown on the left of the project path in Deployment Settings ‣ Mech-Vision in Mech-Center.

Number of vision points

The number of vision points (i.e., vision poses and their corresponding point clouds, labels, indices, etc.) to expect Mech-Vision to output.

0

Get all the vision points from the Mech-Vision project’s recognition results.

integers > 0

Get the specified number of vision points.

If the total number of vision points is smaller than the parameter value, all the available vision points will be returned.

If the total number of vision points is greater than or equal to the parameter value, vision points in the quantity of the parameter value will be returned.

Note

The command to obtain the vision points is command 102.

Robot pose type

This parameter indicates the type of the current pose of the real robot to input to Mech-Vision.

0

No robot pose needs to be transmitted by this command.

If the project works in the eye-to-hand mode, then image capturing has nothing to do with the robot’s pose, so no robot image capturing pose is needed by Mech-Vision.

1

The robot pose transmitted by this command is JPS.

2

The robot pose transmitted by this command is a flange pose.

Robot pose

This parameter is the robot pose needed when the project works in the eye-in-hand mode.

The robot pose is either JPS or flange pose, according to the setting of the parameter robot pose type.

Data Returned

Parameter

DB offset

Status code

200.0

Status code

If there is no error, status code 1102 will be returned. Otherwise, the corresponding error code will be returned.

Command 102: Get Vision Result

This command gets the vision result, i.e., vision points, after executing command 101.

Command Sent

Parameter

DB offset

Command code 102

2.0

Project numner

8.0

Project number

The integer ID number of the Mech-Vision project in Mech-Center, i.e., the number shown on the left of the project path in Deployment Settings ‣ Mech-Vision in Mech-Center.

Data Returned

Parameter

DB offset

Status code

200.0

Sending status

202.0

Number of vision points

204.0

Reserved field

/

Poses

208.0

Labels

1168.0

Note

The vision points (up to 40 vision points by default) are located at the tail of the data returned.

Status code

If there is no error, status code 1100 will be returned. Otherwise, the corresponding error code will be returned.

After executing this command, if the results from Mech-Vision have not been returned, Mech-Center will wait before sending the results to the robot. The default wait time is 10 seconds. If a timeout occurs, the timeout error status code will be returned.

Sending status

This parameter indicates whether the data returned includes newly arrived vision points.

1

The vision points in the data returned are new data.

After PLC reads all the vision point data (poses and labels), please reset this field.

Note

In Siemens PLC, by default, executing command 102 once can fetch at most 40 vision points (poses and labels) at a time. If the expected number of vision points is greater than 40, please execute command 102 multiple times.

Number of vision points

The number of vision points returned from the Mech-Vision project by executing this command this time.

Range: 0 to 40.

Reserved field

This field is not used.

The value defaults to 0.

Poses

A pose includes the Cartesian coordinates (XYZ) and Euler angles (ABC).

Labels

Each label is an integer label assigned to a pose. If in the Mech-Vision project, the labels are strings, they need to be mapped to integers before outputting from the Mech-Vision project. If there are no labels in the Mech-Vision project, the label defaults to 0.

Command 103: Switch Mech-Vision Recipe

This command switches the parameter recipe used in Mech-Vision.

In Mech-Vision, what parameter settings a Step has can be modified by switching the parameter recipe.

Parameters involved in recipe switching usually include point cloud matching model, image matching template, ROI, confidence threshold, etc.

This command needs to be used before executing command 101 which starts the Mech-Vision project.

Command Sent

Parameter

DB offset

Command code 103

2.0

Project number

8.0

Recipe numner

10.0

Project number

The integer ID number of the Mech-Vision project in Mech-Center, i.e., the number shown on the left of the project path in Deployment Settings ‣ Mech-Vision in Mech-Center.

Recipe number

The identification number of the parameter recipe to switch to, i.e., the number on the left of the parameter recipe name in Project Assistance ‣ Parameter Recipe ‣ Parameter Recipe Editor in Mech-Vision.

Data Returned

Parameter

DB offset

Status code

200.0

Status code

If there is no error, status code 1107 will be returned. Otherwise, the corresponding error code will be returned.

Command 201: Start Mech-Viz Project

This command is for scenarios using both Mech-Vision and Mech-Viz.

This command starts the running of the Mech-Viz project, calls the corresponding Mech-Vision project, and lets the Mech-Viz project plan the robot path based on the vision points from Mech-Vision.

For the Mech-Viz project that needs starting, the option Autoload needs to be checked in Mech-Viz’s interface.

Please see Example Mech-Viz Projects for Standard Interface for the description of example Mech-Viz projects.

Command Sent

Parameter

DB offset

Command code

2.0

Pose type

4.0

Robot pose

12.0

Pose type

0

The current pose of the robot is not needed by Mech-Viz and no pose will be sent.

If the project works in the eye-to-hand mode, no robot image capturing pose will be needed by the project.

In Mech-Viz, the simulated robot will move from the initial pose JPS = [0, 0, 0, 0, 0, 0] to the first target point in the planned path.

1

The robot pose will be sent to Mech-Viz and the pose sent is in JPS.

In Mech-Viz, the simulated robot will move from the input initial pose (i.e., the pose sent by this command) to the first target point in the planned path.

TCP is not supported at present.

Note

If in the scene, there are barriers that stand in the way from the initial pose JPS = [0, 0, 0, 0, 0, 0] to the first target point in the planned path, the pose type must be set to 1.

Robot pose

The current JPS of the real robot (if pose type is set to 1).

Data Returned

Parameter

DB offset

Status code

200.0

Status code

If there is no error, status code 2103 will be returned. Otherwise, the corresponding error code will be returned.

Command 202: Stop Mech-Viz Project

Stop the running of the Mech-Viz project. This command is not needed when the Mech-Viz project does not fall into an infinite loop or can be stopped normally.

Command Sent

Parameter

DB offset

Command code 202

2.0

Data Returned

Parameter

DB offset

Status code

200.0

Status code

If there is no error, status code 2104 will be returned. Otherwise, the corresponding error code will be returned.

Command 203: Select Mech-Viz Branch

This command specifies which branch the project should run along. For this command, the branching is implemented by a branch_by_service_message Task, and this command selects the branch by specifying an out port of the Task.

Before executing this command, the Mech-Viz project needs to be started by executing command 201.

When the Mech-Viz project runs to the branch_by_service_message Task, it will wait for command 203 to specify which out port of the Task, i.e., the branch, the project should run along.

Command Sent

Parameter

DB offset

Command code 203

2.0

Branching Task name

60.0

Out port number

62.0

Branching Task name

This parameter is for specifying which branch_by_service_message Task the branch selection should apply to.

The value should be an integer ([1, N])., and before running the project, the Task involved in this command should be named as an integer ([1, N]). The name should be unique in the project.

Out port number

This parameter is for specifying which out port of the specified Task, i.e., the branch, the project should run along. The value should be an integer ([1, N]).

Note

Out port number is the 1-based index of the specified out port on the Task. For example, if the specified out port is the second out port of the Task from left to right, the out port number is 2.

Data Returned

Parameter

DB offset

Status code

200.0

Status code

If there is no error, status code 2105 will be returned. Otherwise, the corresponding error code will be returned.

Command 204: Set Move Index

This command is for setting the index parameter of a Task that involves sequential or separate motions or operations.

Tasks with index parameters include move_list, move_grid, custom_pallet_pattern, smart_pallet_pattern, etc.

Before executing this command, command 201 needs to be executed to start the Mech-Viz project.

Command Sent

Parameter

DB offset

Command code 204

2.0

Task name

64.0

Index value

66.0

Task name

This parameter specifies which Task the index setting should apply to.

The value should be an integer ([1, N]), and the Task that needs index parameter setting by this command should be named as an integer ([1, N]). The name should be unique in the project.

Index value

The index parameter of the specified Task will be set to this value.

Data Returned

Parameter

DB offset

Status code

200.0

Status code

If there is no error, status code 2106 will be returned. Otherwise, the corresponding error code will be returned.

Command 205: Get Planned Path

This command gets the robot motion path planned by Mech-Viz after command 201 is executed to start the Mech-Viz project.

Note

If one of the target points in the path is not supposed to be sent to the robot, please rename the corresponding move Task by adding “_internal” to the end of the name (with an underscore; case insensitive).

Command Sent

Parameter

DB offset

Command code 205

2.0

Target point type

4.0

Target point type

This parameter specifies the type of path target points to return from Mech-Viz.

1

The target points returned should be in JPS.

2

The target points returned should be in TCP.

Data Returned

Parameter

DB offset

Status code

200.0

Sending status

202.0

Number of points

204.0

Position of “visual_move”

206.0

Target points’ poses

208.0

Target points’ labels

1168.0

Target points’ velocities

1248.0

Status code

If there is no error, status code 2100 will be returned. Otherwise, the corresponding error code will be returned.

Note

When executing this command, if Mech-Viz has not yet had the planned robot motion path (the project is still running), Mech-Center will wait. The default wait time is 10 seconds. If a timeout occurs, a timeout error code will be returned.

Sending status

This parameter indicates whether the data returned includes newly arrived target points.

1

The target points in the data returned are new data.

After PLC reads all the target point data (poses, labels, velocities), please reset this field.

Note

In Siemens PLC, by default, executing command 205 once can fetch at most 40 target points (poses, labels, velocities) at a time. If the number of target points is greater than 40, please execute command 205 multiple times.

Number of points

This parameter indicates the number of path target points ([pose, label, velocity]) sent by executing this command this time.

Range: 0 to 40.

Position of “visual_move”

The position of the visual_move Task, i.e., the move to the vision pose (usually the pose for picking the object) in the entire robot motion path.

For example, if the path is composed of Tasks move_1, move_2, visual_move, move_3 sequentially, the position of visual_move is 3.

If in the path there is no visual_move Task, the returned value will be 0.

Poses

Each pose includes Cartesian coordinates (XYZ) and Euler angles (ABC), or JPS, according to the target point type set by this command.

Labels

A label is the integer label assigned to a pose. If in the Mech-Vision project, the labels are strings, they need to be mapped to integers before outputting from the Mech-Vision project. If there are no labels in the Mech-Vision project, the label defaults to 0.

Velocities

A velocity is the non-zero velocity parameter percentage value for the correspoinding move Task in Mech-Viz.

Command 206: Get DO List

This command gets the planned DO signal list when there are multiple grippers, such as suction cup sections, to control.

For using this command:

  1. The Mech-Viz project’s name must be set to “suction_zone”.

  2. The set_do_list Task must be named to “set_do_list_1”.

  3. The set_do_list Task’s parameter “Get DO List from VisualMove” must be set to True.

  4. The set_do_list Task must immediately follow a “visual_move” Task.

  5. The name of the visual_move Task followed by the set_do_list Task must be selected in the lower part of the parameter panel of set_do_list.

Before calling this command, command 205 needs to be executed to obtain the planned motion path by Mech-Viz.

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

Command Sent

Parameter

DB offset

Command code 206

2.0

No parameters.

Data Returned

Parameter

DB offset

Status code

200.0

DO signals

1408.0

Status code

If there are no errors, status code 2102 will be returned. Otherwise, the corresponding error code will be returned.

DO signal value

There are 64 DO signal values, in integers, located at the tail of the data returned.

Range of valid DO values: [0, 999]. Placeholder value: -1.

Command 501: Input Object Dimensions to Mech-Vision

This command is for dynamically inputting object dimensions into the Mech-Vision project.

Please confirm the actual object dimensions before running the Mech-Vision project.

The Mech-Vision project should have the Read Object Dimensions Step, and the Step’s parameter Read Object Dimensions from Parameters should be set to True.

Command Sent

Parameter

DB offset

Command code 501

2.0

Project number

8.0

[length, height, width]

68.0

Project number

The integer ID number of the Mech-Vision project in Mech-Center, i.e., the number shown on the left of the project path in Deployment Settings ‣ Mech-Vision in Mech-Center.

[length, height, width]

The object dimensions to input to the Mech-Vision project.

Those values will be read by the Read Object Dimensions Step.

Unit: mm

Data Returned

Parameter

DB offset

Status code

200.0

Status code

If there is no error, status code 1108 will be returned. Otherwise, the corresponding error code will be returned.

Command 502: Input TCP to Mech-Viz

This command is for dynamically inputting robot TCP into the Mech-Viz project.

The Task that receives the robot TCP is outer_move.

Please deploy the Mech-Viz project based on the template project at /Mech-Center/tool/viz_project/outer_move, and put the outer_move Task to a proper position in the workflow.

This command needs to be executed before executing command 201.

Command Sent

Parameter

DB offset

Command code 502

2.0

TCP

80.0

Data Returned

Parameter

DB offset

Status code

200.0

Status code

If there is no error, status code 2107 will be returned. Otherwise, the corresponding error code will be returned.

Command 901: Get Software Status

This command is designed for checking the software running status of Mech-Vision, Mech-Viz, and Mech-Center. At present, this command only supports checking whether Mech-Vision is ready for running the project.

Command Sent

Parameter

DB offset

Command code 901

2.0

No parameters.

Data Returned

Parameter

DB offset

Status code

200.0

Status code

Software status.