class documentation

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_qos_incompatibilities Yield every QoS incompatibility reported on this topic, from the first one onwards.
Async Method publisher_counts Yield the publisher count now, and again each time it changes.
Async Method receive Await the next message.
Property message_type Return the message dataclass every payload from this subscription is an instance of.
Property publisher_count 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_incompatibilities Return every QoS incompatibility the middleware has reported on this topic.
Property qos_provenance 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_hash_mismatches 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_type Undocumented
Instance Variable _release Undocumented
Instance Variable _sink Undocumented
Instance Variable _topic Undocumented
def __aiter__(self) -> AsyncIterator[Message]:

Return an iterator yielding messages until the subscription is closed.

def __init__(self, *, topic: 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.

def __repr__(self) -> str:

Return a representation naming the topic and the ROS2 type.

async def close(self):

End this subscription, releasing its ROS2 resources.

Idempotent.

async def follow_qos_incompatibilities(self) -> AsyncIterator[QoSIncompatibility]:

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.

async def publisher_counts(self) -> AsyncIterator[int]:

Yield the publisher count now, and again each time it changes.

The first value arrives without waiting. The iteration ends when the subscription closes.

async def receive(self) -> Message:

Await the next message.

Raises
SubscriptionClosedErrorWhen the subscription is closed and nothing is buffered.
@property
message_type: type[Message] =

Return the message dataclass every payload from this subscription is an instance of.

@property
publisher_count: int =

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.

@property
qos: QoSProfile =

Return the QoS profile in force; it moves only when a discovered profile adapts.

@property
qos_incompatibilities: tuple[QoSIncompatibility, ...] =

Return every QoS incompatibility the middleware has reported on this topic.

@property
qos_provenance: Provenance =

Return where the profile came from: DISCOVERED (may adapt) or DECLARED (never moves).

@property
topic: str =

Return the ROS2 topic this subscription is on.

@property
type_hash_mismatches: tuple[TypeHashMismatch, ...] =

Return every publisher seen whose type hash is not the one built against (stale definition).

async def _stream(self) -> AsyncIterator[Message]:

Yield messages until the subscription is closed, then stop cleanly.

_message_type =

Undocumented

_release =

Undocumented

_sink =

Undocumented

_topic =

Undocumented