class documentation

One coordinator flavour, commanded and observed. Holds no state machine.

Constructed by the StartupSkill the Binding lands on. A declaration may name a subclass to add a third flavour.

Method __init__ Resolve every ROS2 type this flavour needs, before anything is subscribed or called.
Method __repr__ Return a representation naming the flavour and what it drives.
Async Method appearances Yield how many publishers one node's transition_event has, now and on each change.
Async Method apply Drive every node toward what one Skill trigger means, and return what went wrong.
Async Method close Close every subscription this Driver opened. Idempotent.
Async Method offered_transitions Ask one node which transitions it will accept right now.
Async Method open Subscribe to every node's transition_event.
Async Method read_state Ask one node what state it is in. One call, never a poll.
Async Method send Command one transition at the nodes that will accept it, the way this flavour does.
Async Method transitions Yield every transition one node announces, until its subscription closes.
Class Variable coordinates_a_set Whether path names a coordinator other than the node it drives, so that the nodes need to be listed. True for a nav2 manager, false for the standard flavour.
Class Variable flavour The name a declaration selects this Driver by, and its key in DRIVERS.
Property binding Return the declaration this Driver was built from.
Property paths Return the lifecycle nodes this Driver observes, in declaration order.
Async Method _call Call one ROS2 service, answering None when the call does not happen.
Async Method _gate Ask each node which transitions it offers, keeping silence apart from none.
Instance Variable _binding Undocumented
Instance Variable _event_type Undocumented
Instance Variable _get_available Undocumented
Instance Variable _get_state Undocumented
Instance Variable _runtime Undocumented
Instance Variable _subscriptions Undocumented
def __init__(self, *, binding: LifecycleBinding, runtime: RuntimeInterface):

Resolve every ROS2 type this flavour needs, before anything is subscribed or called.

A missing interface package is a declaration error and fatal at init.

Parameters
binding:LifecycleBindingWhat to drive.
runtime:RuntimeInterfaceThe Machine's Runtime, reached through the Component.
Raises
MessageTypeErrorWhen an interface package this flavour needs is not installed.
def __repr__(self) -> str:

Return a representation naming the flavour and what it drives.

async def appearances(self, path: str) -> AsyncIterator[int]:

Yield how many publishers one node's transition_event has, now and on each change.

The current count arrives at once, so a Driver opened against a node that is already there looks immediately.

async def apply(self, trigger: TRIGGER, ledger: dict[str, set[LifecycleNodeTransition]] | None = None) -> tuple[str, ...]:

Drive every node toward what one Skill trigger means, and return what went wrong.

The trigger's transitions run in order (TRANSITIONS_FOR), each gated per node on what that node offers at that moment. The gate is read before the first transition and again between transitions, because deactivating is what makes cleaning up available.

A node that answered and does not offer the transition is skipped without a fault, which makes the handlers idempotent. A node that did not answer is a fault, so that a robot that is off cannot let Start reach Running; it is asked once per trigger.

The ledger records what the Skill performed itself, and halt rolls back those transitions and no others. A node that was already active before Start has an empty ledger and is not touched.

Parameters
trigger:TRIGGERThe Skill trigger to carry out.
ledger:dict[str, set[LifecycleNodeTransition]] | NoneWhat the Skill performed on each node, by path. Updated in place. None is an empty ledger.
Returns
tuple[str, ...]One fault per node or coordinator that did not answer or said no. Empty is success, including having had nothing to do.
async def close(self):

Close every subscription this Driver opened. Idempotent.

async def offered_transitions(self, path: str) -> frozenset[LifecycleNodeTransition] | None:

Ask one node which transitions it will accept right now.

This is the gate. It is read from the robot, because a stale belief about the state would kill an rclpy node. The name avoids "available", which this project does not use for a state of the robot.

Returns
frozenset[LifecycleNodeTransition] | NoneThe transitions this project can command among those the node offers. The set is empty for a finalized node, and None when nobody answered. The two differ: a node that offers nothing is skipped, a node that is not there is a fault.
async def open(self):

Subscribe to every node's transition_event.

Subscribing is local, so a Component whose robot is off still finishes building. The first question goes out later, when the match events say a node is there.

async def read_state(self, path: str) -> LifecycleNodeState | None:

Ask one node what state it is in. One call, never a poll.

Returns
LifecycleNodeState | NoneThe state, or None when nobody answered (the node is off).
@abstractmethod
async def send(self, transition: LifecycleNodeTransition, paths: tuple[str, ...]) -> Sequence[str]:

Command one transition at the nodes that will accept it, the way this flavour does.

Called only for a transition at least one of paths reported as available, so an implementation does not gate again.

Parameters
transition:LifecycleNodeTransitionWhat to command.
paths:tuple[str, ...]The nodes that offered it, a non-empty subset of paths.
Returns
Sequence[str]One human-readable fault per refusal or missing answer; empty on success. Faults are returned so that an operator sees every cause, not the first.
async def transitions(self, path: str) -> AsyncIterator[NodeTransition]:

Yield every transition one node announces, until its subscription closes.

coordinates_a_set: ClassVar[bool] =

Whether path names a coordinator other than the node it drives, so that the nodes need to be listed. True for a nav2 manager, false for the standard flavour.

flavour: ClassVar[str] =

The name a declaration selects this Driver by, and its key in DRIVERS.

@property
binding: LifecycleBinding =

Return the declaration this Driver was built from.

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

Return the lifecycle nodes this Driver observes, in declaration order.

async def _call(self, service: str, types: ServiceTypes, request: Message) -> Message | None:

Call one ROS2 service, answering None when the call does not happen.

A node that is off is a runtime condition, not a fault. The commanding path turns the missing answer into a message.

async def _gate(self, paths: Iterable[str]) -> tuple[dict[str, frozenset[LifecycleNodeTransition]], list[str]]:

Ask each node which transitions it offers, keeping silence apart from none.

A node that offered nothing is carried with an empty set. A node that did not answer is a fault and is dropped from the set the following transitions gate on.

Parameters
paths:Iterable[str]The nodes to ask, in the order their faults should be reported in.
Returns
tuple[dict[str, frozenset[LifecycleNodeTransition]], list[str]]What each node that answered offers, and one fault per node that did not.
_binding =

Undocumented

_event_type =

Undocumented

_get_available: ServiceTypes =

Undocumented

_get_state: ServiceTypes =

Undocumented

_runtime =

Undocumented

_subscriptions: dict[str, Subscription] =

Undocumented