HYUNDAI Example Program¶
This topic introduces the example programs provided with Mech-Mind Software Suite and the operations required to perform an actual recognition and picking task.
Attention
Before proceeding, please make sure that Set up Standard Interface Communication with HYUNDAI has been finished.
Obtain Vision Result from Mech-Vision¶
On the teach pendant, select the Program and enter the program number 9700 to open the example program.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | Program File Format Version : 1.6 MechType: 739(HH4-01) TotalAxis: 6 AuxAxis: 0
REM VIS sample
'_
V500$="192.168.1.10"
V500%=8000
V501%=1
CALL 9821_MMH_OPEN
PRINT #0,"UDP OPEN OK !"
DELAY 1.0
'_
V503%=1
V504%=1
V505%=2
V506%=1
V507%=10
P500=P*
'_
CALL 9803_MMH_ChangVIS
IF (V504$ <> "1107") THEN
REM ERROR OCCURED
STOP
ENDIF
'_
CALL 9801_MMH_VIStrig
IF (V504$ <> "1102") THEN
REM ERROR OCCURED
STOP
ENDIF
'_
CALL 9802_MMH_VISresult
IF (V504$ <> "1100") THEN
REM ERROR OCCURED
STOP
ENDIF
'_
CALL 9822_MMH_CLOSE
'_
IF V505% = 2 THEN
FOR LV1%=1 TO VAL(V506$)
LV3%=LV1%-1
LV2%=V507%+LV3%
P[LV2%]=(0,0,0,0,0,0,&H0001)R
P[LV2%].X=V![500+LV3%*14]
P[LV2%].Y=V![501+LV3%*14]
P[LV2%].Z=V![502+LV3%*14]
P[LV2%].RX=V![503+LV3%*14]
P[LV2%].RY=V![504+LV3%*14]
P[LV2%].RZ=V![505+LV3%*14]
NEXT
'_
ELSE
FOR LV1%=1 TO VAL(V506$)
LV2%=V507%+LV1%-1
P[LV2%]=(0,0,0,0,0,0)A
P[LV2%].J1=V![508+LV3%*14]
P[LV2%].J2=V![509+LV3%*14]
P[LV2%].J3=V![510+LV3%*14]
P[LV2%].J4=V![511+LV3%*14]
P[LV2%].J5=V![512+LV3%*14]
P[LV2%].J6=V![513+LV3%*14]
NEXT
ENDIF
'_
'_
END
|
Program Logic¶
Line 4–9: The robot set up a UDP connection with Mech-Vision. V500$ specifies the IP of the IPC. V500% specifies the port number configured in Mech-Vision.
Line 11: V503% specifies Mech-Vision project ID.
Line 12: V504% specifies the number of vision points expected to be obtained with the range from 0 to 4, and 0 means all vision points are obtained.
Line 13: V505% specifies the pose type, in which 1 represents JPs, and 2 represents TCP.
Line 14: V506% specifies Mech-Vision project recipe ID.
Line 15: V507% specifies the initial index value of the variable P. For example, if V507% = 10, it represents that the first vision point from Mech-Vision will be assigned to P[10].
Line 18–22: Set Mech-Vision project recipe. Check if the returned status code indicates any error. If an error code is returned, the program is halted.
Line 24–28: Trigger Mech-Vision project to run. Check if the returned status code indicates any error. If an error code is returned, the program is halted.
Line 30–34: Obtain the vision point from Mech-Vision project. Check if the returned status code indicates any error. If an error code is returned, the program is halted.
Line 36: The robot is disconnected with the Mech-Vision.
Line 38–49: If the pose type of vision point is TCP, assign the TCP value to P[LV2%].
Line 52–61: If the pose type of vision point is JPs, assign the JPs values to P[LV2%].
Obtain Planned Path from Mech-Viz¶
On the teach pendant, select the Program and enter the program number 9701 to open the example program.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | Program File Format Version : 1.6 MechType: 739(HH4-01) TotalAxis: 6 AuxAxis: 0
REM VIZ-path sample
'_
V500$="192.168.1.10"
V500%=8000
V501% =1
CALL 9821_MMH_OPEN
PRINT #0,"UDP OPEN OK !"
DELAY 1.0
'_
V505%=1
P500=P*
'_
CALL 9804_MMH_StartVIZ
IF (V504$ <> "2103") THEN
REM ERROR OCCURED
STOP
ENDIF
'_
V507%=970
V505%=2
'_
CALL 9808_MMH_VIZpath
IF (V504$ <> "2100") THEN
REM ERROR OCCURED
STOP
ENDIF
'_
CALL 9805_MMH_StopVIZ
IF (V504$ <> "2104") THEN
REM ERROR OCCURED
STOP
ENDIF
'_
CALL 9822_MMH_CLOSE
'_
IF V505% = 2 THEN
'_
FOR LV1%=1 TO VAL(V506$)
LV3%=LV1%-1
LV2%=V507%+LV3%
P[LV2%]=(0,0,0,0,0,0,&H0001)R
P[LV2%].X=V![500+LV3%*14]
P[LV2%].Y=V![501+LV3%*14]
P[LV2%].Z=V![502+LV3%*14]
P[LV2%].RX=V![503+LV3%*14]
P[LV2%].RY=V![504+LV3%*14]
P[LV2%].RZ=V![505+LV3%*14]
NEXT
'_
ELSE
FOR LV1%=1 TO VAL(V506$)
LV2%=V507%+LV1%-1
P[LV2%]=(0,0,0,0,0,0)A
P[LV2%].J1=V![508+LV3%*14]
P[LV2%].J2=V![509+LV3%*14]
P[LV2%].J3=V![510+LV3%*14]
P[LV2%].J4=V![511+LV3%*14]
P[LV2%].J5=V![512+LV3%*14]
P[LV2%].J6=V![513+LV3%*14]
NEXT
ENDIF
'_
END
|
Program Logic¶
Line 4–9: The robot set up a UDP connection with Mech-Vision. V500$ specifies the IP of the IPC. V500% specifies the port number configured in Mech-Vision.
Line 11: V505% specifies the pose type, in which 1 represents JPs, and 2 represents TCP.
Line 14–18: Trigger Mech-Viz project to run. Check if the returned status code indicates any error. If an error code is returned, the program is halted.
Line 20: V507% specifies the initial index value of the variable P. For example, if V507% = 10, it represents that the first vision point from Mech-Vision will be assigned to P[10].
Line 23–27: Obtain the planned path from Mech-Viz. Check if the returned status code indicates any error. If an error code is returned, the program is halted.
Line 29–33: Stop running the Mech-Viz project. Check if the returned status code indicates any error. If an error code is returned, the program is halted.
Line 35: The robot is disconnected with the Mech-Vision.
Line 39–49: If the pose type of the waypoint is TCP, assign the TCP value to P[LV2%].
Line 52–61: If the pose type of the waypoint is JPs, assign the JPs value to P[LV2%].
Run Example Program¶
Please refer to the instructions in Test Standard Interface Communication.