class ROS2LifecycleStartupSkill(MonitoringMixin, ROS2StartupSkill):
Constructor: ROS2LifecycleStartupSkill(bindings, runtime, **kwargs)
One Component's lifecycle declarations, as the StartupSkill they all land on.
The declaring Component constructs it. A Component may name a subclass through
startup_skill_type. It extends opensmi.ros2.server.required.ROS2StartupSkill with
the managed nodes, so a Component with both required and lifecycle Bindings waits for the
required ones first and then activates its nodes (see _start_the_ros2_side).
| Method | __init__ |
Build a Driver per declaration, before any node exists. |
| Async Method | close |
Stop following and release every subscription. Idempotent. |
| Async Method | close |
Release the gate this Skill inherits, and then its own subscriptions. Idempotent. |
| Property | bindings |
Return the declarations this Skill was built from, in declaration order. |
| Property | drivers |
Return one Driver per declaration, in the same order. |
| Property | node |
Return a copy of whether each declared node is on the graph, by node path. |
| Property | observed |
Return a copy of what each node last said about itself, as the Skill state it means. |
| Property | terminal |
Return the node paths currently latched Terminal, in sorted order. |
| Async Method | _command |
Ask every Driver to drive its nodes toward what one trigger means, and collect faults. |
| Async Method | _condition |
Refuse Reset while any node behind this Skill is Terminal. |
| Async Method | _create |
Give every declared node one Monitoring variable holding its lifecycle state. |
| Async Method | _drive |
Command one trigger at every node, and halt this Skill if anything refused. |
| Method | _fire |
Fire one trigger from a task of its own, never from the task that decided to. |
| Async Method | _follow |
Ask a node what state it is in each time it appears, and only then. |
| Async Method | _follow |
Record every transition one node announces, reading the pair and never the field. |
| Async Method | _handle |
Take back what this Skill brought up, and let opensmi halt what it halts. |
| Async Method | _handle |
Configure every node. |
| Async Method | _init |
Build the Skill, give every node a state variable, and start following. |
| Async Method | _latch |
Latch or lift one node's Terminal condition, firing the event exactly on the latch. |
| Async Method | _note |
Record one thing a node said about itself, and ask for the Skill to be settled. |
| Async Method | _read |
Ask every node where it ended up, rather than assuming the command took it there. |
| Async Method | _report |
Fire one BindingEvent about one node, and never let the reporting be the fault. |
| Method | _require |
Refuse to reach Running unless every node actually reached active. |
| Async Method | _settle |
Fire at most one trigger toward the aggregate, and say whether the Skill could act. |
| Async Method | _settling |
Move the Skill toward what its nodes say, whenever something new has been recorded. |
| Method | _spawn |
Run one following coroutine as a task this Skill owns and cancels. |
| Method | _start |
Start one task per node per signal (transitions and appearances), plus the settling one. |
| Async Method | _start |
Activate every node, and check they all got there. |
| Async Method | _trigger |
Offer one trigger to the state machine, tolerating a state it is not valid from. |
| Method | _weakest |
Return the Binding and node path that dragged the aggregate down to target. |
| Async Method | _write |
Publish one node's lifecycle state as the label ROS2 spells it, with Good status. |
| Instance Variable | _announced |
Undocumented |
| Instance Variable | _bindings |
Undocumented |
| Instance Variable | _commanding |
Undocumented |
| Instance Variable | _drivers |
Undocumented |
| Instance Variable | _emit |
Undocumented |
| Instance Variable | _fired |
Undocumented |
| Instance Variable | _firing |
Undocumented |
| Instance Variable | _observed |
Undocumented |
| Instance Variable | _owner |
Undocumented |
| Instance Variable | _pending |
Undocumented |
| Instance Variable | _performed |
Undocumented |
| Instance Variable | _present |
Undocumented |
| Instance Variable | _tasks |
Undocumented |
| Instance Variable | _terminal |
Undocumented |
| Instance Variable | _variables |
Undocumented |
Sequence[ LifecycleBinding], runtime: RuntimeInterface, **kwargs: Any):
¶
Build a Driver per declaration, before any node exists.
| Parameters | |
bindings:Sequence[ | Every lifecycle declaration on the Component. They share this one Skill, and their nodes aggregate lowest-wins. |
runtime:RuntimeInterface | The Machine's Runtime, reached through the Component. |
**kwargs:Any | What ~opensmi.ros2.server.required.ROS2StartupSkill takes. |
| Raises | |
DeclarationError | When two declarations follow the same ROS2 node. |
MessageTypeError | When an interface package a declared flavour needs is missing. |
Return a copy of whether each declared node is on the graph, by node path.
A vanished node keeps its last state, because absence is not a lifecycle state. Presence
comes from the node's transition_event subscription and answers a required lifecycle
Binding (opensmi.ros2.server.required.satisfaction_of).
Return the node paths currently latched Terminal, in sorted order.
While this is non-empty, Reset is refused.
Ask every Driver to drive its nodes toward what one trigger means, and collect faults.
Idempotent, since each Driver gates every transition on what its nodes report as available.
Refuse Reset while any node behind this Skill is Terminal.
Commanding a transition at a finalized node returns success=False on a C++ node and kills the process on an rclpy one.
| Raises | |
UaStatusCodeError | BadInvalidState. It is raised because a bare False would reach try_trigger as an unexplained Good. |
Give every declared node one Monitoring variable holding its lifecycle state.
Created at init from the declaration alone, so they are readable against a robot that is
off. They hold UNKNOWN_STATE until the node speaks, then the ROS2 label.
| Raises | |
DuplicateVariableNameError | When two declarations claim one state variable, which is
the same Binding name and node path. This differs from two declarations following one
node (see _require_one_owner_per_node). |
Command one trigger at every node, and halt this Skill if anything refused.
| Raises | |
OpenSmiRuntimeError | When a node or a manager refused or did not answer. |
Fire one trigger from a task of its own, never from the task that decided to.
AsyncMachine cancels the tasks processing a transition when a new one begins and swallows the CancelledError, so a long-lived task awaiting a trigger would silently stop following.
Ask a node what state it is in each time it appears, and only then.
A server starting against an already finalized node gets no transition event, and without this it would offer a Reset that cannot work. The node's transition_event publisher is still matched, so it can be seen.
Take back what this Skill brought up, and let opensmi halt what it halts.
Only transitions the Skill performed itself are rolled back, so a node that was already active when the Skill started is not touched. Never shutdown, since finalized is terminal and the Skill could not be reset. opensmi's own halting runs whatever the robot did, and the faults are raised afterwards.
Build the Skill, give every node a state variable, and start following.
Nothing is asked of the robot here, so a Component whose robot is off still builds. The first question goes out when a transition_event subscription gets a publisher.
| Raises | |
DeclarationError | When the Component cannot raise a BindingEvent. |
Latch or lift one node's Terminal condition, firing the event exactly on the latch.
Only observing another primary state on that path lifts it. The node vanishing does not, since the last thing known is still finalized.
str, state: LifecycleNodeState | int, means: SkillState | None, *, routed: bool = False):
¶
Record one thing a node said about itself, and ask for the Skill to be settled.
Transition states are not news: the Skill has its own intermediate states for them.
| Parameters | |
path:str | Undocumented |
state:LifecycleNodeState | int | Undocumented |
means:SkillState | None | Undocumented |
routed:bool | Whether this came from a transition_event and so carries the state pair.
A routed observation outranks the routeless read-back of _read_back. |
Ask every node where it ended up, rather than assuming the command took it there.
A node announces the transitions we caused too, and a Skill that ignored its own commands would read its successful Reset as a robot that never moved. The read has no route, so it gives a rank but not which state at that rank. A node that announced a transition inside this window is skipped: its event carries a route, and overwriting it would turn somebody else's failed activation (Halted) into a routeless inactive (Ready).
str, path: str, code: str, text: str, severity: Severity = Severity.ERROR):
¶
Fire one BindingEvent about one node, and never let the reporting be the fault.
A failure to raise the event is only logged.
Refuse to reach Running unless every node actually reached active.
The Driver's gate is quiet: a node that offers no activate is skipped. That is right for halt but not for start, where a node left unconfigured would let Start succeed while the Skill claims a robot it does not have. The read-back is checked, not the command.
| Raises | |
OpenSmiRuntimeError | When any node reports anything other than active. |
Fire at most one trigger toward the aggregate, and say whether the Skill could act.
| Returns | |
bool | False when the Skill is not resting and the observation has to be re-offered; True when it acted, or when there was nothing for it to do. |
Move the Skill toward what its nodes say, whenever something new has been recorded.
An observation the Skill cannot take yet (mid-transition, or a handler is commanding) is
held and re-offered every SETTLE_INTERVAL.
Run one following coroutine as a task this Skill owns and cancels.
These tasks stay out of opensmi's own task bookkeeping, which is cancelled when the Skill halts, because a Skill that stopped watching on halt could never see its nodes come back.
Start one task per node per signal (transitions and appearances), plus the settling one.
An appearance is the subscription's own DDS match event, which is the "one state query on first discovery".
Activate every node, and check they all got there.
This is the lifecycle half of Starting, run after the required Bindings were waited for. A required lifecycle Binding is thus waited for before its nodes are commanded: a node that is not on the graph does not answer, and that is a fault rather than a wait. Nodes of other required Bindings have their publishers by now, because a managed node creates them on configure, which Reset has already done.
Offer one trigger to the state machine, tolerating a state it is not valid from.
try_trigger answers with a status code instead of raising, so a transition arriving mid-handler is harmless.
Return the Binding and node path that dragged the aggregate down to target.
The first in declaration order wins a tie.