샘플 프로그램11: MM_S11_Viz_Timer

현재 최신 버전 (2.1.2)에 대한 매뉴얼을 보고 계십니다. 다른 버전에 액세스하려면 페이지 오른쪽 상단 모서리에 있는 '버전 전환' 버튼을 클릭하세요.

■ 현재 사용하고 있는 제품의 버전이 확실하지 않은 경우에는 언제든지 당사 기술 지원팀에 문의하시기 바랍니다.

프로그램 소개

기능 설명

로봇은 타이머를 사용하여 통신을 구축부터 피킹 및 배치 작업을 완료될 때까지 소요된 시간을 계산합니다.

파일 경로

Mech-Vision 및 Mech-Viz의 설치 디렉토리로 이동하여 통신 구성 요소/Robot_Interface/ABB/sample/MM_S11_Viz_Timer 경로를 사용하여 파일을 찾을 수 있습니다.

RobotWare6 시스템에서는 파일의 접미사는 .mod입니다. RobotWare7 시스템에서는 사용자는 .mod.modx로 소정합니다.

필요한 프로젝트

Mech-Vision와 Mech-Viz 프로젝트

사용 전제 조건

  1. 표준 인터페이스 통신 구성이 완료됩니다.

  2. 자동 캘리브레이션이 완료됩니다.

이 샘플 프로그램은 참고용으로 제공됩니다. 사용자는 실제 상황에 맞춰 이 내용을 바탕으로 수정해야 하며, 해당 프로그램을 그대로 사용하지 않도록 하십시오.

프로그램 설명

다음에는 MM_S11_Viz_Timer 샘플 프로그램의 코드와 관련 설명입니다.

MM_S2_Viz_Basic 샘플과 비하면, 이 샘플은 타이머의 기능만 추가되었습니다.(이 기능의 코드가 굵게 표시됨). 따라서, MM_S11_Viz_Timer의 MM_S2_Viz_Basic과 일치하는 부분은 다시 설명하지 않습니다. (일치하는 부분에 대한 정보는 MM_S2_Viz_Basic 샘플 프로그램 설명을 참조하십시오).
MODULE MM_S11_Viz_Timer
!----------------------------------------------------------
! FUNCTION: trigger Mech-Viz project and get planned path,
! add a timer to record cycle time
! Mech-Mind, 2023-12-25
!----------------------------------------------------------
!define local num variables
LOCAL VAR num pose_num:=0;
LOCAL VAR num status:=0;
LOCAL VAR num toolid{5}:=[0,0,0,0,0];
LOCAL VAR num vis_pose_num:=0;
LOCAL VAR num count:=0;
LOCAL VAR num label{5}:=[0,0,0,0,0];
LOCAL VAR clock timer;
LOCAL VAR num timer_val;
!define local joint&pose variables
LOCAL CONST jointtarget home:=[[0,0,0,0,90,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
LOCAL CONST jointtarget snap_jps:=[[0,0,0,0,90,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
LOCAL PERS robtarget camera_capture:=[[302.00,0.00,558.00],[0,0,-1,0],[0,0,0,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
LOCAL PERS robtarget drop_waypoint:=[[302.00,0.00,558.00],[0,0,-1,0],[0,0,0,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
LOCAL PERS robtarget drop:=[[302.00,0.00,558.00],[0,0,-1,0],[0,0,0,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
LOCAL PERS jointtarget jps{5}:=
[
    [[11.1329,49.0771,-36.9666,0.5343,79.2476,-169.477],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]],
    [[11.2355,52.1281,-23.3996,0.5938,62.6295,-169.548],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]],
    [[11.1329,49.0771,-36.9666,0.5343,79.2476,-169.477],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]],
    [[11.1329,49.0771,-36.9666,0.5343,79.2476,-169.477],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]],
    [[0,0,0,0,90,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]]
];
!define local tooldata variables
LOCAL PERS tooldata gripper1:=[TRUE,[[0,0,0],[1,0,0,0]],[0.001,[0,0,0.001],[1,0,0,0],0,0,0]];

PROC Sample_11()
    !set the acceleration parameters
    AccSet 50, 50;
    !set the velocity parameters
    VelSet 50, 1000;
    !move to robot home position
    MoveAbsJ home\NoEOffs,v3000,fine,gripper1;
    !initialize communication parameters (initialization is required only once)
    MM_Init_Socket "127.0.0.1",50000,300;
LOOP:
    !reset timer to 0
    ClkReset timer;
    !start timer
    ClkStart timer;
    !move to image-capturing position
    MoveL camera_capture,v1000,fine,gripper1;
    !open socket connection
    MM_Open_Socket;
    !trigger Mech-Viz project
    MM_Start_Viz 2,snap_jps;
    !get planned path, 1st argument (1) means getting pose in JPs
    MM_Get_VizData 1, pose_num, vis_pose_num, status;
    !check whether planned path has been got from Mech-Viz successfully
    IF status <> 2100 THEN
        !add error handling logic here according to different error codes
        !e.g.: status=2038 means no point cloud in ROI
        Stop;
    ENDIF
    !close socket connection
    MM_Close_Socket;
    !save waypoints of the planned path to local variables one by one
    MM_Get_Jps 1,jps{1},label{1},toolid{1};
    MM_Get_JPS 2,jps{2},label{2},toolid{2};
    MM_Get_JPS 3,jps{3},label{3},toolid{3};
    !follow the planned path to pick
    !move to approach waypoint of picking
    MoveAbsJ jps{1},v1000,fine,gripper1;
    !move to picking waypoint
    MoveAbsJ jps{2},v300,fine,gripper1;
    !add object grasping logic here, such as "setdo DO_1, 1;"
    Stop;
    !move to departure waypoint of picking
    MoveAbsJ jps{3},v1000,fine,gripper1;
    !move to intermediate waypoint of placing
    MoveJ drop_waypoint,v1000,z50,gripper1;
    !move to approach waypoint of placing
    MoveL RelTool(drop,0,0,-100),v1000,fine,gripper1;
    !move to placing waypoint
    MoveL drop,v300,fine,gripper1;
    !add object releasing logic here, such as "setdo DO_1, 0;"
    Stop;
    !move to departure waypoint of placing
    MoveL RelTool(drop,0,0,-100),v1000,fine,gripper1;
    !move back to robot home position
    MoveAbsJ home\NoEOffs,v3000,fine,gripper1;
    !stop timer
    ClkStop timer;
    !read timer value and display the cycle time in log message on teach pendant
    timer_val:=ClkRead(timer);
    TPWrite "single cycle time: "numtostr(timer_val,3)"s.";
    GOTO LOOP;
ENDPROC
ENDMODULE

위 샘플 프로그램 코드에 해당하는 워크플로는 아래 그림에 표시되어 있습니다.

sample11

아래 표는 타이머를 사용하여 소요 시간을 계산하는 기능에 대해 설명합니다.

워크플로 코드와 설명

루프를 통헤 통신을 구축부터 피킹 및 배치 작업을 완료될 때까지 소요된 시간을 계산하기

LOOP:
    …​
    GOTO LOOP;

위 코드는 프로그램이 LOOP와 GOTO LOOP 사이의 코드를 순환 실행함을 나타냅니다.

!reset timer to 0
ClkReset timer;

위 코드는 타이머 timer을 0으로 재설정하는 것을 나타냅니다.

!start timer
ClkStart timer;

위 코드는 타이머 timer이 시간을 측정하기 시작함을 나타냅니다.

!stop timer
ClkStop timer;

위 코드는 타이머 timer이 시간을 측정하기 완료함을 나타냅니다.

timer_val:=ClkRead(timer);

위의 코드는 ClkRead 명령을 통해 타이머 timer가 계산한 시간을 읽고(즉, 통신 구축부터 피킹 및 배치를 완료할 까지 걸리는 시간) 시간의 값을 timer_val 변수에 할당하는 것을 의미합니다.

TPWrite "single cycle time: "numtostr(timer_val,3)"s.";
  • numtostr(timer_val,3): timer_val 변수의 값을 소수점 이하 3자리까지 유지한 후 문자열로 변환합니다.

  • TPWrite: 티치 펜던트 화면에 해당 문자열을 표시합니다.

이 문장은 측정된 시간을 티치 펜던트 화면에 표시하는 것을 나타냅니다.

이 페이지가 도움이 되었습니까?

다음 방법을 통해 피드백을 보내주실 수 있습니다:

저희는 귀하의 개인정보를 소중히 다룹니다.

당사 웹사이트는 최상의 사용자 경험을 제공하기 위해 쿠키를 사용하고 있습니다. "모두 수락"을 클릭하시면 쿠키 사용에 동의하시는 것이며, "모두 거부"를 클릭하시면 이 웹사이트 방문 시 귀하의 정보가 추적되거나 기억되지 않도록 단일 쿠키만 사용됩니다.