Example Programs 2: Get Planned Path from Mech-Viz
Program Introduction
Description |
The robot triggers the Mech-Viz project to run, and then obtains the planned path for picking and placing. |
Project |
Mech-Vision and Mech-Viz projects |
Prerequisites |
|
| This example program is provided for reference only. Before using the program, please modify the program according to the actual scenario. |
Program Description
The following is a sample program for reference only.
The table below explains the above example program. You can click the hyperlink to the command name to view its detailed description.
| Feature | Code and description | ||
|---|---|---|---|
Initialize communication parameters |
mm_init_socket: The command to initialize the communication.
The entire statement indicates that the robot establishes the connection with the vision system by specifying the IP address, port number, and timeout period of the communication target (the IPC) through the mm_init_socket command.
|
||
Move to the image-capturing position |
|
||
Establish the communication |
The TCP communication between the robot and the vision system is established by using the mm_open_socket command. |
||
Trigger the Mech-Viz project to run |
mm_start_viz: The command to trigger the Mech-Viz project to run.
The entire command indicates that the robot triggers the vision system to run the Mech-Viz project, and then Mech-Viz plans the robot’s picking path base on the vision result output by Mech-Vision. |
||
Retrieve the planned path and move to each waypoint |
mm_get_data: The command to obtain the vision result.
The entire statement indicates that the robot obtains the planned path from the Mech-Viz project.
|
||
Store the planned path |
When the status code g_mm_status is 2100, the robot has successfully obtained the planned path. Otherwise, an error has occurred in the vision system. You can perform the corresponding operation based on the specific error code.
|
||
Close the communication |
The TCP communication between the robot and the vision system is closed by using the mm_close_socket command. |