class documentation

class ROS2ComponentMixin(ROS2ParameterMirrorMixin, ROS2InwardMirrorMixin, ROS2KeyedMirrorMixin, ROS2SpatialMixin):

View In Hierarchy

What a Component declares, and what becomes of it.

Class Variable bindings The Bindings this Component exposes. An instance may replace it in its constructor.
Class Variable bindings_toml A Binding file whose declarations union with bindings, or None.
Class Variable projections The Projections this Component curates its own types with, ahead of its Machine's. An instance may replace it in its constructor.
Class Variable startup_skill_type A subclass of the stock StartupSkill these declarations ask for, or None for the stock one.
Property ros2_bindings Return the Bindings this Component resolved, both sources unioned.
Property ros2_config Return the ROS2 settings of the deployment this Component is part of.
Property ros2_projection_context Return the Projection context this Component renders through, with nothing selected.
Property ros2_projections Return the registry this Component renders its types through.
Property runtime Return the Runtime this Component's Machine was injected with.
Async Method _init Let opensmi initialise the Component, then create its Binding nodes.
Async Method _init_methods Add one Method per service declared, before any subscription is open.
Async Method _init_publishers Add one Skill per published topic declared, continuous or finite as it says.
Async Method _init_skills Add one finite Skill per action declared, before any subscription is open.
Async Method _init_startup Give this Component the one StartupSkill its declarations ask for, if any do.
Method _require_a_startup_skill_class Return the class to build this Component's StartupSkill from: its own, or the stock one.
Method _require_no_startup_skill_yet Refuse a Component that registered a StartupSkill of its own and then declared one.
Async Method _shutdown Stop following this Component's nodes and topics, then let opensmi shut it down.
Class Variable _resolved_bindings Undocumented
Class Variable _resolved_projections Undocumented
Instance Variable _publisher_skills Undocumented
bindings: Sequence[Binding] =

The Bindings this Component exposes. An instance may replace it in its constructor.

bindings_toml: str | Path | None =

A Binding file whose declarations union with bindings, or None.

projections: Sequence[Projection] =

The Projections this Component curates its own types with, ahead of its Machine's. An instance may replace it in its constructor.

startup_skill_type: type[ROS2StartupSkill] | None =

A subclass of the stock StartupSkill these declarations ask for, or None for the stock one.

@property
ros2_bindings: tuple[Binding, ...] =

Return the Bindings this Component resolved, both sources unioned.

Resolved once, on first use, and held, so a name collision is fatal at init and the declarations cannot change under a running server.

@property
ros2_config: ROS2Config =

Return the ROS2 settings of the deployment this Component is part of.

A Component whose Machine is not a ROS2 one answers with the defaults.

@property
ros2_projection_context: ProjectionContext =

Return the Projection context this Component renders through, with nothing selected.

A surface narrows it to the field paths its own selection kept.

@property
ros2_projections: ProjectionRegistry =

Return the registry this Component renders its types through.

Derived from the Machine's registry with this Component's own entries ahead of it, so precedence runs Component, Machine, shipped, generic walk. A Component whose Machine is not a ROS2 one derives from the shipped catalogue; it cannot render anything anyway, because its _init raises ~opensmi.ros2.server.errors.DeclarationError. Resolved once and held, like ros2_bindings.

Raises
DuplicateProjectionErrorWhen an entry covers a type the Machine already covers and does not say override=True.
@property
runtime: RuntimeInterface =

Return the Runtime this Component's Machine was injected with.

Raises
DeclarationErrorWhen the Machine carries no Runtime, which means it does not use opensmi.ros2.server.machine.ROS2MachineMixin.
async def _init(self):

Let opensmi initialise the Component, then create its Binding nodes.

Every way a declaration can be wrong is fatal on this path. The StartupSkill comes first, so it browses first in the SkillSet, then Methods, Skills, publishers, Monitoring variables, keyed members and parameters. The SpatialObject is last, because a companion specification's AddIn extends what the Component already is.

async def _init_methods(self):

Add one Method per service declared, before any subscription is open.

async def _init_publishers(self):

Add one Skill per published topic declared, continuous or finite as it says.

The Skill advertises its publisher itself, last, so a refused declaration leaves no endpoint behind.

async def _init_skills(self):

Add one finite Skill per action declared, before any subscription is open.

async def _init_startup(self):

Give this Component the one StartupSkill its declarations ask for, if any do.

A lifecycle Binding is the StartupSkill and a required Binding needs one to wait for it. A Component declaring both gets the lifecycle class, which adds the managed nodes to the other. Built here, not at the mutation chokepoint, because its nodes exist from init and never move.

Raises
DeclarationErrorWhen this Component already carries a StartupSkill of its own.
ImplementationClassErrorWhen startup_skill_type names a class that is not a subclass of the stock one these declarations ask for.
def _require_a_startup_skill_class(self, stock: type[ROS2StartupSkill], asked: str) -> type[ROS2StartupSkill]:

Return the class to build this Component's StartupSkill from: its own, or the stock one.

Raises
ImplementationClassErrorWhen the named class is not a subclass of the stock one.
def _require_no_startup_skill_yet(self, asked: str, counted: int, because: str):

Refuse a Component that registered a StartupSkill of its own and then declared one.

Parameters
asked:strWhat to call the declarations that asked for one, in the message.
counted:intHow many of them there are.
because:strWhy that declaration lands on the Skill this Component already has.
Raises
DeclarationErrorWhen one is already registered.
async def _shutdown(self):

Stop following this Component's nodes and topics, then let opensmi shut it down.

A Component torn down inside a process that goes on serving has to release its own endpoints; stopping the Runtime would release all of them.

_resolved_bindings: tuple[Binding, ...] | None =

Undocumented

_resolved_projections: ProjectionRegistry | None =

Undocumented

_publisher_skills: tuple[ROS2PublisherSkill, ...] =

Undocumented