You're reading the documentation for an older, but still supported version (1.33.4).
For information on the latest version, please have a look at 1.33.5.
For information on the latest version, please have a look at 1.33.5.
TOnTpProgressCB
This callback is triggered when a DRL program reports its progress with tp_progress. Use it to track or display the progress of the DRL program.
See Rules for callback functions.
Defined in: DRFLEx.h
// typedef (DRFLEx.h)
typedef void (*TOnTpProgressCB)(LPMESSAGE_PROGRESS);
// registration API (internal + wrapper)
DRFL_API void _set_on_tp_progress(LPROBOTCONTROL pCtrl, TOnTpProgressCB pCallbackFunc);
// tp progress message callback
void set_on_tp_progress(TOnTpProgressCB pCallbackFunc)
{
_set_on_tp_progress(_rbtCtrl, pCallbackFunc);
};
Parameter
Parameter Name |
Data Type |
Default Value |
Description |
|---|---|---|---|
tProgress |
Pointer to the progress data: |
Return
None
Example
#include "DRFLEx.h"
#include <iostream>
#include <thread>
#include <chrono>
using namespace DRAFramework;
using namespace std;
// Callback triggered when a DRL program reports its progress
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;
// Example: stop monitoring when a process completes
if (tProgress->_iCurrentCount == tProgress->_iTotalCount)
cout << "[INFO] Execution completed successfully!" << endl;
}
int main()
{
CDRFLEx drfl;
// Connect to robot controller
if (!drfl.open_connection("192.168.137.100")) {
cout << "Failed to connect to controller." << endl;
return -1;
}
// Register T/P progress callback
drfl.set_on_tp_progress(OnTpProgressCB);
// Keep alive to continuously receive progress updates
while (true)
std::this_thread::sleep_for(std::chrono::seconds(1));
drfl.close_connection();
return 0;
}
Notes
Triggered whenever a DRL program calls
tp_progress.The MESSAGE_PROGRESS structure contains the current step (
_iCurrentCount) and the total number of steps (_iTotalCount).Ideal for implementing custom progress bars, execution monitors, or log tracking systems.