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.

check_position_condition_abs

This function checks whether the absolute position of a specified axis lies within a defined range. It can be repeatedly evaluated inside conditional statements (e.g., while or if) to monitor positional conditions in both teaching and automatic operations.

The input axis and range are interpreted according to the reference coordinate system defined by set_ref_coord. If eForceReference is set to COORDINATE_SYSTEM_TOOL, the position comparison is performed relative to the BASE coordinate system.

Refer to check_position_condition_rel for relative position monitoring.

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

bool check_position_condition_abs(FORCE_AXIS eForceAxis,
                                  float fTargetMin,
                                  float fTargetMax,
                                  COORDINATE_SYSTEM eForceReference = COORDINATE_SYSTEM_TOOL) {
    return _check_position_condition_abs(_rbtCtrl, eForceAxis, fTargetMin, fTargetMax, eForceReference);
};

Parameter

Parameter Name

Data Type

Default Value

Description

eForceAxis

FORCE_AXIS

Axis to check the position range (X, Y, Z, Rx, Ry, Rz).

fTargetMin

float

Minimum absolute threshold for the position value.

fTargetMax

float

Maximum absolute threshold for the position value.

eForceReference

COORDINATE_SYSTEM

COORDINATE_SYSTEM_TOOL

Reference coordinate system for position comparison (TOOL, BASE, or WORLD).

Return

Value

Description

1

Condition True — current position is within range.

0

Condition False — current position is outside range.

Example A — Manual Mode (Teaching Position Validation)

#include "DRFLEx.h"
#include <cstdio>
using namespace DRAFramework;

int main() {
    CDRFLEx drfl;
    // Preconditions: Connected, servo ON, Teach mode active

    // 1) Verify position conditions within defined ranges
    bool cx = drfl.check_position_condition_abs(FORCE_AXIS_X, 300.f, 400.f, COORDINATE_SYSTEM_BASE);
    bool cy = drfl.check_position_condition_abs(FORCE_AXIS_Y, -500.f, 500.f);
    bool cz = drfl.check_position_condition_abs(FORCE_AXIS_Z, 100.f, 200.f);

    printf("Check X,Y,Z positions: %d %d %d\n", cx, cy, cz);
    return 0;
}

Example B — Auto Mode (Process Position Monitoring)

// Preconditions:
// - Auto mode active
// - Robot performing automated positioning

// 1) Move toward a target point
float p_target[NUM_TASK] = {550.f, 200.f, 120.f, 180.f, 0.f, 0.f};
drfl.movel(p_target, (float[2]){100.f, 30.f}, (float[2]){400.f, 150.f});
drfl.mwait();

// 2) Verify position range for insertion readiness
bool withinZ = drfl.check_position_condition_abs(FORCE_AXIS_Z, 90.f, 130.f, COORDINATE_SYSTEM_TOOL);
bool withinY = drfl.check_position_condition_abs(FORCE_AXIS_Y, 180.f, 220.f, COORDINATE_SYSTEM_BASE);

if (withinZ && withinY)
    printf("Robot within safe approach zone.\n");
else
    printf("Robot out of expected range — check target alignment.\n");

// 3) Proceed with force-controlled insertion once within range
if (withinZ && withinY) {
    float fTarget[6] = {0.f, 0.f, 25.f, 0.f, 0.f, 0.f};
    unsigned char dir[6] = {0, 0, 1, 0, 0, 0};
    drfl.set_desired_force(fTarget, dir, COORDINATE_SYSTEM_TOOL, 0.3f);
}

Notes & Best Practices

  • Use check_position_condition_abs() to monitor workspace limits, approach validation, or safety thresholds.

  • Always ensure the coordinate frame consistency between your target and reference (TOOL vs BASE).

  • Combine with check_force_condition for hybrid position–force control logic.

  • In Auto mode, check position conditions dynamically to trigger the next motion phase.

  • For relative deviation monitoring (e.g., offset from a target pose), use check_position_condition_rel.