Example Program 3: MM_S3_Vis_Path
Program Introduction
Description |
The robot triggers the Mech-Vision project to run, and then obtains the planned path for picking and placing. |
File Name |
You can navigate to the installation directory of Mech-Vision and Mech-Viz and find the file by using the |
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
This part describes the MM_S3_Vis_Path example program.
1. MJOINT(POINTC(264.2282,-217.9533,359.1164,-83.989165,1.303953,176.0864,CFG1,0,0,1), v100perc, fine, tool0);
2. MM_Init_Socket(1);
3. CALL: MM_Open_Socket();
4. CALL: MM_Status := MM_Switch_Model(1, 1);
5. CALL: MM_Status := MM_Start_Vis(1, 0, 1, MM_J);
6. CALL: MM_Status, MM_LastData, MM_POS_NUM, MM_VisPosNum := MM_Get_VisPath(1, 2);
7. IF MM_Status <> 1103 THEN
8. STOPPROG;
9. END_IF;
10. CALL: MM_Pose[1], MM_Label[1], MM_Tool[1] := MM_Get_Pose(1);
11. CALL: MM_Pose[2], MM_Label[2], MM_Tool[2] := MM_Get_Pose(2);
12. CALL: MM_Pose[3], MM_Label[3], MM_Tool[3] := MM_Get_Pose(3);
13. CALL: MM_Pose[4], MM_Label[4], MM_Tool[4] := MM_Get_Pose(4);
14. CALL: MM_Pose[5], MM_Label[5], MM_Tool[5] := MM_Get_Pose(5);
15. MJOINT(MM_Pose[1], v500, fine, tool0);
16. MJOINT(MM_Pose[2], v500, fine, tool0);
17. MJOINT(MM_Pose[3], v500, fine, tool0);
18. MJOINT(MM_Pose[4], v500, fine, tool0);
19. MJOINT(MM_Pose[5], v500, fine, tool0);
20. CALL: MM_Close_Socket();
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 | ||
|---|---|---|---|
Move to the image-capturing position |
The entire statement indicates that the robot moves to the taught image-capturing position by using joint position movement. |
||
Initialize communication parameters |
The robot uses the MM_Init_Socket instruction to set the socket number for communication with the IPC.
|
||
Establish the communication |
The TCP communication between the robot and the vision system is established by using the MM_Open_Socket command. |
||
Switch Mech-Vision Parameter Recipe |
In this entire statement, the parameter recipe of the Mech-Vision project whose ID is 1 is switched to recipe 1. |
||
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 |
The entire statement indicates that the robot obtains the planned path from the Mech-Vision project that has an ID of 1.
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. |
||
Store the planned path |
The entire statement “CALL:MM_Pose[1],MM_Label[1],MM_Tool[1]:=MM_Get_Pose(1);” stores the TCP, label, and tool ID of the first waypoint in the specified variables.
|
||
Move to each waypoint in the planned path |
The robot sequentially moves to each waypoint using joint position movement. |
||
Close the communication |
The TCP communication between the robot and the vision system is closed by using the MM_Close_Socket command. |