> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Namespace simulation_framework::autonomy::topic_registry

![][C++]

**Definition**: `autonomy/communication/topic_registry/topic_registry.h` (line 34)

## Autonomy Topic IDs and their Topic types (RTI-DDS backed)

Use these Topic types when adding publishers/subscribers for the listed IDs.

* "KpiLoggerTopic" -> `KpiMessageTopicType` (uses `rtidds::KpiMessage`)

* "DriverInputTopic" -> `KpiMessageTopicType` (uses `rtidds::KpiMessage`)

* "SensorViewTopic" -> `GenericBytesTopicType` (uses `rtidds::GenericBytesMessage`)

* "SensorDataTopic" -> `GenericBytesTopicType` (uses `rtidds::GenericBytesMessage`)

* "TrafficUpdateTopic" -> `GenericBytesTopicType` (uses `rtidds::GenericBytesMessage`)

* "TrafficCommandTopic" -> `GenericBytesTopicType` (uses `rtidds::GenericBytesMessage`)

* "MotionRequestTopic" -> `GenericBytesTopicType` (uses `rtidds::GenericBytesMessage`)

* "FmuInput" -> `FmuMessageTopicType` (uses `rtidds::FmuMessage`)

* "FmuOutput" -> `FmuMessageTopicType` (uses `rtidds::FmuMessage`)

* "ScenarioVariableTopic" -> `VariantMapTopicType` (uses `rtidds::VariantMap`)

* "VehicleControlInputTopic" -> `GenericBytesTopicType` (uses `rtidds::GenericBytesMessage`)

* "ObjectSpeedInputTopic" -> `GenericBytesTopicType` (uses `rtidds::GenericBytesMessage`)

**Examples**:

1. KPI (`KpiMessageTopicType`)

```cpp theme={null}
// Publish to KPI logger
AddPublisher<core::topic_registry::KpiMessageTopicType>(
    "KpiLoggerTopic", [&]() { return kpi_msg_; }  // rtidds::KpiMessage kpi_msg_;
);
// Subscribe driver input
AddSubscriber<core::topic_registry::KpiMessageTopicType>(
    "DriverInputTopic", [&](const rtidds::KpiMessage& msg) { HandleDriverInput(msg); }
);
```

2. Generic bytes (`GenericBytesTopicType`) for serialized payloads (e.g., protobuf/OSI)

```cpp theme={null}
AddPublisher<core::topic_registry::GenericBytesTopicType>(
    "SensorDataTopic", [&]() { return bytes_msg_; }  // rtidds::GenericBytesMessage bytes_msg_;
);
// Fill bytes_msg_ with serialized data; see communication.md for details
AddSubscriber<core::topic_registry::GenericBytesTopicType>(
    "SensorViewTopic", [&](const rtidds::GenericBytesMessage& msg) { ParseAndUse(msg); }
);
```

3. FMU I/O (`FmuMessageTopicType`)

```cpp theme={null}
AddPublisher<core::topic_registry::FmuMessageTopicType>(
    "FmuInput", [&]() { return fmu_msg_; }  // rtidds::FmuMessage fmu_msg_;
);
AddSubscriber<core::topic_registry::FmuMessageTopicType>(
    "FmuOutput", [&](const rtidds::FmuMessage& msg) { HandleFmuOutputs(msg); }
);
```

4. Scenario variables (`VariantMapTopicType`)

```cpp theme={null}
AddPublisher<core::topic_registry::VariantMapTopicType>(
    "ScenarioVariableTopic", [&]() { return var_map_msg_; }  // rtidds::VariantMap var_map_msg_;
);
AddSubscriber<core::topic_registry::VariantMapTopicType>(
    "ScenarioVariableTopic", [&](const rtidds::VariantMap& msg) { ApplyScenarioVariables(msg); }
);
```

?> VariantMap references

* For the RTI-DDS message type and Topic alias, see `[core/communication/topic_registry.h](core_2communication_2topic__registry_8h.md`

* For the C++ native `VariantMap` API and bi-directional conversion helpers, see `core/communication/utils/variant_map.h` and `core/communication/utils/variant_map_converter.h`.

5. VehicleControlInputMsg I/O (`VehicleControlInputTopic`)

```cpp theme={null}
AddPublisher<core::Topic<rtidds::GenericBytesMessage>>(
    "VehicleControlInputTopic", [&]() {
  autonomy::communication::messages::VehicleControlInputMsg msg;
  return autonomy::communication::utils::ConvertAutonomyMsgToGenericBytes(frame_counter, header_name, msg); //
rtidds::GenericBytesMessage
}
);

AddSubscriber<core::Topic<rtidds::GenericBytesMessage>>(
    "VehicleControlInputTopic", [&](const rtidds::GenericBytesMessage& msg) {
  autonomy::communication::messages::VehicleControlInputMsg inputs;
  autonomy::communication::utils::ConvertGenericBytesToAutonomyMsg(msg,inputs);}
);
```

6. Object speed input I/O (`ObjectSpeedInputTopic`)

```cpp theme={null}
AddPublisher<core::Topic<rtidds::GenericBytesMessage>>(
    "ObjectSpeedInputTopic", [&]() {
  autonomy::communication::messages::ObjectSpeedInputMsg msg;
  return autonomy::communication::utils::ConvertAutonomyMsgToGenericBytes(frame_counter, header_name, msg); //
rtidds::GenericBytesMessage
}
);

AddSubscriber<core::Topic<rtidds::GenericBytesMessage>>(
    "ObjectSpeedInputTopic", [&](const rtidds::GenericBytesMessage& msg) {
  autonomy::communication::messages::ObjectSpeedInputMsg speed_input;
  autonomy::communication::utils::ConvertGenericBytesToAutonomyMsg(msg, speed_input);}
);
```

### Typedef ScenarioVariableTopicType

![][public]

**Definition**: `autonomy/communication/topic_registry/topic_registry.h` (line 154)

```cpp theme={null}
using simulation_framework::autonomy::topic_registry::ScenarioVariableTopicType = typedef simulation_framework::core::topic_registry::VariantMapTopicType
```

Alias for scenario variable Topic type in Autonomy.

?> Variant message aliases

In core, `rtidds::VariantMessage` is currently an alias of `rtidds::FmuMessage`. Similarly, `rtidds::VariantData` aliases `rtidds::FmuData`, and `rtidds::VariantDatatype` aliases `rtidds::FmuDatatype`. This provides a semantic "Variant" naming today while retaining full compatibility with FMU message structure. If dedicated Variant types are introduced in the future, these aliases can be updated centrally.
Maps to `simulation_framework::core::topic_registry::VariantMapTopicType` which uses `rtidds::VariantMap` as the underlying RTI-DDS message.
**See also**: \[core/communication/topic\_registry.h]\(core\_2communication\_2topic\_\_registry\_8h.md

**Return type**: [simulation\_framework::core::topic\_registry::VariantMapTopicType](https://developer.synopsys.com/docs/avxcelerate/avxcelerate-simulation-framework/reference/classsimulation__framework_1_1core_1_1Topic.md)

### Function GetExistingTopicById

![][public]

```cpp theme={null}
std::shared_ptr< core::ITopic > simulation_framework::autonomy::topic_registry::GetExistingTopicById(const std::string &topic_id)
```

Return a concrete Topic instance for a known Autonomy Topic ID.

**Parameters**:

* **topic\_id**: One of: "KpiLoggerTopic", "DriverInputTopic", "SensorViewTopic", "SensorDataTopic", "TrafficUpdateTopic", "TrafficCommandTopic", "MotionRequestTopic", "FmuInput", "FmuOutput", "ScenarioVariableTopic", "VehicleControlInputTopic", "ObjectSpeedInputTopic".

**Returns**:

A `std::shared_ptr<core::ITopic>` of the appropriate concrete Topic type, or throws `std::runtime_error` if the ID is not recognized.

**Parameters**:

* [const](https://developer.synopsys.com/docs/avxcelerate/avxcelerate-simulation-framework/reference/classsimulation__framework_1_1core_1_1Topic.md) std::string & **topic\_id**

**Return type**: std::shared\_ptr\< [core::ITopic](https://developer.synopsys.com/docs/avxcelerate/avxcelerate-simulation-framework/reference/classsimulation__framework_1_1core_1_1ITopic.md) >

[private]: https://img.shields.io/badge/-private-red "private"

[public]: https://img.shields.io/badge/-public-brightgreen "public"

[const]: https://img.shields.io/badge/-const-lightblue "const"

[C++]: https://img.shields.io/badge/language-C%2B%2B-blue "C++"

[protected]: https://img.shields.io/badge/-protected-yellow "protected"

[static]: https://img.shields.io/badge/-static-lightgrey "static"
