class documentation

class ROS2ActionSkill(ROS2ContainerMixin, ParentMixin[BaseMachineryItem], MonitoringMixin, FinalResultDataMixin, ParameterSetMixin, FiniteSkillLogicMixin, BaseSkill):

Constructor: ROS2ActionSkill(binding, runtime, context, config, ...)

View In Hierarchy

The finite Skill one ~opensmi.ros2.server.bindings.ActionBinding becomes.

Constructed by the declaring Component. A declaration may name a subclass of this class to add behaviour; the subclass is checked when the declaration is read.

Method __init__ Resolve everything about the declaration that can be wrong, before any node exists.
Async Method build_goal Return the goal message to send, given what a client wrote into the Parameters.
Async Method read_monitoring Return what the Monitoring holds now, by variable name.
Async Method read_parameters Return what the ParameterSet holds now, by variable name.
Async Method read_results Return what the FinalResultData holds now, by variable name.
Async Method result_values Return the FinalResultData values one result message carries, by variable name.
Class Variable callable_kind Undocumented
Property action_types Return the goal, feedback and result types of the action this Skill is bound to.
Property binding Return the declaration this Skill was built from.
Property ros2_goal Return the goal currently in flight, or None when none is.
Async Method _create_outcome_booleans Create the three booleans if the debugging aid is on.
Async Method _follow_feedback Write every feedback message this goal produces, until it ends.
Async Method _handle_halting Ask the server to cancel whatever is in flight, then let the handle go.
Async Method _handle_resetting Clear what the last run produced and keep the Parameters a client wrote.
Async Method _handle_running Follow the feedback and wait for the ending, then let the ending decide the state.
Async Method _handle_starting Read the Parameters, build the goal and send it; reach Running only if it is taken.
Async Method _init Let opensmi build the Skill, create the variables, and prove the defaults can be sent.
Async Method _let_go Release the goal handle, if there is one. It never commands anything.
Async Method _write_feedback Write one feedback message into the Monitoring variables its type was shaped into.
Async Method _write_outcome_booleans Write the three booleans from one outcome; None means a reset.
Async Method _write_result Write what the goal produced, and the debugging booleans if they were asked for.
Instance Variable _binding Undocumented
Instance Variable _config Undocumented
Instance Variable _feedback_context Undocumented
Instance Variable _feedback_plan Undocumented
Instance Variable _goal Undocumented
Instance Variable _goal_context Undocumented
Instance Variable _goal_plan Undocumented
Instance Variable _monitoring Undocumented
Instance Variable _parameters Undocumented
Instance Variable _result_context Undocumented
Instance Variable _result_plan Undocumented
Instance Variable _results Undocumented
Instance Variable _runtime Undocumented
Instance Variable _types Undocumented
def __init__(self, *, binding: ActionBinding, runtime: RuntimeInterface, context: ProjectionContext, config: ROS2Config, minimum_access_level: int = SKILL_ACCESS_LEVEL):

Resolve everything about the declaration that can be wrong, before any node exists.

A missing interface package, a pattern that matches nothing or a goal that cannot be built backwards fails here instead of on the first Start.

Parameters
binding:ActionBindingWhat to build.
runtime:RuntimeInterfaceWhere the goal is sent. The Machine's, reached through the Component.
context:ProjectionContextThe Projection context of the Component, with nothing selected yet. The Skill narrows it once per surface (goal, feedback, result).
config:ROS2ConfigThe deployment's ROS2 settings.
minimum_access_level:intThe level Start, Halt and Reset need.
Raises
MessageTypeErrorWhen the action type cannot be resolved.
FieldSelectionErrorWhen a selection pattern matches nothing.
NotInvertibleErrorWhen the goal type reaches a Projection that cannot run backwards.
async def build_goal(self, values: Mapping[str, object]) -> Message:

Return the goal message to send, given what a client wrote into the Parameters.

Override on a custom class when building the goal needs the instance. The declaration's goal_from is the pure-function form, and default_goal_from is the default. An override must also work with the declaration's defaults, because _init calls it once with them.

async def read_monitoring(self) -> Mapping[str, object]:

Return what the Monitoring holds now, by variable name.

async def read_parameters(self) -> Mapping[str, object]:

Return what the ParameterSet holds now, by variable name.

async def read_results(self) -> Mapping[str, object]:

Return what the FinalResultData holds now, by variable name.

async def result_values(self, result: Message) -> Mapping[str, object]:

Return the FinalResultData values one result message carries, by variable name.

Overridable like build_goal; the declaration's result_to is the pure-function form and default_result_to the default.

callable_kind: ClassVar[str] =

Undocumented

@property
action_types: ActionTypes =

Return the goal, feedback and result types of the action this Skill is bound to.

@property
binding: ActionBinding =

Return the declaration this Skill was built from.

@property
ros2_goal: Goal | None =

Return the goal currently in flight, or None when none is.

Held on the Skill because opensmi cancels the running handler's task before the halting handler runs, so a handle kept only there would already be gone.

async def _create_outcome_booleans(self):

Create the three booleans if the debugging aid is on.

async def _follow_feedback(self, goal: Goal):

Write every feedback message this goal produces, until it ends.

async def _handle_halting(self):

Ask the server to cancel whatever is in flight, then let the handle go.

async def _handle_resetting(self):

Clear what the last run produced and keep the Parameters a client wrote.

Monitoring and FinalResultData go back to their declared initial values.

async def _handle_running(self):

Follow the feedback and wait for the ending, then let the ending decide the state.

A cancel this Skill asked for never arrives here, because opensmi cancels this handler before running the halting one. Any non-success outcome that does arrive comes from outside and halts the Skill.

async def _handle_starting(self):

Read the Parameters, build the goal and send it; reach Running only if it is taken.

A goal the server refuses halts the Skill. Parameters that cannot be built into a goal halt it with GOAL_UNBUILDABLE; every refusal of a client's value is a ValueError, which opensmi would otherwise report without an error code.

async def _init(self):

Let opensmi build the Skill, create the variables, and prove the defaults can be sent.

Building a goal from the initial Parameters must work, so a value ROS2 would abort on fails here, on the machine of whoever wrote the declaration.

async def _let_go(self):

Release the goal handle, if there is one. It never commands anything.

async def _write_feedback(self, feedback: Message):

Write one feedback message into the Monitoring variables its type was shaped into.

async def _write_outcome_booleans(self, outcome: GoalOutcome | None):

Write the three booleans from one outcome; None means a reset.

async def _write_result(self, outcome: GoalOutcome):

Write what the goal produced, and the debugging booleans if they were asked for.

_binding =

Undocumented

_config =

Undocumented

_feedback_context =

Undocumented

_feedback_plan =

Undocumented

_goal: Goal | None =

Undocumented

_goal_context =

Undocumented

_goal_plan =

Undocumented

_monitoring =

Undocumented

_parameters =

Undocumented

_result_context =

Undocumented

_result_plan =

Undocumented

_results =

Undocumented

_runtime =

Undocumented

_types: ActionTypes =

Undocumented