Skip to content

Commit 4aae7d4

Browse files
committed
#550 Merge latest master branch from upstream
Signed-off-by: Martin Stump <11492152+globberwops@users.noreply.github.com>
2 parents 9978576 + f3db096 commit 4aae7d4

File tree

95 files changed

+8826
-1656
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

+8826
-1656
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
compile_commands.json
2527

.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")
@@ -83,6 +86,48 @@ set(OSI_PROTO_FILES
8386
)
8487

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

87132
add_library(${PROJECT_NAME}_static STATIC ${PROTO_SRCS} ${PROTO_HEADERS})
88133
add_library(${PROJECT_NAME}::${PROJECT_NAME}_static ALIAS ${PROJECT_NAME}_static)
@@ -185,7 +230,7 @@ install(FILES
185230
COMPONENT dev)
186231

187232
# Header files
188-
install(FILES ${PROTO_HEADERS}
233+
install(FILES ${PROTO_HEADERS} ${FLAT_HEADERS}
189234
DESTINATION "${OSI_INSTALL_INCLUDE_DIR}")
190235

191236
# 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+
The Protocol Buffer library was developed and is maintained by Google.
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 with 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 does no longer have the `required` type.
36+
Setting all fields to `optional` thus ensures update compatibility.
37+
However, this does not mean that filling the field is optional.
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+
Therefore, no future evolution of OSI will 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 data layer of OSI is defined in the message specifications using the ProtoBuf IDL.
4+
It 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 packaging layer of OSI.
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 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 the other.
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+
Allowed values are `'SensorView'`, `'GroundTruth'`, or `'SensorData'`.
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 a lzma file.
25+
Allowed values are `True`, or `False`.
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+
Allowed values are `'SensorView'`, `'GroundTruth'`, or `'SensorData'`.
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+
Allowed values are `'separated'`, or `None`.
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+
It is based on data available to the simulation environment.
5+
Typically, ground-truth messages are contained in sensor view messages.

0 commit comments

Comments
 (0)