샘플 프로그램11: MM_S11_Viz_Timer
프로그램 소개
기능 설명 |
로봇은 타이머를 사용하여 통신을 구축부터 피킹 및 배치 작업을 완료될 때까지 소요된 시간을 계산합니다. |
파일 경로 |
Mech-Vision 및 Mech-Viz의 설치 디렉토리로 이동하여 |
필요한 프로젝트 |
Mech-Vision와 Mech-Viz 프로젝트 |
사용 전제 조건 |
|
이 샘플 프로그램은 참고용으로 제공됩니다. 사용자는 실제 상황에 맞춰 이 내용을 바탕으로 수정해야 하며, 해당 프로그램을 그대로 사용하지 않도록 하십시오. |
프로그램 설명
다음에는 MM_S11_Viz_Timer 샘플 프로그램의 코드와 관련 설명입니다.
MM_S2_Viz_Basic 샘플과 비하면, 이 샘플은 타이머를 사용하여 소요 시간을 계산하는 기능만 추가되었습니다.(이 기능의 코드가 굵게 표시됨). 따라서, 아래 부분에서는 타이머를 사용하여 소요 시간을 계산하는 기능만 설명됩니다. (MM_S11_Viz_Timer의 MM_S2_Viz_Basic과 일치하는 부분에 대한 정보는 MM_S2_Viz_Basic 샘플 프로그램 설명을 참조하십시오). |
NOP
'--------------------------------
'FUNCTION: trigger Mech-Viz
'project and get planned path,add
'a timer to record cycle time
'Mech-Mind, 2023-12-25
'--------------------------------
'clear I50 to I69
CLEAR I050 20
'initialize p variables
SUB P071 P071
SUB P072 P072
SUB P073 P073
'move to robot home position
MOVJ C00000 VJ=50.00
'initialize communication
'parameters (initialization is
'required only once)
CALL JOB:MM_INIT_SOCKET ARGF"192.168.170.22;50000;1"
*LOOP
'reset timer 0
SETTM TM000 TRESET
'start timer 0
SETTM TM000 TSTART
'move to image-capturing position
MOVJ C00001 VJ=50.00 PL=0
'open socket connection
CALL JOB:MM_OPEN_SOCKET
'trigger Mech-Viz project
CALL JOB:MM_START_VIZ ARGF"2;30"
'get planned path, 1st argument
'(1) means getting pose in JPs
CALL JOB:MM_GET_VIZDATA ARGF"1;51;52;53"
'check whether planned path has
'been got from Mech-Viz
'successfully
IFTHENEXP I053<>2100
'add error handling logic here
'according to different error
'codes
'e.g.: I053=2038 means no
'point cloud in ROI
PAUSE
ENDIF
'close socket connection
CALL JOB:MM_CLOSE_SOCKET
'save waypoints of the planned
'path to local variables one
'by one
CALL JOB:MM_GET_JPS ARGF"1;71;61;62"
CALL JOB:MM_GET_JPS ARGF"2;72;63;64"
CALL JOB:MM_GET_JPS ARGF"3;73;65;66"
'follow the planned path to pick
'move to approach waypoint of
'picking
MOVJ P071 VJ=50.00 PL=0
'move to picking waypoint
MOVJ P072 VJ=10.00 PL=0
'add object grasping logic here,
'such as DOUT OT#(1) ON
PAUSE
'move to departure waypoint of
'picking
MOVJ P073 VJ=50.00 PL=0
'move to intermediate waypoint of
'placing
MOVJ C00002 VJ=50.00
'move to approach waypoint of
'placing
MOVL C00003 V=166.6 PL=0
'move to placing waypoint
MOVL C00004 V=50.0 PL=0
'add object releasing logic here,
'such as DOUT OT#(1) OFF
PAUSE
'move to departure waypoint of
'placing
MOVL C00005 V=166.6 PL=0
'move back to robot home position
MOVJ C00006 VJ=50.00
'stop timer 0
SETTM TM000 TSTOP
PAUSE
JUMP *LOOP
END
위 샘플 프로그램 코드에 해당하는 워크플로는 아래 그림에 표시되어 있습니다.

아래 표는 타이머를 사용하여 소요 시간을 계산하는 기능에 대해 설명합니다.
워크플로 | 코드와 설명 |
---|---|
루프를 통헤 통신을 구축부터 피킹 및 배치 작업을 완료될 때까지 소요된 시간을 계산하기 |
위 코드는 프로그램이 “*LOOP”와 “JUMP *LOOP” 사이의 코드를 순환 실행함을 나타냅니다.
위 코드는 TM000 타이머를 0으로 리셋합니다.
위 코드는 TM000 타이머를 시작합니다.
위 코드는 TM000 타이머를 중지합니다. 사용자는 티치 펜던트에서 TM000변수의 값을 확인할 수 있습니다. 아래 그림과 같이, TM000 변수 값은 120이고, 단위는 0.01초입니다. ![]() |