Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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 `TrafficCommand`, `TrafficCommandUpdate`, `TrafficUpdate`, `MotionRequest`, and `StreamingUpdate`.

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

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
17 changes: 17 additions & 0 deletions osi3trace/osi_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,24 @@
from osi3.osi_sensorview_pb2 import SensorView
from osi3.osi_groundtruth_pb2 import GroundTruth
from osi3.osi_sensordata_pb2 import SensorData
from osi3.osi_sensorviewconfiguration_pb2 import SensorViewConfiguration
from osi3.osi_trafficupdate_pb2 import TrafficUpdate
from osi3.osi_trafficcommand_pb2 import TrafficCommand
from osi3.osi_trafficcommandupdate_pb2 import TrafficCommandUpdate
from osi3.osi_motionrequest_pb2 import MotionRequest
from osi3.osi_streamingupdate_pb2 import StreamingUpdate


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


Expand All @@ -25,6 +37,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