.. _manual_tp_get_user_input_response: tp_get_user_input_response (Manual Mode) ------------------------------------------ This section explains how to use :ref:`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 :ref:`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** .. code-block:: cpp // Callback for TP user input event void OnTpGetUserInput(LPMESSAGE_INPUT tInput) { printf("-------------------------------------------\n"); printf("[TP USER INPUT REQUESTED]\n"); printf("Prompt : %s\n", tInput->_szTitle); printf("Input Type : %d\n", tInput->_iType); printf("-------------------------------------------\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"); printf("[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"); printf("[Host] Sent numeric offset: 25.5\n"); } else { printf("[Host] Waiting for manual input on TP...\n"); } } // Preconditions: // - drfl.open_connection("192.168.137.100"); // - Controller in Manual (Teach) mode drfl.set_on_tp_get_user_input(OnTpGetUserInput); printf("[Teach] TP user input callback registered.\n"); // Keep process alive to handle input events while (true) this_thread::sleep_for(chrono::seconds(1)); 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 :ref:`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 :ref:`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.