class documentation

One topic's QoS negotiation, and the rclpy subscription it is currently expressed as.

The two event methods run on the Runtime's loop and decide synchronously, before any await, whether to swap, so a second match event cannot spend the same bootstrap tightening twice. The swap itself is a task because rclpy calls block.

Method __init__ Bind one negotiation to the two rclpy steps and the graph read the Runtime owns.
Async Method close Let any swap in flight finish, then destroy the rclpy subscription, once.
Method incompatible Report one incompatibility, and relax only if this profile was discovered.
Method matched Record the publisher count, and spend the one bootstrap tightening when it is due.
Async Method open Create the first rclpy subscription, with whatever the negotiation opened at.
Async Method _recreate Try to create the rclpy subscription with one profile, saying whether it worked.
Async Method _resubscribe Destroy the current rclpy subscription and create one asking for profile.
Method _swap Start the re-subscription as a task that close can wait for.
Instance Variable _closed Undocumented
Instance Variable _create Undocumented
Instance Variable _destroy Undocumented
Instance Variable _loop Undocumented
Instance Variable _negotiation Undocumented
Instance Variable _publishers Undocumented
Instance Variable _sink Undocumented
Instance Variable _subscription Undocumented
Instance Variable _swapping Undocumented
Instance Variable _tasks Undocumented
Instance Variable _topic Undocumented
def __init__(self, *, topic: str, negotiation: QoSNegotiation, sink: SubscriptionSink, loop: asyncio.AbstractEventLoop, create: Callable[[QoSProfile], Awaitable[Any]], destroy: Callable[[Any], Awaitable[None]], publishers: Callable[[], tuple[EndpointInfo, ...]]):

Bind one negotiation to the two rclpy steps and the graph read the Runtime owns.

async def close(self):

Let any swap in flight finish, then destroy the rclpy subscription, once.

A swap in flight is waited out, not cancelled: cancelling an asyncio.to_thread call stops the await but not the thread, which would leave a subscription nobody holds.

def incompatible(self, policy: Policy):

Report one incompatibility, and relax only if this profile was discovered.

def matched(self, count: int):

Record the publisher count, and spend the one bootstrap tightening when it is due.

async def open(self):

Create the first rclpy subscription, with whatever the negotiation opened at.

async def _recreate(self, profile: QoSProfile) -> bool:

Try to create the rclpy subscription with one profile, saying whether it worked.

async def _resubscribe(self, profile: QoSProfile):

Destroy the current rclpy subscription and create one asking for profile.

The old subscription goes first, so two never report match events into one sink; the cost is a few milliseconds of missed messages. The publisher count goes back to zero and is rebuilt from the new subscription's match events, because destroying a subscription discards its match state without an event; a carried-over count could leave a variable reading Good after its publisher went away, at the price of a momentary BadNoCommunication.

def _swap(self, profile: QoSProfile):

Start the re-subscription as a task that close can wait for.

_closed: bool =

Undocumented

_create =

Undocumented

_destroy =

Undocumented

_loop =

Undocumented

_negotiation =

Undocumented

_publishers =

Undocumented

_sink =

Undocumented

_subscription: Any =

Undocumented

_swapping =

Undocumented

_tasks: set[asyncio.Task[None]] =

Undocumented

_topic =

Undocumented