You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+55-48Lines changed: 55 additions & 48 deletions
Original file line number
Diff line number
Diff line change
@@ -15,67 +15,74 @@ For more information on OSI see the [official documentation](https://opensimulat
15
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/
16
16
17
17
## Usage
18
-
##### Example of writing and reading an OSI message in `Python`
18
+
##### Example of generating OSI messages in `Python`
19
19
```python
20
+
# generate_osi_messages.py
20
21
from osi3.osi_sensorview_pb2 import SensorView
21
-
from osi3.osi_sensordata_pb2 import SensorData
22
+
import struct
23
+
24
+
NANO_INCREMENT=10000000
25
+
MOVING_OBJECT_LENGTH=5
26
+
MOVING_OBJECT_WIDTH=2
27
+
MOVING_OBJECT_HEIGHT=1
22
28
23
29
defmain():
24
-
"""Initialize SensorView and SensorData"""
30
+
"""Initialize SensorView"""
31
+
f =open("sv_330_361_1000_movingobject.osi", "ab")
25
32
sensorview = SensorView()
26
-
sensordata = SensorData()
27
-
28
-
"""Clear SensorData"""
29
-
sensordata.Clear()
30
33
31
-
"""Get boundary line attributes from SensorView"""
To run the script execute the following command in the terminal:
66
80
```bash
67
-
lane_boundary {
68
-
boundary_line {
69
-
position {
70
-
x: 1699.2
71
-
y: 100.16
72
-
z: 0.0
73
-
}
74
-
width: 0.13
75
-
height: 0.0
76
-
}
77
-
}
81
+
python3 generate_osi_messages.py
78
82
```
83
+
84
+
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).
85
+
79
86
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).
0 commit comments