Skip to content

Commit c287831

Browse files
authored
File naming (#376)
* Added best practice for file naming * Added validation explanation * Added naming to example * Corrected naming in all places * Added definition of the three types
1 parent 179a3b7 commit c287831

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

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)