Example Programs 1: Get Vision Result from Mech-Vision
Program Introduction
Description |
The robot triggers the Mech-Vision project to run, and then obtains the vision result for picking and placing the object. |
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 2 and expects the Mech-Vision project to return all vision points. |
||
Get Vision Result |
mm_get_data: The command to obtain the vision result.
The entire statement indicates that the robot obtains the vision result from the Mech-Vision project with an ID of 2.
|
||
Store the vision results and move to the picking waypoint. |
When the status code is 1100, the robot has successfully obtained all vision result. 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. |