Example Program 5: MMS5VIZUSER
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 MMS5VIZUSER example program.
#Include "MMMODULE"
MM_DROP_COM()
Mcomnum = 7
MM_INIT_COM(Mcomnum)
Tool P_NTool
PMTool=(+0.00,+0.00,+0.00,+0.00,+0.00,+0.00)
Tool PMTool
MM_SET_MOD(1,1,MM_Status)
If MM_Status <> 1107 Then
Hlt
EndIf
MM_START_VIZ(1,JntSend,MM_Status)
If MM_Status <> 2103 Then
Hlt
EndIf
MM_SET_BCH(1,1,MM_Status)
If MM_Status <> 2105 Then
Hlt
EndIf
Dim MM_Result(10,9)
Dim MM_VisionInfo(10,21)
Dim MM_VisionData(21)
MM_GET_VMD (0,2,4,MM_Status,MM_VisionPt_Num,MM_VPos_Num,MM_Result,MM_VisionInfo)
If MM_Status <> 2100 Then
Hlt
EndIf
MM_GET_VMP(MM_Result,MM_VisionInfo,1,PPick,MM_MotionType,MM_ToolID,MM_Velocity,MM_VisionData)
MM_DROP_COM()
PPick_pre=PPick
PPick_pre.Z=PPick_pre.Z+100
Mov PPick_pre
Fine 0,P
Mvs PPick
Hlt
Mvs PPick_pre
The workflow corresponding to the above example program code is shown in the figure below.
The table below explains the above program. You can click the hyperlink to the command name to view its detailed description.
| Feature | Code and description | ||
|---|---|---|---|
Include the MM_Module header file |
|
||
Initialize communication parameters |
Close the communication first, then reconnect to ensure no project is currently connected. |
||
Reset the control points to their initial values and declare the tool variables |
|
||
Switch the Mech-Vision system’s parameter recipe and verify the status code |
|
||
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.
|
||
Set the Exit Port for the Branch by Msg Step in Mech-Viz |
|
||
Define and declare the storage containers |
|
||
Obtain the planned path |
This command retrieves the planned path and the planning path for vision-guided motion from Mech-Vision project 0.
|
||
Store the planned path |
The entire statement stores the TCP, label, and tool ID of the first vision point in the specified variables. |
||
Disconnect the communication |
|
||
Set the approach and the departure waypoint |
Assign the value of PPick to PPick_pre, and increase the Z-axis height of PPick_pre by 200 to serve as the approach and departure point. |
||
Move to the approach waypoint of picking |
Move to the approach point and set absolute positioning for arrival. |
||
Move to the picking waypoint |
The robot moves from the approach waypoint of picking to the picking waypoint linearly.
|
||
Move to the departure waypoint of picking |
The robot moves to position above the picking waypoint and reaches the departure waypoint of picking.
|