API reference

EN KO

Wrapper module

class ur_rtde_api.UR_RTDE(HOST: str = '192.168.1.7', FREQUENCY_HZ: float = 25.0, FIELD: Sequence[str] | None = None, *, TIMEOUT: float = 2.0, PROTOCOL_VERSION: int = 2, READBACK_WRITES: bool = True)[source]

Bases: URRobot

Very small user-facing RTDE API.

Example

robot = UR_RTDE(HOST=DEFAULT_HOST, FREQUENCY_HZ=25, FIELD=[“time”, “q”, “tcp”, “gp.int.0”]) robot.start() print(robot[“q”]) robot[“gp.int.0”] = 33 robot.stop() robot.close()

Notes

  • FIELD contains both readable fields and writable GP input fields.

  • gp.int.0 -> input_int_register_24

  • gp.double.0 -> input_double_register_24

  • gp.bit.0 -> input_bit_register_64

  • Direct UR numbering also works, for example gp.int.24 and gp.bit.64.

property FIELD: Tuple[str, ...]
property FREQUENCY_HZ: float
property HOST: str
class ur_rtde_api.URRobot(host: str = '192.168.1.7', *, frequency_hz: float = 25.0, fields: Sequence[str] | None = None, writes: Sequence[str] | None = None, timeout: float = 2.0, protocol_version: int = 2, readback_writes: bool = True)[source]

Bases: object

Small RTDE core focused on frequency, fields, and writable areas.

can_write(name: str) bool[source]
close() None[source]
async close_async() None[source]
configure(*, frequency_hz: float | None = None, fields: Sequence[str] | None = None, writes: Sequence[str] | None = None) None[source]
connect() Tuple[int, int, int, int][source]
async connect_async() Tuple[int, int, int, int][source]
property controller_version: Tuple[int, int, int, int] | None
digital_input(bit: int) bool[source]
digital_output(bit: int) bool[source]
property fields: Tuple[str, ...]
property frame: RobotFrame
property frame_index: int
has(name: str) bool[source]
property input_fields: Tuple[str, ...]
property is_connected: bool
property is_streaming: bool
joint_deg() Tuple[float, ...]
latest_frame() RobotFrame[source]
property output_fields: Tuple[str, ...]
pause() None
q_deg() Tuple[float, ...][source]
read(name: str, default: ~typing.Any = <object object>) Any[source]
reader_rates() Dict[str, float][source]
set_speed_slider(fraction: float, *, settle_s: float = 0.1, release_mask: bool = True) float[source]
snapshot() Dict[str, Any][source]
speed_slider_state() Dict[str, Any][source]
start(*, wait_ready: bool = True, ready_timeout: float | None = None) None[source]
async start_async(*, wait_ready: bool = True, ready_timeout: float | None = None) None[source]
stop() None[source]
async stop_async() None[source]
tcp_mm() Tuple[float, float, float, float, float, float][source]
tcp_mm_deg() Tuple[float, float, float, float, float, float][source]
tcp_pose(mode: str = 'rotvec_rad') Tuple[float, float, float, float, float, float][source]

Return TCP pose converted for display.

mode:
  • “rotvec_rad”: [x_mm, y_mm, z_mm, rx, ry, rz]

  • “rotvec_deg”: [x_mm, y_mm, z_mm, rx_deg, ry_deg, rz_deg]

  • “rpy_rad”: [x_mm, y_mm, z_mm, roll, pitch, yaw]

  • “rpy_deg”: [x_mm, y_mm, z_mm, roll_deg, pitch_deg, yaw_deg]

tcp_rpy() Tuple[float, float, float, float, float, float][source]
tcp_rpy_deg() Tuple[float, float, float, float, float, float][source]
unit_of(name: str) Any[source]
wait_next_frame(*, last_frame_index: int | None = None, timeout: float | None = None) RobotFrame[source]
async wait_next_frame_async(*, last_frame_index: int | None = None, timeout: float | None = None) RobotFrame[source]
wait_ready(timeout: float | None = None) RobotFrame[source]
async wait_ready_async(timeout: float | None = None) RobotFrame[source]
write(name: str, value: Any) None[source]
write_many(values: Dict[str, Any], *, flush: bool | None = None) None[source]
property writes: Tuple[str, ...]
class ur_rtde_api.RobotFrame(values: 'Dict[str, Any]', frame_index: 'int', robot_timestamp_s: 'Optional[float]', received_monotonic_s: 'float', received_wall_time_s: 'float', source_frequency_hz: 'float')[source]

Bases: object

age_ms(now_monotonic: float | None = None) float[source]
age_s(now_monotonic: float | None = None) float[source]
as_dict() Dict[str, Any][source]
get(name: str, default: Any = None) Any[source]
to_json(*, indent: int = 2) str[source]
values: Dict[str, Any]
frame_index: int
robot_timestamp_s: float | None
received_monotonic_s: float
received_wall_time_s: float
source_frequency_hz: float
ur_rtde_api.rad_to_deg(values: Any) Any[source]
ur_rtde_api.rotvec_to_rpy(rotvec: Sequence[float]) Tuple[float, float, float][source]

Convert UR rotation vector [rx, ry, rz] to RPY [roll, pitch, yaw] in radians.

Uses the same convention documented by Universal Robots for rotvec2rpy(): R = Rz(yaw) * Ry(pitch) * Rx(roll).

Core RTDE module

class backend.ur_robot.RobotFrame(values: 'Dict[str, Any]', frame_index: 'int', robot_timestamp_s: 'Optional[float]', received_monotonic_s: 'float', received_wall_time_s: 'float', source_frequency_hz: 'float')[source]

Bases: object

values: Dict[str, Any]
frame_index: int
robot_timestamp_s: float | None
received_monotonic_s: float
received_wall_time_s: float
source_frequency_hz: float
get(name: str, default: Any = None) Any[source]
age_s(now_monotonic: float | None = None) float[source]
age_ms(now_monotonic: float | None = None) float[source]
as_dict() Dict[str, Any][source]
to_json(*, indent: int = 2) str[source]
class backend.ur_robot.URRobot(host: str = '192.168.1.7', *, frequency_hz: float = 25.0, fields: Sequence[str] | None = None, writes: Sequence[str] | None = None, timeout: float = 2.0, protocol_version: int = 2, readback_writes: bool = True)[source]

Bases: object

Small RTDE core focused on frequency, fields, and writable areas.

property controller_version: Tuple[int, int, int, int] | None
property fields: Tuple[str, ...]
property writes: Tuple[str, ...]
property output_fields: Tuple[str, ...]
property input_fields: Tuple[str, ...]
property is_connected: bool
property is_streaming: bool
property frame: RobotFrame
property frame_index: int
configure(*, frequency_hz: float | None = None, fields: Sequence[str] | None = None, writes: Sequence[str] | None = None) None[source]
connect() Tuple[int, int, int, int][source]
async connect_async() Tuple[int, int, int, int][source]
start(*, wait_ready: bool = True, ready_timeout: float | None = None) None[source]
async start_async(*, wait_ready: bool = True, ready_timeout: float | None = None) None[source]
stop() None[source]
pause() None
async stop_async() None[source]
close() None[source]
async close_async() None[source]
wait_ready(timeout: float | None = None) RobotFrame[source]
async wait_ready_async(timeout: float | None = None) RobotFrame[source]
wait_next_frame(*, last_frame_index: int | None = None, timeout: float | None = None) RobotFrame[source]
async wait_next_frame_async(*, last_frame_index: int | None = None, timeout: float | None = None) RobotFrame[source]
latest_frame() RobotFrame[source]
snapshot() Dict[str, Any][source]
has(name: str) bool[source]
can_write(name: str) bool[source]
read(name: str, default: ~typing.Any = <object object>) Any[source]
write_many(values: Dict[str, Any], *, flush: bool | None = None) None[source]
write(name: str, value: Any) None[source]
set_speed_slider(fraction: float, *, settle_s: float = 0.1, release_mask: bool = True) float[source]
speed_slider_state() Dict[str, Any][source]
q_deg() Tuple[float, ...][source]
joint_deg() Tuple[float, ...]
tcp_pose(mode: str = 'rotvec_rad') Tuple[float, float, float, float, float, float][source]

Return TCP pose converted for display.

mode:
  • “rotvec_rad”: [x_mm, y_mm, z_mm, rx, ry, rz]

  • “rotvec_deg”: [x_mm, y_mm, z_mm, rx_deg, ry_deg, rz_deg]

  • “rpy_rad”: [x_mm, y_mm, z_mm, roll, pitch, yaw]

  • “rpy_deg”: [x_mm, y_mm, z_mm, roll_deg, pitch_deg, yaw_deg]

tcp_mm() Tuple[float, float, float, float, float, float][source]
tcp_mm_deg() Tuple[float, float, float, float, float, float][source]
tcp_rpy() Tuple[float, float, float, float, float, float][source]
tcp_rpy_deg() Tuple[float, float, float, float, float, float][source]
unit_of(name: str) Any[source]
digital_input(bit: int) bool[source]
digital_output(bit: int) bool[source]
reader_rates() Dict[str, float][source]
class backend.ur_robot.UR_RTDE(HOST: str = '192.168.1.7', FREQUENCY_HZ: float = 25.0, FIELD: Sequence[str] | None = None, *, TIMEOUT: float = 2.0, PROTOCOL_VERSION: int = 2, READBACK_WRITES: bool = True)[source]

Bases: URRobot

Very small user-facing RTDE API.

Example

robot = UR_RTDE(HOST=DEFAULT_HOST, FREQUENCY_HZ=25, FIELD=[“time”, “q”, “tcp”, “gp.int.0”]) robot.start() print(robot[“q”]) robot[“gp.int.0”] = 33 robot.stop() robot.close()

Notes

  • FIELD contains both readable fields and writable GP input fields.

  • gp.int.0 -> input_int_register_24

  • gp.double.0 -> input_double_register_24

  • gp.bit.0 -> input_bit_register_64

  • Direct UR numbering also works, for example gp.int.24 and gp.bit.64.

property HOST: str
property FREQUENCY_HZ: float
property FIELD: Tuple[str, ...]
backend.ur_robot.expand_fields(tokens: Sequence[str]) List[str][source]
backend.ur_robot.expand_output_fields(tokens: Sequence[str]) List[str][source]
backend.ur_robot.normalize_token(token: str) str[source]
backend.ur_robot.rad_to_deg(values: Any) Any[source]
backend.ur_robot.rotvec_to_rpy(rotvec: Sequence[float]) Tuple[float, float, float][source]

Convert UR rotation vector [rx, ry, rz] to RPY [roll, pitch, yaw] in radians.

Uses the same convention documented by Universal Robots for rotvec2rpy(): R = Rz(yaw) * Ry(pitch) * Rx(roll).

backend.ur_robot.probe_rtde_compatibility(host: str, *, frequency_hz: float, fields: Sequence[str], protocol_version: int = 2, timeout: float = 2.0, base_fields: Sequence[str] | None = None) Dict[str, Any][source]