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.

TOnMonitoringDataCB

This callback function is used to check the robot operation data that represents the current location, joint positions, and task-space pose of the robot controller.

See Rules for callback functions.

Defined in: DRFLEx.h

// typedef (DRFL.h)
typedef void (*TOnMonitoringDataCB)(const LPMONITORING_DATA);

// registration API (internal + wrapper)
DRFL_API void _set_on_monitoring_data(LPROBOTCONTROL pCtrl, TOnMonitoringDataCB pCallbackFunc);
void set_on_monitoring_data(TOnMonitoringDataCB pCallbackFunc)
{
    _set_on_monitoring_data(_rbtCtrl, pCallbackFunc);
};

Parameter

Parameter Name

Data Type

Default Value

Description

pData

MONITORING_DATA

Pointer to structure containing current robot joint and task-space information.

Return
None

Example

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

// Callback function triggered periodically to provide robot monitoring data
void OnMonitoringDataCB(const LPMONITORING_DATA pData)
{
    cout << "[MONITOR] Joint positions (deg): ";
    for (int i = 0; i < 6; ++i)
    {
        cout << pData->_tCtrl._tJoint._fActualPos[i];
        if (i < 5) cout << ", ";
    }
    cout << endl;

    // Display TCP position (mm, deg); row 0 = tool, row 1 = flange
    cout << "[MONITOR] TCP position: X=" << pData->_tCtrl._tTask._fActualPos[0][0]
         << " Y=" << pData->_tCtrl._tTask._fActualPos[0][1]
         << " Z=" << pData->_tCtrl._tTask._fActualPos[0][2] << endl;
}

int main()
{
    CDRFLEx drfl;

    // Connect to the robot controller
    if (!drfl.open_connection("192.168.137.100")) {
        cout << "Failed to connect to controller." << endl;
        return -1;
    }

    // Register real-time monitoring callback
    drfl.set_on_monitoring_data(OnMonitoringDataCB);

    // Keep program alive to continuously receive monitoring updates
    while (true)
    {
        std::this_thread::sleep_for(std::chrono::seconds(1));
    }

    drfl.close_connection();
    return 0;
}

Notes

  • This callback delivers the same data as the controller’s current operation state (joint & task position).

  • Used for real-time visualization, data logging, or telemetry updates in applications.

  • Each callback receives the most recent data. If the callback takes longer than the data period (100 ms before DRCF 3.5, 20 ms from DRCF 3.5), intermediate samples are not delivered. Do not rely on receiving every sample (for example for integration or differentiation).