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 |
Advertise both transform topics, unless they are already advertised. |
| Method | _ours |
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 |
Refuse a broadcast on a facet nothing declared an outward frame on. |
| Method | _require |
Refuse a second watch that reads TF from somewhere else. |
| Instance Variable | _advertise |
Undocumented |
| Instance Variable | _clock |
Undocumented |
| Instance Variable | _clock |
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 |
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:SubscribeFunction | How to open a topic inward. The Runtime's own. |
advertise:AdvertiseFunction | How to open a topic outward. The Runtime's own. |
feed:FeedFunction | How one message reaches the transform buffer. |
lookup:LookupFunction | How a composed pose is asked of that buffer. |
clock:ClockFunction | What time it is, off the ROS2 Node's own clock. |
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[ | The links to publish. Each goes on /tf_static when it says it is static and on /tf otherwise. |
| Raises | |
ROS2RuntimeError | When 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. |
PublishFailedError | When rclpy refused to send one of the two messages. |
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.
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:str | The moving-transform topic, which a deployment may have remapped. |
staticstr | The static-transform topic. |
depth:int | How many messages each of the two subscriptions buffers. |
broadcasting:bool | Whether 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 | |
TFWatch | A 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 | |
ROS2RuntimeError | When an earlier watch opened different sources. |
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.
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.
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.
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.
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.
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.
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.
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.
Refuse a broadcast on a facet nothing declared an outward frame on.
| Raises | |
ROS2RuntimeError | Always, when the publishers are not open. |