The Machine side: one injected Runtime, started at init and stopped at shutdown.
A mixin that goes ahead of opensmi's BaseMachine:
class Robot(ROS2MachineMixin, BaseMachine): async def _init(self) -> None: await super()._init() await self.add_component(Platform(name="Platform")) config = ROS2Config.from_toml("ros2.toml") runtime = Runtime(domain_id=config.domain_id, node_name=config.node_name) await server.add_machine(Robot(runtime=runtime, ros2_config=config))
The application constructs the (unstarted) Runtime, because a Runtime is the unit of one Domain ID and tests need to pass a double; the mixin owns its lifetime. It starts before the Machine's _init, since Components subscribe while building their nodes, and stops after its _shutdown. A Machine that fails to build stops its Runtime too.
The Machine also adds the StartupSkill opensmi expects (default
~opensmi.ros2.server.required.ROS2StartupSkill), which starts each
Component's StartupSkill so that startup completes only when every Required Binding is satisfied.
It holds the default Projection registry that each Component derives its own from, and the
byte-string ceiling, which is published before any Component is built
(opensmi.ros2.server.limits). Through opensmi.ros2.server.events.ROS2ModelChangeMixin
it carries the BindingEvent and the standard model-change event, and the Machine-wide cap on
mutations. A Machine may declare a TF Binding of its own and runs the TF poll for every
SpatialObject on it (opensmi.ros2.server.transforms).
| Class | |
Gives a Machine its Runtime, and its Runtime a lifetime. |
| Function | _require |
Refuse a Machine-level declaration that is not about where this Machine is. |
Refuse a Machine-level declaration that is not about where this Machine is.
| Raises | |
DeclarationError | On any kind but TFBinding. |