You're reading the documentation for an older, but still supported version (GL013300).
For information on the latest version, please have a look at GL013301.

get_tcp

This function retrieves the currently active TCP (Tool Center Point) information from the robot controller. If no TCP is currently set, the function returns an empty string. It is useful for verifying which TCP configuration is being used before executing a motion command.

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

string get_tcp() {
    return string(_get_tcp(_rbtCtrl));
};

Parameter
None

Return

Value

Description

string

The name of the currently active TCP.
Returns an empty string if no TCP is set.

Example

#include "DRFLEx.h"
using namespace DRAFramework;

int main() {
    CDRFLEx drfl;

    // Retrieve the currently active TCP name
    string strTCP = drfl.get_tcp();

    // If no TCP is active, set one manually
    if (strTCP.empty()) {
        drfl.set_tcp("tcp#1");
        printf("TCP was not active. Set to tcp#1.\n");
    } else {
        printf("Current TCP: %s\n", strTCP.c_str());
    }
}

This example checks which TCP is currently active in the controller. If none is set, it activates “tcp#1” and prints the result to the console.