get_rtde_value(key)

Returns the corresponding value of the supplied RTDE output field key.

This function retrieves an RTDE value from the RTDE output buffer, which also can be collected through network clients. The RTDE buffer contains values from the previous time step of the controller.

Parameters

key: RTDE output field key of value to retrieve. See the complete list of available fields and their corresponding field types:

www.universal-robots.com/articles/ur/interface-communication/real-time-data-exchange-rtde-guide/

Return Value

The type of the return value depends on the key parameter and can be one of the following:

  • bool
    • For RTDE field type: BOOL
  • number - either int or float
    • For RTDE field types: UINT8, UINT32, UINT64, INT32, DOUBLE
  • fixed length list of numbers either int or float
    • For RTDE field types: VECTOR3D, VECTOR6D, VECTOR6INT32, VECTOR6UINT32

Example command: get_rtde_value("target_qd")

  • Example Parameters:
    • key = "target_qd" → retrieve target joint velocities.

Logic Program: In a Logic Program, use this function to read built-in RTDE output fields and monitor robot state while the main program is stopped or paused. Alternatively, use the State query methods.

Example — check whether safeguard stop is active:

safety_status = get_rtde_value("safety_status")
# check for Safeguard Stop and Automatic Mode Safeguard Stop
is_safeguard_stop_active = (safety_status == 5 or safety_status == 12)

Example — check whether the main program is paused:

is_program_paused = get_rtde_value("runtime_state") == 4