.. _manual_set_on_tp_initializing_completed: set_on_tp_initializing_completed (Manual Mode) ------------------------------------------------- This section explains how to use :ref:`set_on_tp_initializing_completed ` during **Manual (Teach)** operations. |br| This function registers a **callback function** that is invoked once the Teach Pendant (TP) has finished its initialization process and is ready for user interaction. It is typically used to enable UI elements or start monitoring threads after the TP has fully booted and established communication with the controller. **Typical usage** - Detect when the TP has completed boot-up and is ready for teaching operations. - Automatically enable custom UI panels or log systems after initialization. - Display or log messages indicating readiness for manual control. - Synchronize startup procedures between the TP and host PC. .. Note:: - 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 initialised 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. - See :ref:`Rules for callback functions `. **Example: Initialize teaching environment after TP startup** .. code-block:: cpp #include #include // Callback executed after TP finishes initialization void OnTpInitCompleted() { printf("-------------------------------------------\n"); printf("[TP INITIALIZATION COMPLETED]\n"); printf("Teach Pendant is now ready for user interaction.\n"); printf("-------------------------------------------\n"); } drfl.set_on_tp_initializing_completed(OnTpInitCompleted); drfl.open_connection("192.168.137.100"); printf("[Teach] Waiting for TP initialization...\n"); // Keep running to detect initialization completion while (true) this_thread::sleep_for(chrono::seconds(1)); When registered, this callback executes automatically once the **Teach Pendant (TP) completes its initialization sequence**. It allows the host to **start teaching-related processes or report readiness** (e.g., logging a ready message when the TP is ready). **Tips** - Use to trigger system checks or UI activation right after TP startup. - Ideal for preparing monitoring threads or reconnecting services automatically.