Example Programs 3: Get Planned Path from Mech-Vision
Program Introduction
Description |
The robot triggers the Mech-Vision project to run, and then obtains the planned path for picking and placing. |
Project |
Mech-Vision project |
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-Vision project to run |
mm_start_vision: The command to trigger the Mech-Vision project to run.
The entire statement indicates that the robot triggers the vision system to run the Mech-Vision project with an ID of 1 and expects the Mech-Vision project to return all waypoints. |
||
Obtain the planned path |
mm_get_data: The command to obtain the vision result.
The entire statement indicates that the robot obtains the planned path from the Mech-Vision project that has an ID of 1.
|
||
Retrieve the planned path and move to each waypoint |
When the status code is 1103, 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. |