class documentation

The frame network, for as long as anything is watching it.

Construct one through opensmi.ros2.runtime.runtime.Runtime. The facet is self-disabling like the graph and parameter facets: a Machine with no TF Binding never subscribes to /tf, the most expensive topic on a busy robot.

Method __init__ Describe a facet without subscribing to or advertising anything.
Method __repr__ Return a representation naming the state and the frame count.
Async Method broadcast Put every link on whichever of the two transform topics it belongs on.
Async Method close End every watch and close every endpoint, which is what stopping the Runtime does.
Method lookup Return where source sits in target, or None when the buffer cannot say.
Async Method settle Close both subscriptions and both publishers if nothing is watching. Called by a closing watch.
Async Method watch Register interest in TF, opening both subscriptions if they were not open.
Property broadcasting Return whether the two publishers are open, which they are while a publishing watch is.
Property frames Return the frame network as the messages so far describe it, keyed by child frame.
Property now Return what time it is in seconds, off the same clock a broadcast is stamped from.
Property reading Return whether the two subscriptions are open, which they are while a watch is.
Property roots Return every frame that is nobody's child, which is where the tree terminates.
Property satisfied Return whether anything else is publishing transforms right now.
Property seen Return when each frame was last in a message, on this Runtime's own clock.
Async Method _follow Record every message of one transform topic, until the subscription closes.
Async Method _open Open both transform topics, unless they are already open.
Async Method _open_outward Advertise both transform topics, unless they are already advertised.
Method _ours_on Return how many publishers this facet holds on one of the two topics (one or none).
Method _record Put one message into the topology record and into the transform buffer.
Method _require_advertised Refuse a broadcast on a facet nothing declared an outward frame on.
Method _require_one_frame_network Refuse a second watch that reads TF from somewhere else.
Instance Variable _advertise Undocumented
Instance Variable _clock Undocumented
Instance Variable _clock_started Undocumented
Instance Variable _feed Undocumented
Instance Variable _frames Undocumented
Instance Variable _lookup Undocumented
Instance Variable _outward Undocumented
Instance Variable _reading Undocumented
Instance Variable _seen Undocumented
Instance Variable _sources Undocumented
Instance Variable _subscribe Undocumented
Instance Variable _watches Undocumented
def __init__(self, *, subscribe: SubscribeFunction, advertise: AdvertiseFunction, feed: FeedFunction, lookup: LookupFunction, clock: ClockFunction):

Describe a facet without subscribing to or advertising anything.

The topics, and whether it publishes, are the first watch's: they come from a declaration.

Parameters
subscribe:SubscribeFunctionHow to open a topic inward. The Runtime's own.
advertise:AdvertiseFunctionHow to open a topic outward. The Runtime's own.
feed:FeedFunctionHow one message reaches the transform buffer.
lookup:LookupFunctionHow a composed pose is asked of that buffer.
clock:ClockFunctionWhat time it is, off the ROS2 Node's own clock.
def __repr__(self) -> str:

Return a representation naming the state and the frame count.

async def broadcast(self, links: Iterable[FrameLink]):

Put every link on whichever of the two transform topics it belongs on.

One message per topic rather than per link, so a subscriber wakes once. An empty call sends nothing. The stamp is one reading of the Runtime's clock for the whole call.

Parameters
links:Iterable[FrameLink]The links to publish. Each goes on /tf_static when it says it is static and on /tf otherwise.
Raises
ROS2RuntimeErrorWhen no watch on this facet declared that it broadcasts. This is checked before the payload, so an empty call is refused on the same Machine a full one would be.
PublishFailedErrorWhen rclpy refused to send one of the two messages.
async def close(self):

End every watch and close every endpoint, which is what stopping the Runtime does.

def lookup(self, *, target: str, source: str) -> Transform | None:

Return where source sits in target, or None when the buffer cannot say.

Synchronous and non-blocking: a chain the buffer cannot complete answers None instead of waiting.

async def settle(self):

Close both subscriptions and both publishers if nothing is watching. Called by a closing watch.

async def watch(self, *, topic: str = TF_TOPIC, static_topic: str = TF_STATIC_TOPIC, depth: int = TF_DEPTH, broadcasting: bool = False) -> TFWatch:

Register interest in TF, opening both subscriptions if they were not open.

The first watch decides where TF is read from and every later one must agree. One Runtime is one Domain ID and one frame network, so a second watch naming other topics is refused at init. Whether the Runtime publishes is a union instead: one declaration that wants to publish is enough.

Parameters
topic:strThe moving-transform topic, which a deployment may have remapped.
static_topic:strThe static-transform topic.
depth:intHow many messages each of the two subscriptions buffers.
broadcasting:boolWhether what opened this watch also publishes a frame of its own, which advertises the two topics. It is asked here, at init, because satisfied discounts our own publisher and the count must not change meaning at the first tick.
Returns
TFWatchA handle carrying its own lifetime. Close it when the Binding behind it is torn down. The subscriptions and publishers close with the last watch.
Raises
ROS2RuntimeErrorWhen an earlier watch opened different sources.
@property
broadcasting: bool =

Return whether the two publishers are open, which they are while a publishing watch is.

False on a Machine that declares no frame of its own.

@property
frames: Mapping[str, FrameLink] =

Return the frame network as the messages so far describe it, keyed by child frame.

This is a live view of the facet's record, not a copy.

@property
now: float =

Return what time it is in seconds, off the same clock a broadcast is stamped from.

This is the ROS2 Node's clock and not time.monotonic, because replayed data under use_sim_time advances the Node's clock and not the wall's. An unset clock reads zero, which makes every frame equally old and none stale. When the clock starts, _record re-bases earlier stamps so that the robot does not appear to go silent at once.

@property
reading: bool =

Return whether the two subscriptions are open, which they are while a watch is.

@property
roots: tuple[str, ...] =

Return every frame that is nobody's child, which is where the tree terminates.

@property
satisfied: bool =

Return whether anything else is publishing transforms right now.

Presence, not data: a publisher that has sent nothing yet still means the robot is on. Either topic counts. Our own publisher is discounted, because a subscription's matched count includes it (checked on Jazzy) and a required TF Binding would otherwise reach Running against a robot that is off.

@property
seen: Mapping[str, float] =

Return when each frame was last in a message, on this Runtime's own clock.

A link stays in frames once it has arrived, so this is what tells a frame that is published and has not moved from one whose publisher stopped. It is separate from FrameLink because an outgoing link has no arrival time. Like frames, it is a live view.

async def _follow(self, subscription: Subscription, *, static: bool):

Record every message of one transform topic, until the subscription closes.

async def _open(self, wanted: _Sources):

Open both transform topics, unless they are already open.

Static first, so a transient-local frame is in the record before the first moving one. Neither subscription declares a profile, so both are discovered: the publishers decide what is on somebody else's topic. That also recovers a transient-local /tf_static history whether its publisher was up before us or comes up later.

async def _open_outward(self, wanted: _Sources):

Advertise both transform topics, unless they are already advertised.

They are the pair the subscriptions use, so a remapped /tf is published where it is read. What we publish comes back through our own subscription.

def _ours_on(self, static: bool) -> int:

Return how many publishers this facet holds on one of the two topics (one or none).

def _record(self, message: Message, *, static: bool):

Put one message into the topology record and into the transform buffer.

The record feeds the partition and the buffer answers composed poses. Feeding the buffer may raise on a transform tf2 refuses (an infinite value, a leading slash), which loses one transform. Arrival is stamped per frame, because one message does not come from one publisher (an arm driver dying silences only its frames), and from our own clock, not the message's stamp, which a drifting clock or a replayed bag can put anywhere.

def _require_advertised(self):

Refuse a broadcast on a facet nothing declared an outward frame on.

Raises
ROS2RuntimeErrorAlways, when the publishers are not open.
def _require_one_frame_network(self, wanted: _Sources):

Refuse a second watch that reads TF from somewhere else.

Raises
ROS2RuntimeErrorWhen they do not agree.
_advertise =

Undocumented

_clock =

Undocumented

_clock_started: bool =

Undocumented

_feed =

Undocumented

_frames: dict[str, FrameLink] =

Undocumented

_lookup =

Undocumented

_outward: dict[bool, Publisher] =

Undocumented

_reading: _Sources | None =

Undocumented

_seen: dict[str, float] =

Undocumented

_sources: list[_Source] =

Undocumented

_subscribe =

Undocumented

_watches: list[TFWatch] =

Undocumented