A live subscription to one ROS2 topic, from RuntimeInterface.subscribe.
Iterate it (async for message in subscription) or await receive; end it with
close.
| Method | __aiter__ |
Return an iterator yielding messages until the subscription is closed. |
| Method | __init__ |
Bind a handle to the sink and the teardown the Runtime prepared for it. |
| Method | __repr__ |
Return a representation naming the topic and the ROS2 type. |
| Async Method | close |
End this subscription, releasing its ROS2 resources. |
| Async Method | follow |
Yield every QoS incompatibility reported on this topic, from the first one onwards. |
| Async Method | publisher |
Yield the publisher count now, and again each time it changes. |
| Async Method | receive |
Await the next message. |
| Property | message |
Return the message dataclass every payload from this subscription is an instance of. |
| Property | publisher |
Return how many publishers this subscription is matched with right now. |
| Property | qos |
Return the QoS profile in force; it moves only when a discovered profile adapts. |
| Property | qos |
Return every QoS incompatibility the middleware has reported on this topic. |
| Property | qos |
Return where the profile came from: DISCOVERED (may adapt) or DECLARED (never moves). |
| Property | topic |
Return the ROS2 topic this subscription is on. |
| Property | type |
Return every publisher seen whose type hash is not the one built against (stale definition). |
| Async Method | _stream |
Yield messages until the subscription is closed, then stop cleanly. |
| Instance Variable | _message |
Undocumented |
| Instance Variable | _release |
Undocumented |
| Instance Variable | _sink |
Undocumented |
| Instance Variable | _topic |
Undocumented |
str, message_type: type[ Message], sink: SubscriptionSink, release: Callable[ [], Awaitable[ None]]):
¶
Bind a handle to the sink and the teardown the Runtime prepared for it.
Yield every QoS incompatibility reported on this topic, from the first one onwards.
Recorded entries arrive without waiting, and any adaptation an entry caused has already happened. The iteration ends when the subscription closes.
Yield the publisher count now, and again each time it changes.
The first value arrives without waiting. The iteration ends when the subscription closes.
Await the next message.
| Raises | |
SubscriptionClosedError | When the subscription is closed and nothing is buffered. |
Return how many publishers this subscription is matched with right now.
Zero means nobody is on the other end, which differs from a matched topic that is silent; a Monitoring variable's status code distinguishes the two.