Skip to content

Commit ff2385f

Browse files
committed
Merge branch 'master' into bugfix/osi_object
2 parents ef7950a + 81e0db3 commit ff2385f

40 files changed

+962
-230
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ In this context, OSI defines generic interfaces to ensure modularity, integrabil
1212

1313
For more information on OSI see the [official documentation](https://opensimulationinterface.github.io/osi-documentation/) or the [official reference documentation](https://opensimulationinterface.github.io/open-simulation-interface/) for defined protobuf messages.
1414

15-
[[1]](https://www.hot.ei.tum.de/forschung/automotive-veroeffentlichungen/) *A generic interface for the environment perception of automated driving functions in virtual scenarios.(Dated 03.02.2017) T. Hanke, N. Hirsenkorn, C. van-Driesten, P. Garcia-Ramos, M. Schiementz, S. Schneider, E. Biebl*
15+
[1] Hanke, T., Hirsenkorn, N., van-Driesten, C., Garcia-Ramos, P., Schiementz, M., Schneider, S. & Biebl, E. (2017, February 03). *A generic interface for the environment perception of automated driving functions in virtual scenarios.* Retrieved January 25, 2020, from https://www.hot.ei.tum.de/forschung/automotive-veroeffentlichungen/
1616

1717
## Usage
1818
##### Example of writing and reading an OSI message in `Python`

VERSION

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

doc/commenting.rst

Lines changed: 64 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ During the building process of open simulation interface (using the `proto2cpp <
77

88
For any additional comment styles see `list <http://www.doxygen.nl/manual/commands.html>`_ of doxygen commands.
99

10-
Reference for writing values and units: ISO 80000-1: 2009, Quantities and units – Part 1: General
11-
Nice summary: [Rohde & Schwarz: Der korrekte Umgang mit Größen, Einheiten und Gleichungen ](https://karriere.rohde-schwarz.de/fileadmin/customer/downloads/PDF/Der_korrekte_Umgang_mit_Groessen_Einheiten_und_Gleichungen_bro_de_01.pdf
12-
)
10+
Reference for writing values and units: ISO 80000-1:2013-08, Quantities and units – Part 1: General
11+
Nice summary in German: `Rohde & Schwarz: Der korrekte Umgang mit Groessen, Einheiten und Gleichungen <https://karriere.rohde-schwarz.de/fileadmin/customer/downloads/PDF/Der_korrekte_Umgang_mit_Groessen_Einheiten_und_Gleichungen_bro_de_01.pdf>`_
1312

1413

1514
Commenting with block syntax
@@ -150,7 +149,7 @@ Then you describe the field by adding an explanation.
150149
//
151150
message EnvironmentalConditions
152151
{
153-
// Atmospheric pressure in Pascal at z=0.0 in world frame (about 101325 Pa).
152+
// Atmospheric pressure in Pascal at z = 0.0 m in world frame (about 101325 Pa).
154153
//
155154
optional double atmospheric_pressure = 1;
156155
}
@@ -169,7 +168,7 @@ Next you decide the unit of the field.
169168
//
170169
message EnvironmentalConditions
171170
{
172-
// Atmospheric pressure in Pascal at z=0.0 in world frame (about 101325 Pa).
171+
// Atmospheric pressure in Pascal at z = 0.0 m in world frame (about 101325 Pa).
173172
//
174173
// Unit: Pa
175174
//
@@ -190,7 +189,7 @@ You can optionally add a note to the field to describe the field better.
190189
//
191190
message EnvironmentalConditions
192191
{
193-
// Atmospheric pressure in Pascal at z=0.0 in world frame (about 101325 Pa).
192+
// Atmospheric pressure in Pascal at z = 0.0 m in world frame (about 101325 Pa).
194193
//
195194
// Unit: Pa
196195
//
@@ -199,7 +198,40 @@ You can optionally add a note to the field to describe the field better.
199198
optional double atmospheric_pressure = 1;
200199
}
201200
202-
If you want to provide a reference to a DIN or to web page which helps in understanding the field you can add a reference.
201+
To help understanding the field, you should add a reference.
202+
Every OSI message should be defined properly and should have a well cited reference.
203+
204+
**Citation style for different sources:**
205+
206+
- Within the text, the number system is used with the number of the source in brackets [#] for mentioning.
207+
- We use the so called `"APA style" <https://apastyle.apa.org/>`_ from the American Psychological Association for referencing.
208+
- In the references list, the number in brackets [#] is followed by a full citation.
209+
- For writing the title in italic, use <em>title</em>.
210+
- If the list contains more than one entry, add " \n " at the end of the line to create a line break within the list.
211+
- Author names are written as <surname>, <initial(s)> like Authorname, A. A.
212+
- Editor names are written as <initial(s)> <surname> like B. B. Editorname.
213+
- Naming pages at the end is optional to enable finding in long texts or for direct citations.
214+
- All citations should be primary citations. Sources like Wikipedia et al. are not allowed.
215+
- Find filled-out examples under `https://apastyle.apa.org <https://apastyle.apa.org/style-grammar-guidelines/references/examples>`_ and in existing entries.
216+
- The scheme of popular sources for the reference list is as follows (replace tags with corresponding values):
217+
218+
1. <author1>, <author2>, <author3> & <author4>. (<year>). Contribution in a compilation title. <em><Compilation Title></em>. <edition>. <page(s)>. <publisher>. <location>. <doi>. <page(s)>.
219+
220+
2. <author1>, <author2> & <author3>. (<year>). <em><book (monograph) title></em>. <edition>. <publisher>. <doi>. <page(s)>.
221+
222+
3. <author1> & <author2>. (<year>). <book chapter title>. In <editor1> & <editor2> (Eds.), <em><book title></em> (<page(s)>). <publisher>. <doi>. <page(s)>.
223+
224+
4. <author1> & <author2>. (<year>). <journal article title>. <em><journal title></em>. <page(s)>. <location>. <doi>. <page(s)>.
225+
226+
5. <author>. (<year>). <em><Phd thesis title></em>. Phd. thesis. <location>. <university>. <doi or url>. <page(s)>.
227+
228+
6. <author>. (<year>, <month> <day>). <em><internet article title></em>. Retrieved <month> <day>, <year>, from <url>.
229+
230+
7. <standarding organisation>. (<year>). <em><title of the standard></em>. (<standard identifier>). <location>.
231+
232+
8. <author>. (<year>). <em><patent title and id></em>. <location>. <organisation>.
233+
234+
203235

204236
.. code-block:: protobuf
205237
@@ -213,14 +245,15 @@ If you want to provide a reference to a DIN or to web page which helps in unders
213245
//
214246
message EnvironmentalConditions
215247
{
216-
// Atmospheric pressure in Pascal at z=0.0 in world frame (about 101325 Pa).
248+
// Atmospheric pressure in Pascal at z = 0.0 m in world frame (about 101325 Pa) [1, 2].
217249
//
218250
// Unit: Pa
219251
//
220252
// \note 100000 Pa = 1 bar
221253
//
222-
// \par Reference:
223-
// - [1] [Definition atmospheric pressure](https://en.wikipedia.org/wiki/Atmospheric_pressure)
254+
// \par References:
255+
// [1] DIN Deutsches Institut fuer Normung e. V. (1982). <em>DIN 5031-3 Strahlungsphysik im optischen Bereich und Lichttechnik - Groessen, Formelzeichen und Einheiten der Lichttechnik</em>. (DIN 5031-3:1982-03). Berlin, Germany. \n
256+
// [2] Rapp, C. (2017). Grundlagen der Physik. In <em>Hydraulik fuer Ingenieure und Naturwissenschaftler</em> (pp.23-36). Springer Vieweg. Wiesbaden, Germany. https://doi.org/10.1007/978-3-658-18619-7_3. p. 105.
224257
//
225258
optional double atmospheric_pressure = 1;
226259
}
@@ -239,14 +272,15 @@ Finally you can provide a set of rules which this field needs to be followed. Th
239272
//
240273
message EnvironmentalConditions
241274
{
242-
// Atmospheric pressure in Pascal at z=0.0 in world frame (about 101325 Pa).
275+
// Atmospheric pressure in Pascal at z = 0.0 m in world frame (about 101325 Pa) [1, 2].
243276
//
244277
// Unit: Pa
245278
//
246279
// \note 100000 Pa = 1 bar
247280
//
248-
// \par Reference:
249-
// - [1] [Definition atmospheric pressure](https://en.wikipedia.org/wiki/Atmospheric_pressure)
281+
// \par References:
282+
// [1] DIN Deutsches Institut fuer Normung e. V. (1982). <em>DIN 5031-3 Strahlungsphysik im optischen Bereich und Lichttechnik - Groessen, Formelzeichen und Einheiten der Lichttechnik</em>. (DIN 5031-3:1982-03). Berlin, Germany. \n
283+
// [2] Rapp, C. (2017). Grundlagen der Physik. In <em>Hydraulik fuer Ingenieure und Naturwissenschaftler</em> (pp.23-36). Springer Vieweg. Wiesbaden, Germany. https://doi.org/10.1007/978-3-658-18619-7_3. p. 105.
250284
//
251285
// \rules
252286
// is_optional
@@ -262,45 +296,21 @@ The rule definition must follow the syntax which is defined by a regex search wh
262296

263297
.. code-block:: python
264298
265-
'is_greater_than': r'\b(is_greater_than)\b: \d+(\.\d+)?' # is_greater_than: 1
266-
'is_greater_than_or_equal_to': r'\b(is_greater_than_or_equal_to)\b: \d+(\.\d+)?' # is_greater_than_or_equal_to: 1
267-
'is_less_than_or_equal_to': r'\b(is_less_than_or_equal_to)\b: \d+(\.\d+)?' # is_less_than_or_equal_to: 10
268-
'is_less_than': r'\b(is_less_than)\b: \d+(\.\d+)?' # is_less_than: 2
269-
'is_equal': r'\b(is_equal)\b: \d+(\.\d+)?' # is_equal: 1
270-
'is_different': r'\b(is_different)\b: \d+(\.\d+)?' # is_different: 2
271-
'is_global_unique': r'\b(is_global_unique)\b' # is_global_unique
272-
'refers': r'\b(refers)\b' # refers
273-
'is_iso_country_code': r'\b(is_iso_country_code)\b' # is_iso_country_code
274-
'first_element': r'\b(first_element)\b: \{.*: \d+\.\d+\}' # first_element: {is_equal: 0.13, is_greater_than: 0.13}
275-
'last_element': r'\b(last_element)\b: \{.*: \d+\.\d+\}' # last_element: {is_equal: 0.13, is_greater_than: 0.13}
276-
'is_optional': r'\b(is_optional)\b' # is_optional
277-
'check_if': r'\b(check_if)\b: \[\{.*: \d+(\.\d+)?, target: .*}, \{do_check: \{.*: \d+(\.\d+)?}}]' # check_if: [{is_equal: 2, is_greater_than: 3, target: this.y}, {do_check: {is_equal: 1, is_less_than: 3}}]
278-
279-
You can check the correctness of these regular expression on `regex101 <https://regex101.com/r/6tomm6/16>`_.
280-
281-
282-
.. is_greater_than: 2
283-
.. is_greater_than: 2.23
284-
.. is_greater_than_or_equal_to: 1
285-
.. is_greater_than_or_equal_to: 1.12
286-
.. is_less_than_or_equal_to: 10
287-
.. is_less_than_or_equal_to: 10.123
288-
.. is_less_than: 2
289-
.. is_less_than: 2.321
290-
.. is_equal: 1
291-
.. is_equal: 1.312
292-
.. is_different: 2
293-
.. is_different: 2.2122
294-
.. is_global_unique
295-
.. refers
296-
.. is_iso_country_code
297-
.. first_element: {is_equal: 3, is_greater: 2}
298-
.. first_element: {is_equal: 0.13, is_greater: 0.13}
299-
.. last_element: {is_equal: 3, is_greater: 2}
300-
.. last_element: {is_equal: 0.13, is_greater: 0.13}
301-
.. check_if: [{is_equal: 2, is_greater_than: 3, target: this.y}, {do_check: {is_equal: 1, is_less_than: 3}}]
302-
.. is_set
303-
299+
'is_greater_than': r'^[ ]\b(is_greater_than)\b: ([\s\d]+)$' # is_greater_than: 1
300+
'is_greater_than_or_equal_to': r'^[ ]\b(is_greater_than_or_equal_to)\b: ([\s\d]+)$' # is_greater_than_or_equal_to: 1
301+
'is_less_than_or_equal_to': r'^[ ]\b(is_less_than_or_equal_to)\b: ([\s\d]+)$' # is_less_than_or_equal_to: 10
302+
'is_less_than': r'^[ ]\b(is_less_than)\b: ([\s\d]+)$' # is_less_than: 2
303+
'is_equal': r'^[ ]\b(is_equal_to)\b: ([\s\d]+)$' # is_equal_to: 1
304+
'is_different': r'^[ ]\b(is_different_to)\b: ([\s\d]+)$' # is_different_to: 2
305+
'is_global_unique': r'^[ ]\b(is_globally_unique)\b' # is_globally_unique
306+
'refers': r'^[ ]\b(refers_to)\b' # refers_to: DetectedObject
307+
'is_iso_country_code': r'^[ ]\b(is_iso_country_code)\b' # is_iso_country_code
308+
'first_element': r'^[ ]\b(first_element)\b' # first_element height is_equal_to 0.13
309+
'last_element': r'^[ ]\b(last_element)\b' # last_element width is_equal_to 0.13
310+
'check_if': r'^[ ](\bcheck_if\b)(.*\belse do_check\b)' # check_if this.type is_equal_to 2 else do_check is_set
311+
312+
You can check the correctness of these regular expression on `regex101 <https://regex101.com/r/P4KeuO/1>`_.
313+
304314

305315
Commenting with doxygen references
306316
------------------------------------
@@ -318,8 +328,8 @@ If you want to reference message fields and enums add '#' to the enum/field name
318328
319329
// A reference to a enum e.g. \c #COLOR_GREEN.
320330
321-
Commenting with links
322-
----------------------
331+
Commenting with links (e.g. in references)
332+
------------------------------------------
323333
With ``[<add name of your link>](<add url of your link>)`` you can integrate a link to a certain homepage while commenting.
324334

325335
Commenting with images

doc/description.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ optional. For the purpose of providing a complete interface, all
1515
existing fields should be set, unless not setting a field carries a
1616
specific meaning as indicated in the accompanying comment.
1717

18+
All field numbers of 10000 and upward are available for user-specific
19+
extensions (i.e. custom fields), so no future evolution of OSI will
20+
use field numbers of 10000 or above itself.
21+
1822
Compatibility
1923
-------------
2024

doc/fileformat.rst

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,33 @@ In summary we have currently three types of formats:
3636
2. ``*.txt`` trace files which are ``$$__$$`` separated.
3737
3. ``*.txth`` files which are human readable trace files for just plausibility checks.
3838

39+
Trace file naming convention
40+
-----------------------------
41+
As best practice we recommend to name the trace files in the following format:
42+
43+
.. code-block:: txt
44+
45+
<type>_<osi-version>_<protobuf-version>_<frame-number>_<custom-trace-name>.osi
46+
47+
For example a naming for a trace with the information below:
48+
49+
.. code-block:: txt
50+
51+
Type = SensorView
52+
OSI Version= 3.1.2
53+
Protobuf Version = 3.0.0
54+
Number of frames = 1523
55+
Scenario name = highway
56+
57+
would then look like this:
58+
59+
.. code-block:: txt
60+
61+
sv_312_300_1523_highway.osi
62+
63+
The type definition would only be possible for ``SensorView = sv``, ``SensorData = sd`` and ``GroundTruth = gt``.
64+
By following this best practice users can understand the general content of a file. By comparing the information provided by the naming and the actual trace the user can check the overall validity of a trace file.
65+
3966
Generate OSI traces
4067
--------------------
4168
If you want to generate a valid OSI trace file which can be used as an input for the `osi-validator <https://github.com/OpenSimulationInterface/osi-validation>`_ or the `osi-visualizer <https://github.com/OpenSimulationInterface/osi-visualizer>`_ see the example script in python below:
@@ -47,7 +74,7 @@ If you want to generate a valid OSI trace file which can be used as an input for
4774
4875
def main():
4976
"""Initialize SensorView"""
50-
f = open("test_trace.osi", "ab")
77+
f = open("sv_312_320_10_movingobject.osi", "ab")
5178
sensorview = SensorView()
5279
5380
sv_ground_truth = sensorview.global_ground_truth
@@ -95,5 +122,5 @@ In the script we initialize the type we want to use for the messages. Here we us
95122
For the ``SensorView`` it is mandatory to define the version and the timestamp. After that we can add objects.
96123
Here we add a moving object with the ID 114. For this object we generate in a for loop 10 OSI messages which all have different x values over a time span of 9 seconds.
97124
This means the object is changing the position in the x direction through the iteration each second.
98-
Each time we change the x value and the timestamp we append the length of the OSI message and the serialized OSI message itself to a file called ``test_trace.osi``.
99-
After finishing the loop we now have a ``test_trace.osi`` file which can be `validated <https://github.com/OpenSimulationInterface/osi-validation>`_ and `visualized <https://github.com/OpenSimulationInterface/osi-visualizer>`_.
125+
Each time we change the x value and the timestamp we append the length of the OSI message and the serialized OSI message itself to a file called ``sv_312_320_10_movingobject.osi``.
126+
After finishing the loop we now have a ``sv_312_320_10_movingobject.osi`` file which can be `validated <https://github.com/OpenSimulationInterface/osi-validation>`_ and `visualized <https://github.com/OpenSimulationInterface/osi-visualizer>`_.

0 commit comments

Comments
 (0)