Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more top-level messages to OSITrace #818

Merged
merged 6 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/architecture/architecture_overview.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ OSI contains an object-based environment description that uses the message forma
Google developed and maintains the Protocol Buffer library.
OSI defines top-level messages that are used to exchange data between separate models.
Top-level messages define the `GroundTruth` interface, the `SensorData` interface, and – since OSI version 3.0.0 – the interfaces `SensorView` and `SensorViewConfiguration`.
Further top-level messages that were added in later versions of OSI are `TrafficCommand`, `TrafficUpdate`, `MotionRequest`, and `StreamingUpdate`.
Further top-level messages that were added in later versions of OSI are `HostVehicleData`, `TrafficCommand`, `TrafficCommandUpdate`, `TrafficUpdate`, `MotionRequest`, and `StreamingUpdate`.

The following figure shows the interfaces and models involved in modeling a sensor.

Expand Down
26 changes: 19 additions & 7 deletions doc/architecture/trace_file_naming.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,35 @@ The names of OSI trace files should have the following format:

**Types**

`sd`::
Trace file contains `SensorData` messages.

`sv`::
Trace file contains `SensorView` messages.

`svc`::
Trace file contains `SensorViewConfiguration` messages.

`gt`::
Trace file contains `GroundTruth` messages.

`tu`::
Trace file contains `TrafficUpdate` messages.
`hvd`::
Trace file contains `HostVehicleData` messages.

`sd`::
Trace file contains `SensorData` messages.

`tc`::
Trace file contains `TrafficCommand` messages.

`hvd`::
Trace file contains `HostVehicleData` messages.
`tcu`::
Trace file contains `TrafficCommandUpdate` messages.

`tu`::
Trace file contains `TrafficUpdate` messages.

`mr`::
Trace file contains `MotionRequest` messages.

`su`::
Trace file contains `StreamingUpdate` messages.

**Example**

Expand Down
2 changes: 1 addition & 1 deletion osi3trace/osi2read.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def command_line_arguments():
"--type",
"-t",
help="Name of the type used to serialize data.",
choices=["SensorView", "GroundTruth", "SensorData"],
choices=OSITrace.message_types(),
default="SensorView",
type=str,
required=False,
Expand Down
19 changes: 19 additions & 0 deletions osi3trace/osi_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,28 @@
import struct

from osi3.osi_sensorview_pb2 import SensorView
from osi3.osi_sensorviewconfiguration_pb2 import SensorViewConfiguration
from osi3.osi_groundtruth_pb2 import GroundTruth
from osi3.osi_hostvehicledata_pb2 import HostVehicleData
from osi3.osi_sensordata_pb2 import SensorData
from osi3.osi_trafficcommand_pb2 import TrafficCommand
from osi3.osi_trafficcommandupdate_pb2 import TrafficCommandUpdate
from osi3.osi_trafficupdate_pb2 import TrafficUpdate
from osi3.osi_motionrequest_pb2 import MotionRequest
from osi3.osi_streamingupdate_pb2 import StreamingUpdate


MESSAGES_TYPE = {
"SensorView": SensorView,
"SensorViewConfiguration": SensorViewConfiguration,
"GroundTruth": GroundTruth,
"HostVehicleData": HostVehicleData,
"SensorData": SensorData,
"TrafficCommand": TrafficCommand,
"TrafficCommandUpdate": TrafficCommandUpdate,
"TrafficUpdate": TrafficUpdate,
"MotionRequest": MotionRequest,
"StreamingUpdate": StreamingUpdate,
}


Expand All @@ -25,6 +39,11 @@ def map_message_type(type_name):
"""Map the type name to the protobuf message type."""
return MESSAGES_TYPE[type_name]

@staticmethod
def message_types():
"""Message types that OSITrace supports."""
return list(MESSAGES_TYPE.keys())

def __init__(self, path=None, type_name="SensorView", cache_messages=False):
self.type = self.map_message_type(type_name)
self.file = None
Expand Down
Loading