The correspondence between lifecycle nodes and Skill states, written down as data.
A ROS2 lifecycle node's state machine and the SkillSet continuous-skill state machine are the same machine:
| Skill state | Lifecycle state | Trigger | Lifecycle transition |
|---|---|---|---|
| Halted | unconfigured | reset | configure |
| Ready | inactive | start | activate |
| Running | active | halt | deactivate + cleanup |
The row Suspended / inactive / suspend / deactivate is not offered, because the
StartupSkill is never suspendable. A node observed deactivating is still read as Suspended and
the Skill follows it down to Halted. halt is never shutdown: finalized is terminal,
so a shut-down node could never be reset, and the shutdown transitions are absent from
LifecycleNodeTransition.
The Binding follows the state pair of a transition_event, not its transition field, which
rcl_lifecycle leaves empty on every event (verified live on Jazzy). Entering inactive from
configuring is Ready, from deactivating it is Suspended, and from activating
(a failed activation) it is Halted. opensmi's SkillState is not ordered, so _RANKS
names every state it covers.
Everything here is a pure function of integers and enumerations. The Drivers are in
opensmi.ros2.server.drivers and the Skill in opensmi.ros2.server.startup.
| Class | |
The states of a ROS2 managed node, with the identifiers lifecycle_msgs/msg/State gives. |
| Class | |
The transitions this project ever commands, with lifecycle_msgs/msg/Transition's ids. |
| Function | aggregate |
Return what several nodes under one Skill say together: lowest wins. |
| Function | resting |
Return the Skill state one resting lifecycle state means, with no route to read. |
| Function | skill |
Return the Skill state one observed transition puts a node in, from the pair alone. |
| Function | trigger |
Return the trigger that moves a Skill from where it is toward what its nodes report. |
| Constant | PRIMARY |
The states a node rests in, and therefore the only ones a Skill state is read off. |
| Constant | RESTING |
The three Skill states a StartupSkill rests in. |
| Constant | TRANSITIONS |
What each Skill trigger sends at the robot, in order. |
| Constant | TRIGGERS |
Which trigger reaches each of the three Skill states the Skill can rest in. |
| Constant | UNDONE |
Which transition a halt step rolls back: deactivate undoes activate, cleanup undoes configure. |
| Function | _rank |
Return how much a Skill state claims: 0 halted, 1 inactive, 2 running. |
| Constant | _RANKS |
How much each Skill state claims about a node, which is what "lowest wins" compares. |
Return what several nodes under one Skill say together: lowest wins.
Running means every node is active. A node nobody has heard from contributes None and is skipped, so a node that vanishes while the Skill is Running does not halt it. Between equal ranks the answer is Suspended if any node reported one.
| Returns | |
SkillState | None | The lowest-ranked state anything reported, or None when nothing has. |
Return the Skill state one resting lifecycle state means, with no route to read.
unconfigured and finalized are Halted, active is Running and inactive is Ready. A node in a transition state answers None (no opinion). finalized differs from unconfigured only by the Binding being Terminal, which refuses Reset.
LifecycleNodeState | int, goal: LifecycleNodeState | int) -> SkillState | None:
¶
Return the Skill state one observed transition puts a node in, from the pair alone.
| Parameters | |
start:LifecycleNodeState | int | The state the node left, as transition_event.start_state.id. |
goal:LifecycleNodeState | int | The state it entered, as transition_event.goal_state.id. |
| Returns | |
SkillState | None | The Skill state, or None when the node merely entered a transition state. |
Return the trigger that moves a Skill from where it is toward what its nodes report.
Only downward, and always halt. Following a robot down keeps the address space truthful; following it up would start a Skill nobody asked to start.
| Parameters | |
current:SkillState | The state the Skill is in. An intermediate state answers None, because a handler is already in flight. |
target:SkillState | What aggregate says the nodes are. |
| Returns | |
TRIGGER | None | halt, or None when the Skill is at or below the nodes. |
The states a node rests in, and therefore the only ones a Skill state is read off.
A node passing through configuring is not news: the Skill is already in its own intermediate state for the same moment.
| Value |
|
The three Skill states a StartupSkill rests in.
Suspended can be observed on a node (it ranks in _RANKS) but never entered.
| Value |
|
What each Skill trigger sends at the robot, in order.
halt is two ordered steps: an active node has to be deactivated before it can be cleaned up, and an inactive one does not offer the first. The Driver's gate decides which go out.
| Value |
|
Which trigger reaches each of the three Skill states the Skill can rest in.
The triggers are named for the act, so reset is the only way into Ready and out of Halted. Suspended has no entry because there is no suspend trigger.
| Value |
|
Which transition a halt step rolls back: deactivate undoes activate, cleanup undoes configure.
A halt sends a step only when the StartupSkill itself performed the transition it undoes , so a node that was already active is left as it was found.
| Value |
|
Return how much a Skill state claims: 0 halted, 1 inactive, 2 running.
| Raises | |
KeyError | For a state outside the correspondence (intermediate states, Completed). |