class documentation

class ROS2StartupSkill(BaseStartupSkill):

Constructor: ROS2StartupSkill(minimum_access_level, **kwargs)

View In Hierarchy

The StartupSkill this package gives a machinery item that has not got a narrower one.

It stays Running once started. It waits for this item's required Bindings through the gate and starts each child's StartupSkill and waits for it to run, because opensmi's own starting handler stops at the first child that did not come up. A Machine gets one unless it registers its own. A Component gets one when it declares a required Binding, and opensmi.ros2.server.startup.ROS2LifecycleStartupSkill when it declares a lifecycle one. It is not suspendable, because opensmi's StartupSkill never is.

Method __init__ Take the access level and hand opensmi the rest; the gate is built once there is a parent.
Async Method close_startup Release everything this Skill holds outside the state machine. Idempotent.
Property gate Return the required Bindings this Skill answers for, as the gate that waits on them.
Async Method _bring_up Bring one child's StartupSkill to Running, and say why if it did not get there.
Method _children Return the child machinery items that have a StartupSkill of their own, in order.
Method _deadline_for Return how long this Skill waits for one child: its longest required deadline plus startup_timeout.
Async Method _handle_halting Stop answering for the prerequisites, then halt the Components and the other Skills.
Async Method _handle_running Do nothing: a started StartupSkill has nothing left to tick.
Async Method _handle_starting Wait for this item's prerequisites, command its own robot, then bring its children up.
Async Method _init Let opensmi build the Skill, then resolve what its item declared required.
Async Method _reach Fire one trigger at another Skill and watch until it settles, wherever that is.
Async Method _reset_children Run opensmi's own starting handler, without letting one child be the verdict.
Async Method _start_children Start every child's StartupSkill and wait for it to reach Running.
Async Method _start_the_ros2_side Command whatever this item owns on the ROS2 side. The lifecycle Skill activates its nodes here.
Instance Variable _fired Undocumented
Instance Variable _handle_status_change_task Undocumented
Instance Variable _startup_gate Undocumented
def __init__(self, *, minimum_access_level: int = SKILL_ACCESS_LEVEL, **kwargs: Any):

Take the access level and hand opensmi the rest; the gate is built once there is a parent.

The default is the ROS2 settings' skill_access_level default, not opensmi's 2, because the orchestrator must be able to start a machine with no operator present.

Parameters
minimum_access_level:intThe level Start, Halt and Reset need.
**kwargs:AnyUndocumented
async def close_startup(self):

Release everything this Skill holds outside the state machine. Idempotent.

The declaring item's shutdown calls it; a subclass that holds more releases it here and calls up. opensmi's supervision task is stopped too, since it has no shutdown of its own and would fail on nodes that are gone.

@property
gate: StartupGate =

Return the required Bindings this Skill answers for, as the gate that waits on them.

async def _bring_up(self, child: Any) -> str | None:

Bring one child's StartupSkill to Running, and say why if it did not get there.

Each step is skipped where it has already happened, since resetting a running Component would tear down a working robot.

Returns
str | NoneNone when the child is running, or a phrase naming it and where it stopped.
def _children(self) -> tuple[Any, ...]:

Return the child machinery items that have a StartupSkill of their own, in order.

def _deadline_for(self, child: Any) -> float:

Return how long this Skill waits for one child: its longest required deadline plus startup_timeout.

async def _handle_halting(self):

Stop answering for the prerequisites, then halt the Components and the other Skills.

This is opensmi's own halting handler, minus this Skill. opensmi's halt_skills waits for every Skill of the item to be Halted and has not got an exception for the caller, so called from here it would wait for the halt it is part of and fail after its timeout.

async def _handle_running(self):

Do nothing: a started StartupSkill has nothing left to tick.

async def _handle_starting(self):

Wait for this item's prerequisites, command its own robot, then bring its children up.

The prerequisites come first: a managed node that is not on the graph cannot be activated, and the Skill should report that it is waiting for the node, not that the node did not answer. Each child waits for its own prerequisites in its own handler.

async def _init(self):

Let opensmi build the Skill, then resolve what its item declared required.

Raises
DeclarationErrorWhen the item declares a required Binding and cannot raise a BindingEvent.
async def _reach(self, skill: Any, target: SkillState, deadline: float, trigger: Any, label: str):

Fire one trigger at another Skill and watch until it settles, wherever that is.

The trigger is fired from a task of its own and watched, not awaited: AsyncMachine cancels the tasks processing a transition when the next one for that model begins and swallows the CancelledError. opensmi's wait_for_state is not used, because it raises on Halted only if the Skill was not already there, so a child that halted early would be reported as a timeout. The caller reads CurrentState for the verdict.

async def _reset_children(self):

Run opensmi's own starting handler, without letting one child be the verdict.

Its reset raises at the first Component that halted. That is swallowed here, because _start_children names every child that did not come up, and the rest of opensmi's housekeeping still has to run.

async def _start_children(self):

Start every child's StartupSkill and wait for it to reach Running.

Raises
OpenSmiRuntimeErrorWhen any child's StartupSkill did not reach Running, carrying COMPONENT_NOT_RUNNING and naming every one of them.
async def _start_the_ros2_side(self):

Command whatever this item owns on the ROS2 side. The lifecycle Skill activates its nodes here.

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

Undocumented

_handle_status_change_task =

Undocumented

_startup_gate: StartupGate | None =

Undocumented