robokudo.io.tf_listener_proxy

Per-node TF listener management for RoboKudo.

ROS 2 transform lookups are performed through a tf2_ros.Buffer, while the corresponding tf2_ros.TransformListener must stay alive to keep the buffer populated from /tf and /tf_static. This module exposes a KRROOD-style singleton manager that creates and retains exactly one listener and buffer pair per ROS node.

Classes

_NodeTFListener

TF listener state owned for a single ROS node.

TFListenerProxy

Singleton entry point for per-node TF listener buffers.

Module Contents

class robokudo.io.tf_listener_proxy._NodeTFListener

TF listener state owned for a single ROS node.

buffer: tf2_ros.Buffer
listener: tf2_ros.TransformListener
class robokudo.io.tf_listener_proxy.TFListenerProxy

Singleton entry point for per-node TF listener buffers.

The proxy itself is process-global, but the cached listener state is keyed by ROS node identity. Reusing a node returns the same buffer; using a different node creates a separate Buffer/TransformListener pair.

_listeners_by_node_id: dict[int, _NodeTFListener]
_lock: threading.Lock
buffer_for_node(node: rclpy.node.Node) → tf2_ros.Buffer

Return the TF buffer associated with node.

The listener is retained internally so subscriptions keep feeding the returned buffer for as long as the proxy cache entry exists.

Parameters:

node – The ROS 2 node that owns the transform listener.

Returns:

The TF buffer populated by that node’s listener.

clear_node(node: rclpy.node.Node) → None

Forget the cached listener for node if one exists.

clear_cached_listeners() → None

Forget all cached per-node TF listeners while keeping this proxy.

classmethod clear() → None

Clear all cached TF listener state for this process.