이전 버전(1.33.4)의 문서를 보고 있습니다. 이 버전은 계속 지원됩니다.
최신 버전 정보는 1.33.5에서 확인하세요.

TOnTpProgressCB

이 콜백은 DRL 프로그램이 tp_progress로 진행 상황을 보고할 때 호출됩니다. DRL 프로그램의 진행 상황을 추적하거나 표시할 때 사용하세요.

콜백 함수 규칙을 참고하세요.

정의 위치: DRFLEx.h

// typedef 정의(DRFLEx.h)
typedef void (*TOnTpProgressCB)(LPMESSAGE_PROGRESS);

// 등록 API(내부 + 래퍼)
DRFL_API void _set_on_tp_progress(LPROBOTCONTROL pCtrl, TOnTpProgressCB pCallbackFunc);

// TP 진행 상황 메시지 콜백 함수
void set_on_tp_progress(TOnTpProgressCB pCallbackFunc)
{
    _set_on_tp_progress(_rbtCtrl, pCallbackFunc);
};

매개변수

매개변수 이름

자료형

기본값

설명

tProgress

MESSAGE_PROGRESS

진행 데이터의 포인터입니다. _iCurrentCount는 현재 단계이고 _iTotalCount는 전체 단계 수입니다.

반환값
없음

예제

#include "DRFLEx.h"
#include <iostream>
#include <thread>
#include <chrono>
using namespace DRAFramework;
using namespace std;

// DRL 프로그램이 진행 상황을 보고하면 호출되는 콜백 함수
void OnTpProgressCB(LPMESSAGE_PROGRESS tProgress)
{
    if (!tProgress) return;

    cout << "[TP PROGRESS]" << endl;
    cout << "Progress  : " << static_cast<int>(tProgress->_iCurrentCount)
         << " / " << static_cast<int>(tProgress->_iTotalCount) << endl;

    // 예: 공정이 완료되면 모니터링 중지
    if (tProgress->_iCurrentCount == tProgress->_iTotalCount)
        cout << "[INFO] Execution completed successfully!" << endl;
}

int main()
{
    CDRFLEx drfl;

    // 로봇 컨트롤러에 연결
    if (!drfl.open_connection("192.168.137.100")) {
        cout << "Failed to connect to controller." << endl;
        return -1;
    }

    // T/P 진행 상황 콜백 함수 등록
    drfl.set_on_tp_progress(OnTpProgressCB);

    // 진행 상황 갱신을 계속 수신하도록 실행 유지
    while (true)
        std::this_thread::sleep_for(std::chrono::seconds(1));

    drfl.close_connection();
    return 0;
}

참고

  • DRL 프로그램이 tp_progress를 호출할 때마다 이 콜백이 실행됩니다.

  • MESSAGE_PROGRESS 구조체에는 현재 단계(_iCurrentCount)와 전체 단계 수(_iTotalCount)가 들어 있습니다.

  • 사용자 정의 진행률 표시줄, 실행 모니터, 로그 추적 시스템을 구현하는 데 적합합니다.