Core Types¶
Enumerations¶
- class osi_utilities.tracefile._types.MessageType(*values)[source]¶
Bases:
EnumOSI top-level message types. Mirrors C++ ReaderTopLevelMessage enum.
- UNKNOWN = 0¶
- GROUND_TRUTH = 1¶
- SENSOR_DATA = 2¶
- SENSOR_VIEW = 3¶
- SENSOR_VIEW_CONFIGURATION = 4¶
- HOST_VEHICLE_DATA = 5¶
- TRAFFIC_COMMAND = 6¶
- TRAFFIC_COMMAND_UPDATE = 7¶
- TRAFFIC_UPDATE = 8¶
- MOTION_REQUEST = 9¶
- STREAMING_UPDATE = 10¶
Data Classes¶
- class osi_utilities.tracefile._types.ReadResult(message, message_type, channel_name='')[source]¶
Bases:
objectResult of reading a single message from a trace file.
- Parameters:
message (Message)
message_type (MessageType)
channel_name (str)
- message_type: MessageType¶
The OSI message type.
- class osi_utilities.tracefile._types.ChannelSpecification(path, message_type=None, topic=None, metadata=<factory>)[source]¶
Bases:
objectSpecification for an OSI channel within a trace file.
Adopted from PMSFIT’s OSIChannelSpecification with builder pattern.
- property trace_file_format: TraceFileFormat¶
Determine the trace file format from the file extension.
- try_autodetect_message_type()[source]¶
Attempt to detect message type from filename.
Returns True if detection succeeded and sets self.message_type.
- Return type:
- with_message_type(message_type)[source]¶
Return a new ChannelSpecification with a different message type.
- Parameters:
message_type (str)
- Return type:
- with_topic(topic)[source]¶
Return a new ChannelSpecification with a different topic.
- Parameters:
topic (str)
- Return type:
- with_trace_file_format(fmt)[source]¶
Return a new ChannelSpecification with a different file extension.
- Parameters:
fmt (TraceFileFormat)
- Return type:
Utility Functions¶
- osi_utilities.tracefile._types.infer_message_type_from_filename(filename)[source]¶
Infer message type from filename patterns.
Matches the C++ kFileNameMessageTypeMap patterns (e.g.
_gt_) and also supports the common convention where the type code appears at the end of the stem before the extension (e.g.trace_gt.osi,output_sv.mcap).- Parameters:
filename (str)
- Return type:
- osi_utilities.tracefile._types.get_trace_file_format(path)[source]¶
Determine the trace file format from the file extension.
- Parameters:
path (Path)
- Return type:
- osi_utilities.tracefile._types.parse_osi_trace_filename(filename)[source]¶
Parse an OSI trace filename according to OSI naming convention 2.2.6.2.
Format: <timestamp>_<type>_<osi-version>_<protobuf-version>_<number-of-frames>_<custom-trace-name>.osi
Returns a dict with parsed fields, or empty dict if parsing fails.