ReportProvider

ReportProvider — single-topic report publisher (Tier 1).

A ReportProvider owns one DataWriter and publishes report samples. On close(), the keyed instance is disposed so that subscribers see the NOT_ALIVE_DISPOSED state transition (per UMAA §5.2.1.3).

class rtiumaapy.report_provider.ReportProvider(ctx: DDSContext, service_name: str | None = None, *, report_type: Type, report_topic: str)[source]

Bases: BaseService

Publishes a single keyed report type.

Parameters:
  • ctx – The DDSContext owning shared DDS infrastructure.

  • service_name – Unique name for this service instance. Defaults to the class name if not provided.

  • report_type – An @idl.struct type (the IDL-generated Python class).

  • report_topic – The DDS topic name (drives QoS assignment).

property writer: rti.connextdds.DataWriter

The underlying DataWriter.

property report_topic: str

The DDS topic name.

write(sample) None[source]

Publish a report sample, validating fields first.

Logs a warning if validation fails but still publishes (matches C++ behavior).

Parameters:

sample – An instance of report_type with fields populated.

async close() None[source]

Dispose the report instance so subscribers see NOT_ALIVE_DISPOSED.

Entity cleanup is deferred to DDSContext.shutdown() which stops the rti.asyncio dispatcher before calling close_contained_entities().

This method is idempotent — calling it more than once is safe.

Usage

A ReportProvider owns one DataWriter and publishes report samples. On close(), the keyed instance is disposed so subscribers see NOT_ALIVE_DISPOSED.

from rtiumaapy import DDSContext, set_timestamp
from rtiumaapy.services.so import HealthReportProvider
from rtiumaapy.datamodel.HealthReportType import (
    UMAA_SO_HealthReport_HealthReportType as HealthReportType,
)

ctx = DDSContext(domain_id=0)
provider = HealthReportProvider(ctx)

# Publish a sample
sample = HealthReportType(source=ctx.source_id)
set_timestamp(sample)
provider.write(sample)

Instance Lifecycle

The instance handle is captured automatically on the first write(). On close(), the provider disposes the instance so subscribers see NOT_ALIVE_DISPOSED (per UMAA §5.2.1.3).

Validation

write() automatically validates fields against UMAA IDL constraints before publishing. Invalid fields are logged as warnings but the sample is still sent (matching C++ reference behavior).

Using Pre-Wired Classes

Pre-wired report providers handle all the type/topic wiring. Both ctx and service_name are the only parameters — service_name defaults to the class name if omitted:

from rtiumaapy.services.so import HealthReportProvider

provider = HealthReportProvider(ctx)
# topic name, type, and service_name are all pre-configured