Skip to content

Commit 4a59df1

Browse files
Merge branch 'master' into Extension_osi_hostvehicledata_v2
2 parents e973b6f + 96350db commit 4a59df1

File tree

95 files changed

+8827
-1657
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+8827
-1657
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ dist/
44
doc/html
55
doc/latex
66
osi/
7+
osi3/
78

89
# Specific extensions
910
*.egg-info
@@ -20,6 +21,7 @@ cmake_install.cmake
2021
install_manifest.txt
2122
osi_version.proto
2223
version.py
24+
pyproject.toml
2325

2426
# Eclipse-specific files, if any
2527
*.cproject

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "asciidoc-resources"]
2+
path = asciidoc-resources
3+
url = https://code.asam.net/simulation/asciidoc-resources.git
4+
[submodule "flatbuffers"]
5+
path = flatbuffers
6+
url = https://github.com/google/flatbuffers.git

CMakeLists.txt

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ project(open_simulation_interface)
55
# set default compiler
66
set(CMAKE_CXX_STANDARD 11)
77

8+
# Optional Flatbuffer support
9+
set(BUILD_FLATBUFFER OFF CACHE BOOLEAN "Build flatbuffer versions of libraries")
10+
811
# Set a default build type if none was specified
912
set(default_build_type "Release")
1013
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
@@ -84,6 +87,48 @@ set(OSI_PROTO_FILES
8487
)
8588

8689
protobuf_generate_cpp(PROTO_SRCS PROTO_HEADERS ${OSI_PROTO_FILES})
90+
set(FLAT_HEADERS "")
91+
if(BUILD_FLATBUFFER)
92+
set(FLAT_FBS "")
93+
add_subdirectory("flatbuffers"
94+
${CMAKE_CURRENT_BINARY_DIR}/flatbuffers-build
95+
EXCLUDE_FROM_ALL)
96+
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/descriptor.fbs" "namespace osi3;")
97+
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include")
98+
list(APPEND FLAT_FBS "${CMAKE_CURRENT_BINARY_DIR}/descriptor.fbs")
99+
foreach (proto ${OSI_PROTO_FILES})
100+
get_filename_component(proto_base ${proto} NAME_WE)
101+
set(fbs "${proto_base}.fbs")
102+
add_custom_command(
103+
OUTPUT "${fbs}"
104+
COMMAND $<TARGET_FILE:flatc> -I "${PROTOBUF_IMPORT_DIRS}" -o "${CMAKE_CURRENT_BINARY_DIR}" --proto "${CMAKE_CURRENT_SOURCE_DIR}/${proto}"
105+
DEPENDS "${proto}" flatc
106+
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
107+
COMMENT "Convert ${proto} to ${fbs} using flatc"
108+
)
109+
list(APPEND FLAT_FBS "${CMAKE_CURRENT_BINARY_DIR}/${fbs}")
110+
endforeach()
111+
112+
foreach (flat ${FLAT_FBS})
113+
get_filename_component(flat_base ${flat} NAME_WE)
114+
set(fbs "${flat_base}.fbs")
115+
set(fbh "${flat_base}_generated.h")
116+
add_custom_command(
117+
OUTPUT "include/${fbh}"
118+
COMMAND $<TARGET_FILE:flatc> -o "${CMAKE_CURRENT_BINARY_DIR}/include" --cpp --gen-mutable --gen-name-strings --scoped-enums "${fbs}"
119+
DEPENDS "${FLAT_FBS}" flatc
120+
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
121+
COMMENT "Process ${fbs} to ${fbh} using flatc"
122+
)
123+
list(APPEND FLAT_HEADERS "${CMAKE_CURRENT_BINARY_DIR}/include/${fbh}")
124+
endforeach()
125+
126+
add_custom_target(${PROJECT_NAME}_fbs_build ALL DEPENDS "${FLAT_HEADERS}")
127+
add_library(${PROJECT_NAME}_fbs INTERFACE)
128+
target_include_directories(${PROJECT_NAME}_fbs INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include/>)
129+
target_include_directories(${PROJECT_NAME}_fbs SYSTEM INTERFACE $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>)
130+
target_link_libraries(${PROJECT_NAME}_fbs INTERFACE flatbuffers)
131+
endif()
87132

88133
add_library(${PROJECT_NAME}_static STATIC ${PROTO_SRCS} ${PROTO_HEADERS})
89134
target_include_directories(${PROJECT_NAME}_static
@@ -168,7 +213,7 @@ install(FILES
168213
COMPONENT dev)
169214

170215
# Header files
171-
install(FILES ${PROTO_HEADERS}
216+
install(FILES ${PROTO_HEADERS} ${FLAT_HEADERS}
172217
DESTINATION "${INSTALL_INCLUDE_DIR}")
173218

174219
# Install the export set for use with the install-tree

asciidoc-resources

Submodule asciidoc-resources added at e0bd505
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
= Overview of OSI architecture
2+
3+
OSI contains an object-based environment description that uses the message format of the https://github.com/protocolbuffers/protobuf/wiki[Protocol Buffer] library.
4+
Google developed and maintains the Protocol Buffer library.
5+
OSI defines top-level messages that are used to exchange data between separate models.
6+
Top-level messages define the `GroundTruth` interface, the `SensorData` interface, and – since OSI version 3.0.0 – the interfaces `SensorView`, `SensorViewConfiguration`, and `FeatureData`.
7+
8+
The following figure shows the interfaces and models involved in modeling a sensor.
9+
10+
.Open Simulation Interface overview
11+
image::{images_open_simulation_interface}/osi-context.png[1100]
12+
13+
14+
OSI also defines interfaces for traffic participant models.
15+
The `TrafficCommand` interface makes it possible to send commands to traffic participant models.
16+
The `TrafficUpdate` interface makes it possible to receive the updated state from traffic participant models.
17+
The following figure shows the interfaces of a generic traffic participant.
18+
19+
.Interface of a traffic participant
20+
image::{images_open_simulation_interface}/osi-traffic-participant-principle.png[1100]
21+
22+
Traffic participant models may use other OSI interfaces internally, for example, to model autonomous vehicles.
23+
The following figure shows a more advanced use case for traffic participants.
24+
25+
.Traffic participant with sensor models, AD function, and dynamic model
26+
image::{images_open_simulation_interface}/osi-traffic-participant-advanced.png[1100]
27+
28+
The `HostVehicleData` interface describes the measured internal states of a traffic participant.
29+
OSI currently provides only limited support for data structures that describe measured internal states of traffic participants.
30+
Actuator intentions are currently not covered by OSI and must be handled using a different data description format.
31+
32+
All fields in an interface are set to `optional`.
33+
`required` is not used.
34+
This has been done to allow backward-compatible changes in the field.
35+
Additionally, this is the default behavior in Protocol Buffer version 3 that no longer has the `required` type.
36+
Setting all fields to `optional` thus ensures update compatibility.
37+
However, this does not mean that it is optional to fill the field.
38+
For the purpose of providing a complete interface, all existing fields should be set, unless not setting a field carries a specific meaning, as indicated in the accompanying comment.
39+
40+
All field numbers equal to or greater than 10000 are available for user-specific extensions via custom fields.
41+
No future evolution of OSI will therefore use field numbers equal to or greater than 10000.

doc/architecture/data_layer.adoc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
= Data layer
2+
3+
The OSI data layer is defined in the message specifications using the ProtoBuf IDL cite:[protobuf].
4+
This defines the data that can be transmitted using OSI, including the structure and the semantics of the data.
5+
6+
Additionally, it specifies the encoding to be used when OSI data is transmitted.
7+
Currently, ProtoBuf encoding is used, but other encodings are possible with the ProtoBuf IDL.
8+
FlatBuffer encoding has been implemented as an experimental feature.
9+
10+
The data layer does not directly define components and transmission routes.
11+
These are defined in the OSI packaging layer.
12+
There may be different packaging layer implementations using the shared data layer definitions.
13+
The data that is exchanged remains compatible regardless of the packaging layer implementation.
14+
The use of a shared data layer ensures easy bridging between different packaging layer implementations.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
= Environmental effect model
2+
3+
Environmental effect models consume sensor-view messages and produce sensor-view messages.
4+
Environmental effect models may, for example, alter sensor-view messages to include effects and phenomena caused by:
5+
6+
* Shadows and occlusions
7+
* Weather effects
8+
* Physics of a sensor
9+
* Pre-processing of raw sensor data

doc/architecture/feature_data.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
= Feature data
2+
3+
Feature-data messages contain detected features in the reference frame of a sensor.
4+
Feature-data messages are generated from ground-truth messages.
5+
They serve, for example, as an input to sensor models simulating object detection or feature fusion models.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
= Trace-file formatting scripts
2+
3+
The OSI repository contains Python scripts for converting trace files from one format to another.
4+
The formatting scripts are stored in `open-simulation-interface/format/`
5+
6+
**txt2osi.py**
7+
8+
`txt2osi.py` converts plain-text trace files to binary `.osi` trace files.
9+
This script takes the following parameters:
10+
11+
`--data`, `-d`::
12+
String containing the path to the file with serialized data.
13+
14+
`--type`, `-t`::
15+
Optional string describing the message type used to serialize data.
16+
`'SensorView'`, `'GroundTruth'`, or `'SensorData'` are permitted values.
17+
The default value is `'SensorView'`.
18+
19+
`--output`, `-o`::
20+
Optional string containing the name of the output file.
21+
The default value is `'converted.osi'`.
22+
23+
`--compress`, `-c`::
24+
Optional Boolean controlling whether to compress the output to an lzma file.
25+
`True`, or `False` are permitted values.
26+
The default value is `False`.
27+
28+
**osi2read.py**
29+
30+
`osi2read.py` converts trace files to human-readable `.txth` trace files.
31+
This script takes the following parameters:
32+
33+
`--data`, `-d`::
34+
String containing the path to the file with serialized data.
35+
36+
`--type`, `-t`::
37+
Optional string describing the message type used to serialize data.
38+
`'SensorView'`, `'GroundTruth'`, or `'SensorData'` are permitted values.
39+
The default value is `'SensorView'`.
40+
41+
`--output`, `-o`::
42+
Optional string containing the name of the output file.
43+
The default value is `'converted.txth'`.
44+
45+
`--format`, `-f`::
46+
Optional string containing the format type of the trace file.
47+
`'separated'`, or `None` are permitted values.
48+
The default value is `None`.
49+
50+
**Related topics**
51+
52+
* <<#top-1a2f4b0c-195c-4f18-89ad-d48a123bd8c1>>[OSI trace file formats]

doc/architecture/ground_truth.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
= Ground truth
2+
3+
Ground-truth messages describe the simulated environment containing all simulated objects in the global coordinate system at consecutive time instances.
4+
They are based on data available to the simulation environment.
5+
Ground-truth messages are typically contained in sensor view messages.

0 commit comments

Comments
 (0)