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.

set_on_tp_popup (Manual Mode)

This section explains how to use set_on_tp_popup during Manual (Teach) operations. This function registers a callback function that is invoked whenever a DRL program or TP action triggers a popup message on the Teach Pendant. It is useful for answering prompts (RESUME/STOP), routing operator decisions to the host app, and logging human–robot interactions during teaching.

Typical usage

  • Show operator confirmations (e.g., “Clamp closed?”, “Ready to jog to next point?”) and capture the response on the host PC.

  • Gate risky actions in teach mode (e.g., approach near obstacles) with an explicit human confirmation.

  • Log popup content/level/button type to audit teaching sessions or guide SOPs.

Note

Example: Register a popup callback and respond to operator choice

// 1) Define TP popup callback
void OnTpPopup(LPMESSAGE_POPUP tPopup)
{
    printf("-------------------------------------------\n");
    printf("[TP POPUP]\n");
    printf("Message : %s\n", tPopup->_szText);
    printf("Level   : %d\n", tPopup->_iLevel);       // 0: info, 1: warning, 2: alarm
    printf("Buttons : %d\n", tPopup->_iBtnType);    // 0: Resume/Stop, 1: OK
    printf("-------------------------------------------\n");

    // 2) Simple policy examples in Teach mode
    //    - Auto-acknowledge harmless info
    //    - Require operator decision for risk-related prompts (leave unanswered)
    if (tPopup->_iLevel == MESSAGE_LEVEL_INFO &&
        strstr(tPopup->_szText, "Start jogging") != nullptr)
    {
        // Acknowledge informational prompt
        drfl.tp_popup_response(POPUP_RESPONSE_RESUME);
        printf("[Host] Auto-acknowledged jogging start.\n");
    }
    else if (strstr(tPopup->_szText, "Near obstacle") != nullptr)
    {
        // Let the human press the TP button; do not auto-respond
        printf("[Host] Waiting for operator decision on TP.\n");
    }
    else
    {
        // Default: no automatic response
        printf("[Host] Logged popup. No automatic response.\n");
    }
}

// Preconditions:
//  - drfl.open_connection("192.168.137.100");
//  - Controller in Manual (Teach) mode
drfl.set_on_tp_popup(OnTpPopup);
printf("[Teach] TP popup callback registered.\n");

// Keep the process alive to receive callbacks during teaching
while (true) std::this_thread::sleep_for(std::chrono::seconds(1));

In this example, the host application listens for popup events generated on the Teach Pendant (TP). When an informational popup appears (e.g., “Start jogging”), it sends POPUP_RESPONSE_RESUME. However, for higher-risk messages such as “Near obstacle,” the system pauses and waits for the operator’s manual input. This approach enables safe semi-automatic decision handling while maintaining manual override control.

Tips

  • Combine with set_on_tp_log to correlate popup and log streams for SOP auditing.

  • For input forms on TP, pair with set_on_tp_get_user_input and tp_get_user_input_response.

  • Log the popup level (_iLevel) on the host PC to record popup severity (e.g., warning, alarm) in teach mode.

  • If your callback policy auto-responds, document the cases clearly and do not send POPUP_RESPONSE_RESUME automatically for dangerous actions.