config_program_watch_variable

This function is used to set the variable name to be monitored in order to monitor the internal variables of the program when it is executed in the robot controller.

Definition
DRFLEx.h within class CDRFLEx, public section (line 984)

bool config_program_watch_variable(VARIABLE_TYPE eDivision, DATA_TYPE eType,
                                   string strName, string strData) {
    return _config_program_watch_variable(_rbtCtrl, eDivision, eType,
                                           strName.c_str(), strData.c_str());
};

Parameter

Parameter Name

Data Type

Default Value

Description

eDivision

VARIABLE_TYPE

Refer to the Definition of Enumeration Type

eType

DATA_TYPE

Refer to the Definition of Enumeration Type

strName

string

128-byte variable name string

strData

string

128-byte data string

Return

Value

Description

0

Failed

1

Success

Example

#include <iostream>
#include <string>
using namespace std;

int main()
{
    // Register a float-type variable "var1" to monitor in TP
    bool result = drfl.config_program_watch_variable(VARIABLE_TYPE_GLOBAL,
                                                     DATA_TYPE_FLOAT,
                                                     "var1",
                                                     "1.22");

    if (result)
    {
        cout << "[SUCCESS] Variable 'var1' registered for watch." << endl;
        cout << "You can now monitor it from the Teach Pendant Watch tab." << endl;
    }
    else
    {
        cerr << "[ERROR] Failed to configure TP watch variable." << endl;
    }

    // Example: add another variable to observe
    drfl.config_program_watch_variable(VARIABLE_TYPE_PROGRAM,
                                       DATA_TYPE_INT,
                                       "cycle_count",
                                       "10");

    return 0;
}

When called, this function registers the specified variable to the Teach Pendant (TP) Watch panel, allowing the user to monitor or debug variable values in real time during DRL program execution. Multiple variables can be configured to track program parameters such as speed, torque, or cycle counters.