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.

TOnTpInitializingCompletedCB

This callback function is used to check whether initialization has been completed when the robot controller is initialized by the Teach Pendant (T/P) application after the controller boots.

See Rules for callback functions.

Defined in: DRFLEx.h

// typedef (DRFL.h)
typedef void (*TOnTpInitializingCompletedCB)();

// registration API (internal + wrapper)
DRFL_API void _set_on_tp_initializing_completed(LPROBOTCONTROL pCtrl, TOnTpInitializingCompletedCB pCallbackFunc);
void set_on_tp_initializing_completed(TOnTpInitializingCompletedCB pCallbackFunc)
{
    _set_on_tp_initializing_completed(_rbtCtrl, pCallbackFunc);
};

Parameter
None

Return
None

Example

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

CDRFLEx drfl;
std::atomic<bool> g_bTpInitCompleted(false);

// Callback function triggered when TP initialization is completed
void OnTpInitializingCompletedCB()
{
    // Request control authority from the main loop
    g_bTpInitCompleted = true;
}

int main()
{
    // Register TP initialization completion callback before connecting
    drfl.set_on_tp_initializing_completed(OnTpInitializingCompletedCB);

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

    // Main loop: call manage_access_control outside the callback
    while (true)
    {
        if (g_bTpInitCompleted) {
            g_bTpInitCompleted = false;
            cout << "[TP INIT] Teach Pendant initialization completed." << endl;
            drfl.manage_access_control(MANAGE_ACCESS_CONTROL_REQUEST);
        }
        std::this_thread::sleep_for(std::chrono::milliseconds(100));
    }

    drfl.close_connection();
    return 0;
}

Notes

  • The callback is called once, the first time a robot state other than STATE_NOT_READY or STATE_INITIALIZING is received after registration, and is then unregistered. The controller reports the robot state when the connection is opened and whenever it changes. Register this callback before open_connection: if the controller is already initialized it is then called during connection. A callback registered after connecting to an idle controller is called at the next state change. Register it again after every open_connection.

  • Common usage includes requesting control authority (MANAGE_ACCESS_CONTROL_REQUEST) or performing application startup routines.