class documentation

class ROS2MachineMixin(ROS2ModelChangeMixin, ROS2TransformMirrorMixin):

Constructor: ROS2MachineMixin(*args, runtime, ros2_config, **kwargs)

View In Hierarchy

Gives a Machine its Runtime, and its Runtime a lifetime.

Method __init__ Take the Runtime this Machine owns, and pass everything else to opensmi.
Async Method lifecycle_ros2_runtime Start the Runtime and publish the byte-string ceiling; stop the Runtime at the end.
Async Method lifecycle_ros2_startup Add the default StartupSkill unless the Machine registered one; release it at the end.
Class Variable bindings TF Bindings only: the one frame the Machine is. Any other kind is refused, because it would land nowhere.
Class Variable bindings_toml A Binding file whose declarations union with bindings, or None.
Class Variable introspection_component_type The Component that answers what is on the ROS2 graph and what this Machine is bound to. It is always added, with no flag to turn it off; the access level on its mutators is the safeguard. Replaceable to add listings.
Class Variable projections The Projections this Machine adds to the shipped catalogue. Every Component on it derives its own registry from the result.
Class Variable startup_skill_type The StartupSkill added when the Machine registers none of its own. Replace it with a subclass of the stock one.
Property ros2_bindings Return the Bindings this Machine declared, which may only be TF Bindings.
Property ros2_byte_string_ceiling Return how many bytes a bulk payload on this Machine may carry, or 0 for no limit.
Property ros2_config Return the ROS2 settings this Machine was built with, defaults included.
Property ros2_projections Return this Machine's default registry: the shipped catalogue plus its own entries.
Property runtime Return this Machine's Runtime, which is where all its ROS2 access goes.
Async Method _init Let opensmi initialise the Machine, then add the introspection Component.
Async Method _shutdown Close the Machine's TF watch, then let opensmi shut the Machine down.
Instance Variable _resolved_bindings Undocumented
Instance Variable _resolved_projections Undocumented
Instance Variable _ros2_byte_string_ceiling Undocumented
Instance Variable _ros2_config Undocumented
Instance Variable _ros2_runtime Undocumented
def __init__(self, *args: Any, runtime: RuntimeInterface, ros2_config: ROS2Config | None = None, **kwargs: Any):

Take the Runtime this Machine owns, and pass everything else to opensmi.

Parameters
*args:AnyUndocumented
runtime:RuntimeInterfaceThe Runtime, constructed and not yet started.
ros2_config:ROS2Config | NoneThe ROS2 settings this deployment loaded, or None for the defaults. The Components read the settings that are not the Runtime's from it.
**kwargs:AnyUndocumented
@lifecycle(before=BaseMachineryItem.lifecycle_machinery_item)
async def lifecycle_ros2_runtime(self) -> AsyncGenerator[None]:

Start the Runtime and publish the byte-string ceiling; stop the Runtime at the end.

Runs before the Machine's _init and after its _shutdown. opensmi rolls a failed init back through this step too, so a Machine that refuses to boot leaves no rclpy Context or executor thread behind. A stop that was not clean is logged, not raised.

Raises
RuntimeAlreadyStartedErrorWhen the injected Runtime is already up.
@lifecycle(after=BaseMachineryItem.lifecycle_machinery_item)
async def lifecycle_ros2_startup(self) -> AsyncGenerator[None]:

Add the default StartupSkill unless the Machine registered one; release it at the end.

Runs after the Machine's _init so that a StartupSkill registered there is seen however it is ordered against super()._init(). The Skill gets the skill_access_level of the ROS2 settings, so the orchestrator can start the Machine with no operator. It is released before the Components are shut down, because it holds a task and a watch.

bindings: Sequence[Binding] =

TF Bindings only: the one frame the Machine is. Any other kind is refused, because it would land nowhere.

bindings_toml: str | Path | None =

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

introspection_component_type: type[ROS2IntrospectionComponent] =

The Component that answers what is on the ROS2 graph and what this Machine is bound to. It is always added, with no flag to turn it off; the access level on its mutators is the safeguard. Replaceable to add listings.

projections: Sequence[Projection] =

The Projections this Machine adds to the shipped catalogue. Every Component on it derives its own registry from the result.

startup_skill_type: type[ROS2StartupSkill] =

The StartupSkill added when the Machine registers none of its own. Replace it with a subclass of the stock one.

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

Return the Bindings this Machine declared, which may only be TF Bindings.

Resolved once and held.

Raises
DeclarationErrorWhen a kind other than TFBinding is declared.
DuplicateBindingNameErrorWhen one name appears twice, in either source.
@property
ros2_byte_string_ceiling: int =

Return how many bytes a bulk payload on this Machine may carry, or 0 for no limit.

Published in the server's capability variable at init and applied by the Projection that produces the bytes. Zero before init.

@property
ros2_config: ROS2Config =

Return the ROS2 settings this Machine was built with, defaults included.

@property
ros2_projections: ProjectionRegistry =

Return this Machine's default registry: the shipped catalogue plus its own entries.

Resolved once and held. Every Component derives its own registry from this one; nothing discovers an entry, and no Component's curation reaches another's.

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

Return this Machine's Runtime, which is where all its ROS2 access goes.

async def _init(self):

Let opensmi initialise the Machine, then add the introspection Component.

The introspection Component comes first, so it browses ahead of whatever this Machine declares. The Machine's own SpatialObject, if it declared a TF Binding, is created next so that it joins the list before any Component's.

async def _shutdown(self):

Close the Machine's TF watch, then let opensmi shut the Machine down.

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

Undocumented

_resolved_projections: ProjectionRegistry | None =

Undocumented

_ros2_byte_string_ceiling =

Undocumented

_ros2_config =

Undocumented

_ros2_runtime =

Undocumented