module documentation

The skill state machine as specified by SkillStateMachineType in the MachineSet nodeset.

Finite and continuous skills share one state machine type. Continuous skills never complete, so they use it without the transitions from or to SkillState.COMPLETING and SkillState.COMPLETED. Skills that cannot be suspended have no Suspend method, so they use it without the transitions from or to SkillState.SUSPENDING and SkillState.SUSPENDED.

A transition without a cause is an internal transition: the server takes it on its own and no skill command triggers it. A transition with a cause may still be taken by the server on its own, e.g. halting on a failure.

Class SkillCommand A command a client sends to a skill, by calling the method of the same name on the skill's state machine.
Class SkillTransition A transition of the skill state machine.
Function allowed_commands Return the commands a skill in state accepts.
Function state_for_node_id Return the state whose NodeId in SkillStateMachineType is node_id, e.g. read from CurrentState/Id.
Function state_node_id Return the NodeId of state in SkillStateMachineType, as in CurrentState/Id.
Function states Return the states a skill can be in, in SkillState order, see transitions().
Function transitions Return all transitions of a skill.
Constant _COMPLETION Undocumented
Constant _METHOD_IDS Undocumented
Constant _STATE_IDS Undocumented
Constant _STATES_BY_ID Undocumented
Constant _STATES_BY_NAME Undocumented
Constant _SUSPENSION Undocumented
Constant _TYPE_TRANSITIONS Undocumented
def allowed_commands(state: SkillState, *, finite: bool, suspendable: bool) -> frozenset[SkillCommand]:

Return the commands a skill in state accepts.

Parameters
state:SkillStateUndocumented
finite:boolwhether the skill is finite or continuous.
suspendable:boolwhether the skill can be suspended.
Returns
frozenset[SkillCommand]Undocumented
def state_for_node_id(node_id: NodeIdDefinition) -> SkillState:

Return the state whose NodeId in SkillStateMachineType is node_id, e.g. read from CurrentState/Id.

Raises
KeyErrorIf node_id is not a state of SkillStateMachineType.
def state_node_id(state: SkillState) -> NodeIdDefinition:

Return the NodeId of state in SkillStateMachineType, as in CurrentState/Id.

def states(*, finite: bool, suspendable: bool) -> tuple[SkillState, ...]:

Return the states a skill can be in, in SkillState order, see transitions().

@cache
def transitions(*, finite: bool, suspendable: bool) -> tuple[SkillTransition, ...]:

Return all transitions of a skill.

Parameters
finite:boolwhether the skill is finite or continuous.
suspendable:boolwhether the skill can be suspended.
Returns
tuple[SkillTransition, ...]Undocumented
_COMPLETION: frozenset[SkillState] =

Undocumented

Value
frozenset(set([SkillState.COMPLETING, SkillState.COMPLETED]))
_METHOD_IDS: dict[str, NodeIdDefinition] =

Undocumented

Value
{method.name: method.node_id for method in _TYPE.methods}
_STATE_IDS: dict[str, NodeIdDefinition] =

Undocumented

Value
{state.name: state.node_id for state in _TYPE.states}
_STATES_BY_ID: dict[NodeIdDefinition, SkillState] =

Undocumented

Value
{node_id: _STATES_BY_NAME[name] for name, node_id in _STATE_IDS.items()}
_STATES_BY_NAME: dict[str, SkillState] =

Undocumented

Value
{state.value[1]: state for state in SkillState}
_SUSPENSION: frozenset[SkillState] =

Undocumented

Value
frozenset(set([SkillState.SUSPENDING, SkillState.SUSPENDED]))
_TYPE_TRANSITIONS: tuple[SkillTransition, ...] =

Undocumented

Value
tuple((SkillTransition(name=transition.name, source=_STATES_BY_NAME[transition.s↵
ource], target=_STATES_BY_NAME[transition.target], cause=SkillCommand(transition↵
.cause) if transition.cause is not None else None, node_id=transition.node_id) f↵
or transition in _TYPE.transitions))