class documentation

class ROS2ContainerMixin:

Constructor: ROS2ContainerMixin(*args, **kwargs)

View In Hierarchy

How a Skill and a Method build, write and clear their variable containers.

Mixed in ahead of opensmi's callable class. The annotated names below are what it expects to find on that class.

Method __init__ Pass every argument on to opensmi's callable.
Class Variable callable_kind What a refusal calls the owner, Skill or Method.
Property logger Return the logger opensmi gives every object.
Property name Return the callable's name, which is its Binding's.
Async Method _create Render one plan in one container, and record it on it.
Method _named Return how a refusal names one of these containers, from a reader's side.
Async Method _read_values Read one container into the plan's values, by name.
Method _report_unknown_name Log a decoded name its shape never created, and skip the value.
Async Method _reset_values Put every variable of one container back to the plan's initial value.
Async Method _write Write one value to a variable's node with the variant type the plan decided.
Async Method _write_values Write a name-to-value map into one container, skipping names it has no variable for.
def __init__(self, *args: Any, **kwargs: Any):

Pass every argument on to opensmi's callable.

Only here for the type checker: without it super().__init__(name=...) in a Skill or Method resolves to this mixin and reports unknown keywords.

callable_kind: ClassVar[str] =

What a refusal calls the owner, Skill or Method.

@property
logger: BoundLogger =

Return the logger opensmi gives every object.

@property
name: str =

Return the callable's name, which is its Binding's.

async def _create(self, plan: Sequence[PlanEntry], container: VariableContainer, *, message_type: type[Message], writable: bool = False):

Render one plan in one container, and record it on it.

Every name is checked before any variable is made, so a failing plan leaves nothing half-built.

Parameters
plan:Sequence[PlanEntry]Undocumented
container:VariableContainerUndocumented
message_type:type[Message]The ROS2 type the plan was shaped from.
writable:boolUndocumented
Raises
UnprojectableFieldErrorWhen an entry is an Object.
DuplicateVariableNameErrorWhen a name is already taken in that container.
DeclarationErrorWhen the machinery item cannot render a plan, because it does not carry the ROS2 mixins.
def _named(self, container: VariableContainer) -> str:

Return how a refusal names one of these containers, from a reader's side.

async def _read_values(self, container: VariableContainer) -> dict[str, object]:

Read one container into the plan's values, by name.

Elements of a structure array come back as maps of their fields, the form a Projection builds a message from. Raises ValueError for a value that is not an array of the variable's structure, which the write check normally prevents.

def _report_unknown_name(self, container: VariableContainer, name: str):

Log a decoded name its shape never created, and skip the value.

Unreachable with the generic Projection. A curated one whose halves disagree only shows up with a message, so it is logged and not raised.

async def _reset_values(self, container: VariableContainer):

Put every variable of one container back to the plan's initial value.

That is a typed zero only where the declaration says so; a curated Projection may choose another value.

async def _write(self, variable: UaVariable[Any], value: object, variant_type: ua.VariantType):

Write one value to a variable's node with the variant type the plan decided.

Written on the node, so no write check runs: the value comes from ROS2 or the declaration.

async def _write_values(self, container: VariableContainer, values: Mapping[str, object]):

Write a name-to-value map into one container, skipping names it has no variable for.