module documentation

Required Bindings: the StartupSkill's contract, and what a client sees at startup.

A Binding marked required=True means that the StartupSkill of the machinery item that declared it does not reach Running until the Binding is Satisfied, which means its ROS2 counterpart is present. If its deadline passes first, the Skill halts and opensmi's own supervision reports the Machine OutOfService. Satisfied is presence, never first data: a publisher that has not spoken satisfies a Binding. satisfaction_of holds the answer per kind, and both the StartupSkill and the introspection Component's provenance report use it, so they cannot disagree.

Nothing waits before the endpoint opens. Every _init creates its nodes and returns, and the wait happens inside _handle_starting, so the Skill is observably Starting meanwhile. The Machine and Component mixins add ROS2StartupSkill themselves, because opensmi does not require a StartupSkill; its starting handler waits for the declarations first and asks every child for its verdict instead of stopping at the first.

Every Binding fires REQUIRED_BINDING_ABSENT at its own deadline, and the halt at the last one names every Binding that missed. A Binding lost after startup is reported (REQUIRED_BINDING_LOST) but never halts, so a restarted sensor node cannot tear a robot down mid-goal; recovery is Reset plus Start, and the check re-runs on every start. A normal boot is quiet: no event when a Binding becomes satisfied, and none about a Binding that is not required. The satisfaction facts are polled every CHECK_INTERVAL seconds, since the kinds learn presence in different ways and share no event stream.

Class Prerequisite One required Binding, as the wait sees it: a deadline and a question to ask.
Class ROS2StartupSkill The StartupSkill this package gives a machinery item that has not got a narrower one.
Class StartupGate One machinery item's required Bindings, as the wait and the watch that follow from them.
Async Function close_startup_skills Release every StartupSkill of ours on one machinery item. Idempotent.
Function prerequisites_of Return what one machinery item's StartupSkill waits for, one entry per required Binding.
Function satisfaction_of Return how to ask whether one Binding is Satisfied, or None when the word does not apply.
Async Function wait_for Wait until every prerequisite is Satisfied or its own deadline has passed.
Constant CHECK_INTERVAL Seconds between two readings of anything a starting StartupSkill is waiting on.
Constant COMPONENT_NOT_RUNNING The error code a Machine's halt carries when a Component's StartupSkill did not come up.
Constant LOSS_INTERVAL Seconds between two readings of whether a Binding is still Satisfied, once nothing waits on it.
Constant REQUIRED_BINDING_ABSENT What a required Binding reports when its own deadline passed and it was still not Satisfied.
Constant REQUIRED_BINDING_LOST What a required Binding reports when it was Satisfied after startup and then was not.
Function _deployment_deadline Return the default deadline of the deployment one machinery item is part of.
Function _every_name_is_confirmed Return whether every ROS2 parameter one declaration names is confirmed on its node.
Function _every_node_is_there Return whether every node one lifecycle declaration follows is on the graph.
Function _graph_of Return the Runtime's last graph snapshot, or an empty one without a Runtime.
Function _prerequisite Return one declaration as the wait sees it, with the probe its kind answers through.
Function _reads_the_graph Return whether a kind's presence is read off the graph snapshot, which has to be watched.
Function _verdict Return the fault text of a startup that ran out of time, naming every cause.
async def close_startup_skills(machinery_item: Any):

Release every StartupSkill of ours on one machinery item. Idempotent.

A Machine's and a Component's shutdown both call it, to release the watch behind a required Binding and the lifecycle Skill's subscriptions.

def prerequisites_of(machinery_item: Any) -> tuple[Prerequisite, ...]:

Return what one machinery item's StartupSkill waits for, one entry per required Binding.

Parameters
machinery_item:AnyThe Component or Machine whose declarations these are. One without Bindings, such as every Machine, answers with nothing.
Returns
tuple[Prerequisite, ...]Undocumented
Raises
DeclarationErrorWhen a required Binding's kind has no answer to what Satisfied means for it.
def satisfaction_of(machinery_item: Any, binding: Any) -> Callable[[], bool] | None:

Return how to ask whether one Binding is Satisfied, or None when the word does not apply.

Nothing is asked here, so this works while the Component is still being built. None means the kind has no presence to read, as with a publishing Binding (we are the publisher). The probe reads through getattr, so an item that is not one of ours answers absent.

Monitoring The subscription's publisher count, off its DDS match events. A Binding that is not bound yet is not satisfied.
Keyed The subscription's publisher count, never membership.
Method The service is on the Runtime's last graph snapshot. This reads the snapshot and starts no poll, so it answers absent where nothing watches the graph; the StartupSkill's wait holds a watch open while it asks.
ROS2 parameter Every declared name is confirmed present on the node, read off the parameter mirror.
Action The action is on the Runtime's last graph snapshot, like a service.
Lifecycle A publisher on each declared node's transition_event.
TF Something other than this server publishes on a transform topic, never a particular frame.
async def wait_for(prerequisites: Sequence[Prerequisite], *, report: Callable[[Prerequisite], Awaitable[None]], interval: float = CHECK_INTERVAL) -> tuple[Prerequisite, ...]:

Wait until every prerequisite is Satisfied or its own deadline has passed.

There is no fail-fast and no shared deadline. A prerequisite that misses its deadline is reported at once and counted as missed, even if it arrives later. A prerequisite that is met is dropped and not asked again; if it goes away later, the gate's watch reports it as lost.

Parameters
prerequisites:Sequence[Prerequisite]What to wait for. Empty returns at once.
report:Callable[[Prerequisite], Awaitable[None]]How to announce one that missed its deadline, awaited at that deadline.
interval:floatSeconds between two readings.
Returns
tuple[Prerequisite, ...]The prerequisites that missed their deadlines, in the order they did. Empty means the wait was met.
CHECK_INTERVAL: float =

Seconds between two readings of anything a starting StartupSkill is waiting on.

That is the satisfaction facts and a child Skill's CurrentState. It is the granularity of "the robot came up" for a client watching CurrentState; each Binding's deadline is its own.

Value
0.05
COMPONENT_NOT_RUNNING: str =

The error code a Machine's halt carries when a Component's StartupSkill did not come up.

It is not a BindingEvent, since its subject is a Component. The fault text names every Component that did not reach Running.

Value
'COMPONENT_NOT_RUNNING'
LOSS_INTERVAL: float =

Seconds between two readings of whether a Binding is still Satisfied, once nothing waits on it.

Value
1.0
REQUIRED_BINDING_ABSENT: str =

What a required Binding reports when its own deadline passed and it was still not Satisfied.

One event per Binding, at its own deadline. It is also the error code the halt carries on opensmi's own Notification.

Value
'REQUIRED_BINDING_ABSENT'
REQUIRED_BINDING_LOST: str =

What a required Binding reports when it was Satisfied after startup and then was not.

A warning, since nothing is halted. Reported once per loss: a sensor that flaps twice is reported twice. Coming back is not reported.

Value
'REQUIRED_BINDING_LOST'
def _deployment_deadline(machinery_item: Any) -> float:

Return the default deadline of the deployment one machinery item is part of.

An item outside a Machine of ours gets the ~opensmi.ros2.server.config.ROS2Config default.

def _every_name_is_confirmed(machinery_item: Any, binding: ROS2ParameterBinding) -> bool:

Return whether every ROS2 parameter one declaration names is confirmed on its node.

A Binding whose mirror is not built yet (a Component mid-init) answers with its node path, so it is not satisfied.

def _every_node_is_there(machinery_item: Any, binding: LifecycleBinding) -> bool:

Return whether every node one lifecycle declaration follows is on the graph.

Asked of the Component's own StartupSkill, which follows the nodes.

def _graph_of(machinery_item: Any) -> GraphSnapshot:

Return the Runtime's last graph snapshot, or an empty one without a Runtime.

def _prerequisite(machinery_item: Any, binding: Any, default: float) -> Prerequisite:

Return one declaration as the wait sees it, with the probe its kind answers through.

Raises
DeclarationErrorWhen the Binding is required and its kind has no answer to what Satisfied means for it.
def _reads_the_graph(binding: Any) -> bool:

Return whether a kind's presence is read off the graph snapshot, which has to be watched.

def _verdict(missed: Sequence[Prerequisite]) -> str:

Return the fault text of a startup that ran out of time, naming every cause.