module documentation

An action is a finite Skill: a client starts it, watches it, and reads what it produced.

Start Read the Parameters, build the goal, send it. Running is reached only once the server has accepted the goal.
Running Feedback is written to Monitoring as it arrives; the goal's ending is awaited.
Completed The goal succeeded. The result fields are in FinalResultData.
Halt Cancel the goal. An aborted or externally cancelled goal also ends here.
Reset Clear Monitoring and FinalResultData. The Parameters are left alone, so a goal a client wrote before Reset is not discarded silently.
Suspend Not available: ROS2 actions cannot be paused, so the Skill is never suspendable and opensmi removes the method.

The outcome drives the state machine: Completed is success and Halted is every other ending. FinalResultData holds only the fields of the result message. Three outcome booleans (succeeded, aborted, canceled) can be added as a debugging aid with ~opensmi.ros2.server.config.ROS2Config.debug_goal_outcome_booleans.

opensmi runs the state machine and the _handle_* methods below are its hooks. Start, Halt and Reset need the Skill access level (skill_access_level, default ~opensmi.ros2.server.access.SKILL_ACCESS_LEVEL) and the Machine's Lock; Start also needs a completed startup. An OpenSmiRuntimeError from a handler halts the Skill and appears as a runtime error in the Notification of the Component, with its code as ErrorCode. Any other exception and a cancelled handler halt it too.

default_goal_from and default_result_to are pure functions of a message and its Projection context. A declaration may name its own pair; a replacement that needs the instance overrides ROS2ActionSkill.build_goal or ROS2ActionSkill.result_values on a custom class. The containers themselves are built in opensmi.ros2.server.containers.

Class ROS2ActionSkill The finite Skill one ~opensmi.ros2.server.bindings.ActionBinding becomes.
Function default_goal_from Build a goal message out of what a client wrote into a Skill's Parameters.
Function default_result_to Read a result message into the FinalResultData variables its type was shaped into.
Constant GOAL_UNBUILDABLE The error code of a Start whose Parameters could not be built into a goal.
Constant OUTCOME_BOOLEANS The three result booleans the opt-in debugging flag adds to FinalResultData.
Function _fault_text Return what a halting Skill reports about a goal, out of that goal's own faults.
def default_goal_from(goal_type: type[Message], values: Mapping[str, object], context: ProjectionContext) -> Message:

Build a goal message out of what a client wrote into a Skill's Parameters.

The Projection covering the goal type, run backwards. A pure function: no server, rclpy or event loop.

Raises
NotInvertibleErrorWhen a field of the goal has no value, because the selection removed it or no Parameter carries it. Such a field is refused instead of filled with a default.
def default_result_to(result: Message, context: ProjectionContext) -> Mapping[str, object]:

Read a result message into the FinalResultData variables its type was shaped into.

GOAL_UNBUILDABLE: str =

The error code of a Start whose Parameters could not be built into a goal.

The Skill halts and the goal never reaches ROS2. The error arrives in the Component's Notification with this code and a message naming the field and the reason.

Value
'GoalUnbuildable'
OUTCOME_BOOLEANS: tuple[str, ...] =

The three result booleans the opt-in debugging flag adds to FinalResultData.

They are derived from one outcome, so they cannot disagree with each other.

Value
('succeeded', 'aborted', 'canceled')
def _fault_text(outcome: GoalOutcome | None) -> str:

Return what a halting Skill reports about a goal, out of that goal's own faults.