Skip to content

Commit f4e49e3

Browse files
committed
update OSI
1 parent 379840a commit f4e49e3

25 files changed

+1796
-931
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ CTestTestfile.cmake
1111
build
1212
*.egg-info
1313
osi
14-
.project
14+
.project
15+
doc/html
16+
doc/latex
17+
osi_version.proto
18+
version.py

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@ script:
4343
- cmake -D CMAKE_PREFIX_PATH:PATH=${DEPS_DIR}/protobuf/install ..
4444
- cmake --build .
4545
- cd ..
46+
- python test_cases.py
4647
- python setup.py build
4748
- python setup.py sdist

CMakeLists.txt

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,21 @@ cmake_minimum_required(VERSION 3.7)
22

33
project(open_simulation_interface)
44

5+
# read the version number from the file "VERSION"
6+
file(STRINGS "VERSION" VERSION_CONTENTS)
7+
foreach(LINE ${VERSION_CONTENTS})
8+
string(REGEX REPLACE " |\t" "" LINE ${LINE})
9+
string(REGEX MATCH "^[^=]+" VERSION_NAME ${LINE})
10+
string(REPLACE "${VERSION_NAME}=" "" VERSION_VALUE ${LINE})
11+
set(${VERSION_NAME} "${VERSION_VALUE}")
12+
endforeach()
13+
14+
configure_file(osi_version.proto.in ${CMAKE_CURRENT_SOURCE_DIR}/osi_version.proto)
15+
516
find_package(Protobuf 2.6.1 REQUIRED)
617

718
set(OSI_PROTO_FILES
19+
osi_version.proto
820
osi_common.proto
921
osi_datarecording.proto
1022
osi_detectedlandmark.proto
@@ -25,22 +37,69 @@ set(OSI_PROTO_FILES
2537

2638
protobuf_generate_cpp(PROTO_SRCS PROTO_HEADERS ${OSI_PROTO_FILES})
2739

28-
add_library(${PROJECT_NAME} STATIC ${PROTO_SRCS} ${PROTO_HEADERS})
29-
target_include_directories(${PROJECT_NAME}
40+
add_library(${PROJECT_NAME}_static STATIC ${PROTO_SRCS} ${PROTO_HEADERS})
41+
target_include_directories(${PROJECT_NAME}_static
3042
PUBLIC
3143
${PROTOBUF_INCLUDE_DIR}
3244
${CMAKE_CURRENT_BINARY_DIR}
3345
)
34-
target_link_libraries(${PROJECT_NAME} PUBLIC ${PROTOBUF_LIBRARY})
46+
target_link_libraries(${PROJECT_NAME}_static PUBLIC ${PROTOBUF_LIBRARY})
3547

3648

37-
add_library(${PROJECT_NAME}_pic STATIC ${PROTO_SRCS} ${PROTO_HEADERS})
49+
add_library(${PROJECT_NAME}_obj OBJECT ${PROTO_SRCS} ${PROTO_HEADERS})
50+
target_include_directories(${PROJECT_NAME}_obj
51+
PUBLIC
52+
${PROTOBUF_INCLUDE_DIR}
53+
${CMAKE_CURRENT_BINARY_DIR}
54+
)
55+
set_property(TARGET ${PROJECT_NAME}_obj PROPERTY POSITION_INDEPENDENT_CODE ON)
56+
57+
58+
add_library(${PROJECT_NAME}_pic STATIC $<TARGET_OBJECTS:${PROJECT_NAME}_obj>)
3859
target_include_directories(${PROJECT_NAME}_pic
3960
PUBLIC
4061
${PROTOBUF_INCLUDE_DIR}
4162
${CMAKE_CURRENT_BINARY_DIR}
4263
)
4364
target_link_libraries(${PROJECT_NAME}_pic PUBLIC ${PROTOBUF_LIBRARY})
65+
set_property(TARGET ${PROJECT_NAME}_pic PROPERTY POSITION_INDEPENDENT_CODE ON)
4466

4567

46-
set_property(TARGET ${PROJECT_NAME}_pic PROPERTY POSITION_INDEPENDENT_CODE ON)
68+
add_library(${PROJECT_NAME} SHARED $<TARGET_OBJECTS:${PROJECT_NAME}_obj>)
69+
target_include_directories(${PROJECT_NAME}
70+
PUBLIC
71+
${PROTOBUF_INCLUDE_DIR}
72+
${CMAKE_CURRENT_BINARY_DIR}
73+
)
74+
target_link_libraries(${PROJECT_NAME} PUBLIC ${PROTOBUF_LIBRARY})
75+
76+
77+
# add a target to generate API documentation with Doxygen
78+
# Dependencies: Doxygen and proto2cpp.py
79+
FIND_PACKAGE(Doxygen)
80+
set(FILTER_PROTO2CPP_PY_PATH CACHE PATH "directory to the filter proto2cpp.py")
81+
82+
if(NOT DOXYGEN_FOUND)
83+
84+
message(WARNING "Doxygen could not be found.")
85+
86+
else()
87+
88+
if(NOT EXISTS ${FILTER_PROTO2CPP_PY_PATH}/proto2cpp.py)
89+
90+
message(WARNING "${FILTER_PROTO2CPP_PY_PATH}/proto2cpp.py could not be found.")
91+
92+
else()
93+
94+
set(doxyfile_in ${CMAKE_CURRENT_SOURCE_DIR}/doxygen_config.cmake.in)
95+
set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
96+
97+
configure_file(${doxyfile_in} ${doxyfile} @ONLY)
98+
99+
ADD_CUSTOM_TARGET(api_doc ALL
100+
COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile}
101+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
102+
103+
endif(NOT EXISTS ${FILTER_PROTO2CPP_PY_PATH}/proto2cpp.py)
104+
105+
endif(NOT DOXYGEN_FOUND)

README.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ Open Simulation Interface (OSI)
33

44
[![Travis Build Status](https://travis-ci.org/OpenSimulationInterface/open-simulation-interface.svg?branch=master)](https://travis-ci.org/OpenSimulationInterface/open-simulation-interface)
55

6+
67
General description
78
-------------------
8-
https://www.hot.ei.tum.de/forschung/automotive-veroeffentlichungen/
9+
[TUM Department of Electrical and Computer Engineering](https://www.hot.ei.tum.de/forschung/automotive-veroeffentlichungen/)
910

1011

1112
Global remarks
@@ -38,13 +39,16 @@ Fault injection: how-to
3839
Injection of pre-defined sensor errors should be handled by a specialized "fault injector" component that acts like a
3940
sensor model component, i.e. it takes a SensorData message as input and returns a modified SensorData message as output.
4041
Specific errors should be handled as follows:
41-
- Ghost objects / false positive: An additional SensorDataObject is added to the list of objects in SensorData.object
42-
with SensorDataObject.model_internal_object.ground_truth_type set to kTypeGhost.
43-
- False negative: The object is marked as not seen by the sensor by setting the property
44-
SensorDataObject.model_internal_object.is_seen to false. The implementation of field-of-view calculation modules
45-
should respect this flag and never reset an object marked as not-seen to seen.
42+
- Ghost objects / false positive:
43+
An additional SensorDataObject is added to the list of objects in SensorData.object
44+
with SensorDataObject.model_internal_object.ground_truth_type set to kTypeGhost.
45+
- False negative:
46+
The object is marked as not seen by the sensor by setting the property
47+
SensorDataObject.model_internal_object.is_seen to false. The implementation
48+
of field-of-view calculation modules should respect this flag and never reset
49+
an object marked as not-seen to seen.
50+
4651

47-
4852
Versioning
4953
----------
5054
The version number is defined in InterfaceVersion::version_number in osi_common.proto as the field's default value.
@@ -70,9 +74,24 @@ The compatibility of both recorded files and code remains.
7074
- Changing or adding comments
7175
- Clarification of text passages explaining the message content
7276

77+
7378
Packaging
7479
---------
7580

7681
A specification to package sensor models using OSI as (extended)
7782
Functional Mock-up Units (FMUs) for use in simulation environments
7883
is available [here](https://github.com/OpenSimulationInterface/osi-sensor-model-packaging).
84+
85+
86+
Documentation
87+
-------------
88+
89+
In order to generate the doxygen documentation for OSI, please follow the following steps:
90+
1. Install [Doxygen](http://www.stack.nl/~dimitri/doxygen/download.html), set an environmental variable 'doxygen' with the path to the binary file and add it to the PATH variable: `PATH += %doxygen%`.
91+
2. Download the [vg-1.5.0.zip](https://github.com/vgteam/vg/releases/tag/v1.5.0). Unpack and copy the content of folder /vg-1.5.0/contrib/proto2cpp to your desired `<path-to-proto2cpp.py>`
92+
3. Install [graphviz-2.38](http://www.graphviz.org/Download_windows.php ), set an environmental variable 'graphviz' with the path to the binary file and add it to the PATH variable: `PATH += %graphviz%`.
93+
4. From the cmd navigate to the build directory and run:
94+
```cmd
95+
cmake -DFILTER_PROTO2CPP_PY_PATH=<path-to-proto2cpp.py> <path-to-CMakeLists.txt>
96+
```
97+
5. The build process will then generate the doxygen documentation under the directory doc.

VERSION

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
VERSION_MAJOR = 2
2+
VERSION_MINOR = 2
3+
VERSION_PATCH = 0

doxygen_config.cmake.in

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#set the name and version of the project according to the configuration in CMakeLists.txt
2+
PROJECT_NAME = "@CMAKE_PROJECT_NAME@"
3+
PROJECT_NUMBER = @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@
4+
5+
#Set input and output directories
6+
INPUT = "@CMAKE_CURRENT_SOURCE_DIR@"
7+
INPUT += "@CMAKE_CURRENT_SOURCE_DIR@/README.md"
8+
9+
USE_MDFILE_AS_MAINPAGE = "@CMAKE_CURRENT_SOURCE_DIR@/README.md"
10+
11+
OUTPUT_DIRECTORY = "@CMAKE_CURRENT_SOURCE_DIR@/doc"
12+
IMAGE_PATH = "@CMAKE_CURRENT_SOURCE_DIR@/doc/images"
13+
14+
# There is no standard configuration for .proto files documentation.
15+
# A Doxygen filter for .proto files has to be added under the directory doc/.
16+
JAVADOC_AUTOBRIEF = NO
17+
EXTENSION_MAPPING = proto=C
18+
FILE_PATTERNS = *.proto
19+
INPUT_FILTER = "python @FILTER_PROTO2CPP_PY_PATH@/proto2cpp.py"
20+
HAVE_DOT = YES
21+

0 commit comments

Comments
 (0)