BaseComponent
BaseComponent — abstract base class for UMAA application components.
A component composes multiple BaseService instances into a
cohesive UMAA application (e.g. an autopilot, a mission executor).
Lifecycle (managed automatically by DDSContext):
__init__(ctx, name)— create DDS services, register with context.on_start()— one-shot startup (publish initial messages, etc.)._run()— async coroutine for periodic / event-driven work.close()— publish final messages, release resources.
- class rtiumaapy.base_component.BaseComponent(ctx: DDSContext, component_name: str)[source]
Bases:
ABCAbstract base class for UMAA application components.
Subclasses must implement
_run()andclose(). Subclasses may overrideon_start()for one-shot startup work.The component registers itself with the
DDSContextso thatDDSContext.run_until_shutdown()callson_start()once, then starts_run(), and callsclose()during shutdown (while DDS writers are still open).- __init__(ctx: DDSContext, component_name: str) None[source]
Initialise the component and register it with the context.
- Parameters:
ctx – The
DDSContextthat owns shared DDS infrastructure.component_name – A unique name for this component instance (e.g.
"Autopilot","MissionExecutor").
- property ctx: DDSContext
The
DDSContextthis component belongs to.
- property component_name: str
The registered name of this component.
Usage
A component groups multiple services into a cohesive UMAA application. The lifecycle is managed by DDSContext:
__init__()— create services, register with contexton_start()— one-shot startup (publish announcements)_run()— async coroutine for periodic workclose()— publish final messages, release resources
from rtiumaapy import DDSContext, BaseComponent
class MyComponent(BaseComponent):
def __init__(self, ctx: DDSContext, source_id):
super().__init__(ctx, "MyComponent")
# Create services here...
async def on_start(self):
print("Component started — publishing specs")
async def _run(self):
while True:
await asyncio.sleep(1.0)
async def close(self):
print("Shutting down")