RosTfListener

Inherits: RefCounted

A listener for coordinate transforms in the ROS 2 TF2 system.

Description

RosTfListener allows Godot to query the current spatial relationships between different coordinate frames in the ROS 2 TF2 tree. It is created through RosNode.create_tf_listener().

By listening for transforms, you can determine the position and rotation of robot parts, sensors, or other objects relative to each other or a global frame.

Methods

bool

can_transform(target_frame: String, source_frame: String) const

Variant

lookup_transform(target_frame: String, source_frame: String, timeout_sec: float = 0.0)


Method Descriptions

bool can_transform(target_frame: String, source_frame: String) const 🔗

Returns true if a transformation between source_frame and target_frame is currently available in the TF2 tree.


Variant lookup_transform(target_frame: String, source_frame: String, timeout_sec: float = 0.0) 🔗

Attempts to find the coordinate transformation from source_frame to target_frame. Returns a Transform3D (already converted to the Godot axis convention) representing the position and orientation of the source frame relative to the target frame.

Returns null if the transform is not available, so a failed lookup can be distinguished from a genuine identity transform. If timeout_sec is greater than zero, the lookup blocks for up to that long waiting for the transform to become available (only useful when the executor runs in its default separate thread).