Namespace simulation_framework::autonomy::communication::utils
Last update: 09.03.2026Definition: autonomy/communication/utils/osi_to_dds_converter.h (line 16)
Functions
Function CreateDdsMessageFromOsiProto
rtidds::GenericBytesMessage simulation_framework::autonomy::communication::utils::CreateDdsMessageFromOsiProto(const int frame_counter, const std::string &header_name, const OsiProtoType &osi_proto_msg)
Converts an OSI proto message to a DDS GenericBytesMessage.
parameterlist {"type":"element","name":"parameterlist","attributes":{"kind":"templateparam"},"children":[{"type":"element","name":"parameteritem","attributes":{},"children":[{"type":"text","text":"\n"},{"type":"element","name":"parameternamelist","attributes":{},"children":[{"type":"text","text":"\n"},{"type":"element","name":"parametername","attributes":{},"children":[{"type":"text","text":"OsiProtoType"}]},{"type":"text","text":"\n"}]},{"type":"text","text":"\n"},{"type":"element","name":"parameterdescription","attributes":{},"children":[{"type":"text","text":"\n"},{"type":"element","name":"para","attributes":{},"children":[{"type":"text","text":"The OSI proto message type (e.g., osi3::SensorView, osi3::SensorData, osi3::TrafficUpdate) "}]},{"type":"text","text":"\n"}]},{"type":"text","text":"\n"}]},{"type":"text","text":"\n"}]}
Parameters:
- frame_counter: The frame counter for the message
- header_name: The header name to use for the DDS message (e.g., "SensorView", "SensorData", "TrafficUpdate", "MotionRequest")
- osi_proto_msg: The OSI proto message to convert
Returns:
A GenericBytesMessage containing the serialized OSI proto message
?> The OsiProtoType must have:
-
timestamp() method returning an object with seconds() and nanos() methods
-
ByteSizeLong() method
-
SerializeToArray() method
?> Supported OSI message types include: SensorView, SensorData, TrafficUpdate, MotionRequest
Parameters:
- const int frame_counter
- const std::string & header_name
- const OsiProtoType & osi_proto_msg
Return type: rtidds::GenericBytesMessage
Function ParseOsiProtoFromDdsMessage
void simulation_framework::autonomy::communication::utils::ParseOsiProtoFromDdsMessage(const rtidds::GenericBytesMessage &dds_msg, OsiProtoType &osi_proto_msg)
Converts a DDS GenericBytesMessage back to an OSI proto message.
parameterlist {"type":"element","name":"parameterlist","attributes":{"kind":"templateparam"},"children":[{"type":"element","name":"parameteritem","attributes":{},"children":[{"type":"text","text":"\n"},{"type":"element","name":"parameternamelist","attributes":{},"children":[{"type":"text","text":"\n"},{"type":"element","name":"parametername","attributes":{},"children":[{"type":"text","text":"OsiProtoType"}]},{"type":"text","text":"\n"}]},{"type":"text","text":"\n"},{"type":"element","name":"parameterdescription","attributes":{},"children":[{"type":"text","text":"\n"},{"type":"element","name":"para","attributes":{},"children":[{"type":"text","text":"The OSI proto message type (e.g., osi3::SensorView, osi3::SensorData, osi3::TrafficUpdate) "}]},{"type":"text","text":"\n"}]},{"type":"text","text":"\n"}]},{"type":"text","text":"\n"}]}
Parameters:
- dds_msg: The DDS GenericBytesMessage to convert
- osi_proto_msg: Reference to the OSI proto message to populate
Exceptions:
- std::runtime_error: If parsing fails
?> The OsiProtoType must have:
- ParseFromArray() method
?> Supported OSI message types include: SensorView, SensorData, TrafficUpdate
Parameters:
- const rtidds::GenericBytesMessage & dds_msg
- OsiProtoType & osi_proto_msg
Return type: void
Function ConvertAutonomyMsgToGenericBytes
rtidds::GenericBytesMessage simulation_framework::autonomy::communication::utils::ConvertAutonomyMsgToGenericBytes(const int frame_counter, const std::string &header_name, const messages::AutonomyMsg &msg)
Convert an Autonomy message to a DDS GenericBytesMessage.
Parameters:
- frame_counter: Frame counter to store in the DDS header.
- header_name: Header name for the DDS message.
- msg: The AutonomyMsg message to serialize into the GenericBytesMessage.
Returns:
A rtidds::GenericBytesMessage containing the serialized autonomy message.
Exceptions:
- std::runtime_error: If serialization fails (e.g., buffer overflow).
Parameters:
- const int frame_counter
- const std::string & header_name
- const messages::AutonomyMsg & msg
Return type: rtidds::GenericBytesMessage
Function ConvertGenericBytesToAutonomyMsg
void simulation_framework::autonomy::communication::utils::ConvertGenericBytesToAutonomyMsg(const rtidds::GenericBytesMessage &dds_msg, messages::AutonomyMsg &msg)
Parse an Autonomy message from a DDS GenericBytesMessage.
Parameters:
- dds_msg: The DDS GenericBytesMessage containing serialized bytes.
- msg: Reference to the message object to populate.
Exceptions:
- std::runtime_error: If parsing fails (e.g., buffer underflow or malformed data).
Parameters:
- const rtidds::GenericBytesMessage & dds_msg
- messages::AutonomyMsg & msg
Return type: void