Skip to content

Commit e031502

Browse files
committed
Links in README and example moved to docu
Signed-off-by: Philipp Rosenberger <philipp.rosenberger@partner.bmw.de>
1 parent 9b037cd commit e031502

File tree

4 files changed

+88
-71
lines changed

4 files changed

+88
-71
lines changed

README.md

Lines changed: 7 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -7,82 +7,18 @@ The Open Simulation Interface <sup>[[1]](https://www.hot.ei.tum.de/forschung/aut
77

88
As the complexity of automated driving functions rapidly increases, the requirements for test and development methods are growing. Testing in virtual environments offers the advantage of completely controlled and reproducible environment conditions.
99

10-
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.
11-
12-
<!-- TODO: Update with new Antora hosting -->
10+
For more information on OSI see the [official documentation]https://opensimulationinterface.github.io/osi-antora-generator/asamosi/latest/specification/index.html) or the [class list](https://opensimulationinterface.github.io/osi-antora-generator/asamosi/latest/gen/annotated.html) for defined protobuf messages.
1311

1412
[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/
1513

1614
## Usage
17-
##### Example of generating OSI messages in `Python`
18-
```python
19-
# generate_osi_messages.py
20-
from osi3.osi_sensorview_pb2 import SensorView
21-
import struct
22-
23-
NANO_INCREMENT = 10000000
24-
MOVING_OBJECT_LENGTH = 5
25-
MOVING_OBJECT_WIDTH = 2
26-
MOVING_OBJECT_HEIGHT = 1
27-
28-
def main():
29-
"""Initialize SensorView"""
30-
f = open("sv_330_361_1000_movingobject.osi", "ab")
31-
sensorview = SensorView()
32-
33-
sv_ground_truth = sensorview.global_ground_truth
34-
sv_ground_truth.version.version_major = 3
35-
sv_ground_truth.version.version_minor = 5
36-
sv_ground_truth.version.version_patch = 0
37-
38-
sv_ground_truth.timestamp.seconds = 0
39-
sv_ground_truth.timestamp.nanos = 0
40-
41-
moving_object = sv_ground_truth.moving_object.add()
42-
moving_object.id.value = 42
43-
44-
# Generate 1000 OSI messages for a duration of 10 seconds
45-
for i in range(1000):
46-
47-
# Increment the time
48-
if sv_ground_truth.timestamp.nanos > 1000000000:
49-
sv_ground_truth.timestamp.seconds += 1
50-
sv_ground_truth.timestamp.nanos = 0
51-
sv_ground_truth.timestamp.nanos += NANO_INCREMENT
52-
53-
moving_object.vehicle_classification.type = 2
54-
55-
moving_object.base.dimension.length = MOVING_OBJECT_LENGTH
56-
moving_object.base.dimension.width = MOVING_OBJECT_WIDTH
57-
moving_object.base.dimension.height = MOVING_OBJECT_HEIGHT
58-
59-
moving_object.base.position.x += 0.5
60-
moving_object.base.position.y = 0.0
61-
moving_object.base.position.z = 0.0
62-
63-
moving_object.base.orientation.roll = 0.0
64-
moving_object.base.orientation.pitch = 0.0
65-
moving_object.base.orientation.yaw = 0.0
66-
67-
"""Serialize"""
68-
bytes_buffer = sensorview.SerializeToString()
69-
f.write(struct.pack("<L", len(bytes_buffer)))
70-
f.write(bytes_buffer)
71-
72-
f.close()
73-
74-
if __name__ == "__main__":
75-
main()
76-
```
77-
78-
To run the script execute the following command in the terminal:
79-
```bash
80-
python3 generate_osi_messages.py
81-
```
82-
83-
This will output an osi file (`sv_330_361_1000_movingobject.osi`) which can be visualized and played back by the [osi-visualizer](https://github.com/OpenSimulationInterface/osi-visualizer).
15+
For usage examples, please refer to the official documentation:
16+
- [Trace file generation with python](https://opensimulationinterface.github.io/osi-antora-generator/asamosi/latest/interface/architecture/trace_file_example.html)
17+
- [OSMP examples](https://opensimulationinterface.github.io/osi-antora-generator/asamosi/latest/sensor-model/setup/build_install_example.html), including the code found at [osi-sensor-model-packaging](https://github.com/OpenSimulationInterface/osi-sensor-model-packaging):
18+
- [OSMPDummySource](https://github.com/OpenSimulationInterface/osi-sensor-model-packaging/tree/master/examples/OSMPDummySource)
19+
- [OSMPDummySensor](https://github.com/OpenSimulationInterface/osi-sensor-model-packaging/tree/master/examples/OSMPDummySensor)
20+
- [OSMPCNetworkProxy](https://github.com/OpenSimulationInterface/osi-sensor-model-packaging/tree/master/examples/OSMPCNetworkProxy)
8421

85-
See Google's documentation for more tutorials on how to use protocol buffers with [Python](https://developers.google.com/protocol-buffers/docs/pythontutorial) or [C++](https://developers.google.com/protocol-buffers/docs/cpptutorial).
8622
## Installation
8723
##### Dependencies
8824
Install `cmake` 3.10.2:

doc/_config.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ ifndef::include-only-once[]
4444
// :images_osi_sensor_model_packaging: ./osi-sensor-model-packaging/doc/images // example
4545
:imagesoutdir: ./images/generated_images
4646

47+
:source-highlighter: pygments
48+
:pygments-style: manni
49+
:pygments-linenums-mode: inline
50+
4751
endif::[]
4852

4953
ifndef::use-antora-rules[]
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
ifndef::include-only-once[]
2+
:root-path: ../
3+
include::{root-path}_config.adoc[]
4+
endif::[]
5+
[#top-osi_trace_file_example]
6+
= OSI trace file example
7+
[source,ruby]
8+
----
9+
# generate_osi_messages.py
10+
from osi3.osi_sensorview_pb2 import SensorView
11+
import struct
12+
13+
NANO_INCREMENT = 10000000
14+
MOVING_OBJECT_LENGTH = 5
15+
MOVING_OBJECT_WIDTH = 2
16+
MOVING_OBJECT_HEIGHT = 1
17+
18+
def main():
19+
"""Initialize SensorView"""
20+
f = open("sv_330_361_1000_movingobject.osi", "ab")
21+
sensorview = SensorView()
22+
23+
sv_ground_truth = sensorview.global_ground_truth
24+
sv_ground_truth.version.version_major = 3
25+
sv_ground_truth.version.version_minor = 5
26+
sv_ground_truth.version.version_patch = 0
27+
28+
sv_ground_truth.timestamp.seconds = 0
29+
sv_ground_truth.timestamp.nanos = 0
30+
31+
moving_object = sv_ground_truth.moving_object.add()
32+
moving_object.id.value = 42
33+
34+
# Generate 1000 OSI messages for a duration of 10 seconds
35+
for i in range(1000):
36+
37+
# Increment the time
38+
if sv_ground_truth.timestamp.nanos > 1000000000:
39+
sv_ground_truth.timestamp.seconds += 1
40+
sv_ground_truth.timestamp.nanos = 0
41+
sv_ground_truth.timestamp.nanos += NANO_INCREMENT
42+
43+
moving_object.vehicle_classification.type = 2
44+
45+
moving_object.base.dimension.length = MOVING_OBJECT_LENGTH
46+
moving_object.base.dimension.width = MOVING_OBJECT_WIDTH
47+
moving_object.base.dimension.height = MOVING_OBJECT_HEIGHT
48+
49+
moving_object.base.position.x += 0.5
50+
moving_object.base.position.y = 0.0
51+
moving_object.base.position.z = 0.0
52+
53+
moving_object.base.orientation.roll = 0.0
54+
moving_object.base.orientation.pitch = 0.0
55+
moving_object.base.orientation.yaw = 0.0
56+
57+
"""Serialize"""
58+
bytes_buffer = sensorview.SerializeToString()
59+
f.write(struct.pack("<L", len(bytes_buffer)))
60+
f.write(bytes_buffer)
61+
62+
f.close()
63+
64+
if __name__ == "__main__":
65+
main()
66+
----
67+
68+
To run the script execute the following command in the terminal:
69+
----
70+
python3 generate_osi_messages.py
71+
----
72+
73+
This will output an osi file (`sv_330_361_1000_movingobject.osi`) which can be visualized and played back by the [osi-visualizer](https://github.com/OpenSimulationInterface/osi-visualizer).
74+
75+
See Google's documentation for more tutorials on how to use protocol buffers with [Python](https://developers.google.com/protocol-buffers/docs/pythontutorial) or [C++](https://developers.google.com/protocol-buffers/docs/cpptutorial).

doc/open-simulation-interface_user_guide.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ include::./architecture/trace_file_naming.adoc[leveloffset=+3]
6565

6666
// include::./architecture/test_scripts.adoc[leveloffset=+3]
6767

68+
include::./architecture/trace_file_example.adoc[leveloffset=+3]
69+
6870
include::./architecture/formatting_scripts.adoc[leveloffset=+3]
6971

7072
== Setting up OSI

0 commit comments

Comments
 (0)