Skip to content

Commit 4a5f43f

Browse files
authored
Merge pull request #818 from OpenSimulationInterface/817-support-more-top-level-messages-in-ositrace
Add more top-level messages to OSITrace
2 parents 2c3953b + ceeb575 commit 4a5f43f

File tree

5 files changed

+557
-16
lines changed

5 files changed

+557
-16
lines changed

doc/architecture/architecture_overview.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ OSI contains an object-based environment description that uses the message forma
88
Google developed and maintains the Protocol Buffer library.
99
OSI defines top-level messages that are used to exchange data between separate models.
1010
Top-level messages define the `GroundTruth` interface, the `SensorData` interface, and – since OSI version 3.0.0 – the interfaces `SensorView` and `SensorViewConfiguration`.
11-
Further top-level messages that were added in later versions of OSI are `TrafficCommand`, `TrafficUpdate`, `MotionRequest`, and `StreamingUpdate`.
11+
Further top-level messages that were added in later versions of OSI are `HostVehicleData`, `TrafficCommand`, `TrafficCommandUpdate`, `TrafficUpdate`, `MotionRequest`, and `StreamingUpdate`.
1212

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

doc/architecture/trace_file_naming.adoc

+19-7
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,35 @@ The names of OSI trace files should have the following format:
1414

1515
**Types**
1616

17-
`sd`::
18-
Trace file contains `SensorData` messages.
19-
2017
`sv`::
2118
Trace file contains `SensorView` messages.
2219

20+
`svc`::
21+
Trace file contains `SensorViewConfiguration` messages.
22+
2323
`gt`::
2424
Trace file contains `GroundTruth` messages.
2525

26-
`tu`::
27-
Trace file contains `TrafficUpdate` messages.
26+
`hvd`::
27+
Trace file contains `HostVehicleData` messages.
28+
29+
`sd`::
30+
Trace file contains `SensorData` messages.
2831

2932
`tc`::
3033
Trace file contains `TrafficCommand` messages.
3134

32-
`hvd`::
33-
Trace file contains `HostVehicleData` messages.
35+
`tcu`::
36+
Trace file contains `TrafficCommandUpdate` messages.
37+
38+
`tu`::
39+
Trace file contains `TrafficUpdate` messages.
40+
41+
`mr`::
42+
Trace file contains `MotionRequest` messages.
43+
44+
`su`::
45+
Trace file contains `StreamingUpdate` messages.
3446

3547
**Example**
3648

osi3trace/osi2read.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def command_line_arguments():
2828
"--type",
2929
"-t",
3030
help="Name of the type used to serialize data.",
31-
choices=["SensorView", "GroundTruth", "SensorData"],
31+
choices=OSITrace.message_types(),
3232
default="SensorView",
3333
type=str,
3434
required=False,

osi3trace/osi_trace.py

+19
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,28 @@
66
import struct
77

88
from osi3.osi_sensorview_pb2 import SensorView
9+
from osi3.osi_sensorviewconfiguration_pb2 import SensorViewConfiguration
910
from osi3.osi_groundtruth_pb2 import GroundTruth
11+
from osi3.osi_hostvehicledata_pb2 import HostVehicleData
1012
from osi3.osi_sensordata_pb2 import SensorData
13+
from osi3.osi_trafficcommand_pb2 import TrafficCommand
14+
from osi3.osi_trafficcommandupdate_pb2 import TrafficCommandUpdate
15+
from osi3.osi_trafficupdate_pb2 import TrafficUpdate
16+
from osi3.osi_motionrequest_pb2 import MotionRequest
17+
from osi3.osi_streamingupdate_pb2 import StreamingUpdate
1118

1219

1320
MESSAGES_TYPE = {
1421
"SensorView": SensorView,
22+
"SensorViewConfiguration": SensorViewConfiguration,
1523
"GroundTruth": GroundTruth,
24+
"HostVehicleData": HostVehicleData,
1625
"SensorData": SensorData,
26+
"TrafficCommand": TrafficCommand,
27+
"TrafficCommandUpdate": TrafficCommandUpdate,
28+
"TrafficUpdate": TrafficUpdate,
29+
"MotionRequest": MotionRequest,
30+
"StreamingUpdate": StreamingUpdate,
1731
}
1832

1933

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

42+
@staticmethod
43+
def message_types():
44+
"""Message types that OSITrace supports."""
45+
return list(MESSAGES_TYPE.keys())
46+
2847
def __init__(self, path=None, type_name="SensorView", cache_messages=False):
2948
self.type = self.map_message_type(type_name)
3049
self.file = None

0 commit comments

Comments
 (0)