set_on_tp_get_user_input (Manual Mode)
This section explains how to use set_on_tp_get_user_input during Manual (Teach) operations. This function registers a callback function that is triggered when the Teach Pendant (TP) requests user input through a DRL command or manual UI interaction.
It enables the host program to capture operator-entered values (such as text, numbers, or parameters) and use them dynamically in the teaching workflow.
Typical usage
Request operator input (e.g., “Enter part ID”, “Input offset value”) and handle the result inside the callback.
Integrate interactive teach dialogs that require human confirmation or numeric entries.
Store and log operator-provided data during manual teaching for traceability.
Combine with tp_get_user_input_response to send typed values back to the controller.
Note
The callback is triggered whenever a DRL command requests user input through TP.
Callback execution should be non-blocking; process or respond asynchronously if needed.
Always call tp_get_user_input_response to deliver the response back to the controller.
Example: Capture user input from Teach Pendant and respond
#include "DRFLEx.h"
#include <iostream>
#include <thread>
#include <cstring>
using namespace std;
using namespace DRAFramework;
CDRFLEx drfl;
// 1) Define callback for TP user input
void OnTpGetUserInput(LPMESSAGE_INPUT tInput)
{
cout << "-------------------------------------------\n";
cout << "[TP USER INPUT REQUESTED]\n";
cout << "Prompt Message : " << tInput->_szTitle << "\n";
cout << "Data Type : " << tInput->_iType << "\n";
cout << "-------------------------------------------\n";
// Example: automatically respond based on prompt content
if (strstr(tInput->_szTitle, "Enter part ID") != nullptr)
{
drfl.tp_get_user_input_response("Part-A123");
cout << "[Host] Auto-filled Part ID: Part-A123\n";
}
else if (strstr(tInput->_szTitle, "offset") != nullptr)
{
drfl.tp_get_user_input_response("15.5");
cout << "[Host] Sent numeric offset value: 15.5\n";
}
else
{
cout << "[Host] Waiting for operator to enter input manually on TP.\n";
}
}
int main()
{
// Preconditions:
// - drfl.open_connection("192.168.137.100");
// - Controller in Manual (Teach) mode
drfl.set_on_tp_get_user_input(OnTpGetUserInput);
cout << "[Teach] TP user input callback registered.\n";
// Keep alive to listen for user input requests
while (true) std::this_thread::sleep_for(std::chrono::seconds(1));
return 0;
}
In this example, the host program automatically reacts to user input prompts generated by the TP. Depending on the request content, the callback either sends a predefined response (e.g., a part ID or numeric offset) or waits for the operator to enter input manually. This pattern is ideal for interactive or semi-automated teaching sequences, where part-specific parameters or calibration values are entered through the TP.
Tips
Use this callback for interactive parameter tuning, such as adjusting approach distances or task thresholds.
The TP automatically pauses program execution until tp_get_user_input_response is sent.
Combine with set_on_tp_popup to build full dialog-based teaching workflows.
For multi-step inputs, chain prompts and responses through sequential callbacks to simulate guided teach routines.