tp_get_user_input_response (Manual Mode)
This section explains how to use tp_get_user_input_response during Manual (Teach) operations. This function sends the user-entered text or numeric input back to the robot controller in response to a user input request generated by the Teach Pendant (TP). It is typically paired with set_on_tp_get_user_input to complete the input–response cycle.
Typical usage
Return text or numeric values that the operator entered on the TP.
Automatically respond to TP input prompts from the host application for testing or semi-automated workflows.
Use in interactive teaching or calibration tasks requiring operator-provided data (e.g., part ID, offset, tolerance).
Enable external PC-based logic to validate or substitute user inputs before sending them to the controller.
Note
Input strings exceeding 128 bytes may be truncated by the controller.
Example: Send user input response automatically
#include "DRFLEx.h"
#include <iostream>
#include <thread>
#include <cstring>
using namespace std;
using namespace DRAFramework;
CDRFLEx drfl;
// Callback for TP user input event
void OnTpGetUserInput(LPMESSAGE_INPUT tInput)
{
cout << "-------------------------------------------\n";
cout << "[TP USER INPUT REQUESTED]\n";
cout << "Prompt : " << tInput->_szTitle << "\n";
cout << "Input Type : " << tInput->_iType << "\n";
cout << "-------------------------------------------\n";
// Example 1: Automatically return a part ID for testing
if (strstr(tInput->_szTitle, "Enter part ID") != nullptr)
{
drfl.tp_get_user_input_response("Part-001");
cout << "[Host] Sent TP input response: Part-001\n";
}
// Example 2: Automatically return a numeric offset
else if (strstr(tInput->_szTitle, "Enter offset") != nullptr)
{
drfl.tp_get_user_input_response("25.5");
cout << "[Host] Sent numeric offset: 25.5\n";
}
else
{
cout << "[Host] Waiting for manual input 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 process alive to handle input events
while (true)
this_thread::sleep_for(chrono::seconds(1));
return 0;
}
In this example, the program listens for user input requests from the Teach Pendant. Depending on the prompt content, the callback automatically sends a suitable response (e.g., part ID or numeric offset) back to the controller using tp_get_user_input_response. This enables semi-automated input handling for testing or repetitive teaching workflows.
Tips
Always validate and sanitize user-entered data before sending it back to the controller.
In semi-automatic teaching, you can prefill known values and only prompt the operator for unknown parameters.
Combine with tp_popup_response for multi-step dialogs (e.g., confirm → input → confirm).
The function can be used for both text and numeric inputs depending on the DRL command’s request type.