From 6d1c557498db93ac95d41f80ea6f070cf040fd91 Mon Sep 17 00:00:00 2001 From: Philipp Rosenberger Date: Tue, 14 Mar 2023 11:10:36 +0100 Subject: [PATCH 1/2] Links in README and example moved to docu Signed-off-by: Philipp Rosenberger --- README.md | 78 ++----------------- doc/_config.adoc | 1 + doc/architecture/trace_file_example.adoc | 75 ++++++++++++++++++ doc/open-simulation-interface_user_guide.adoc | 2 + 4 files changed, 85 insertions(+), 71 deletions(-) create mode 100644 doc/architecture/trace_file_example.adoc diff --git a/README.md b/README.md index 3cf3b7b48..d75e337ba 100644 --- a/README.md +++ b/README.md @@ -7,82 +7,18 @@ The Open Simulation Interface [[1]](https://www.hot.ei.tum.de/forschung/aut 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. -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. - - +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. [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/ ## Usage -##### Example of generating OSI messages in `Python` -```python -# generate_osi_messages.py -from osi3.osi_sensorview_pb2 import SensorView -import struct - -NANO_INCREMENT = 10000000 -MOVING_OBJECT_LENGTH = 5 -MOVING_OBJECT_WIDTH = 2 -MOVING_OBJECT_HEIGHT = 1 - -def main(): - """Initialize SensorView""" - f = open("sv_330_361_1000_movingobject.osi", "ab") - sensorview = SensorView() - - sv_ground_truth = sensorview.global_ground_truth - sv_ground_truth.version.version_major = 3 - sv_ground_truth.version.version_minor = 5 - sv_ground_truth.version.version_patch = 0 - - sv_ground_truth.timestamp.seconds = 0 - sv_ground_truth.timestamp.nanos = 0 - - moving_object = sv_ground_truth.moving_object.add() - moving_object.id.value = 42 - - # Generate 1000 OSI messages for a duration of 10 seconds - for i in range(1000): - - # Increment the time - if sv_ground_truth.timestamp.nanos > 1000000000: - sv_ground_truth.timestamp.seconds += 1 - sv_ground_truth.timestamp.nanos = 0 - sv_ground_truth.timestamp.nanos += NANO_INCREMENT - - moving_object.vehicle_classification.type = 2 - - moving_object.base.dimension.length = MOVING_OBJECT_LENGTH - moving_object.base.dimension.width = MOVING_OBJECT_WIDTH - moving_object.base.dimension.height = MOVING_OBJECT_HEIGHT - - moving_object.base.position.x += 0.5 - moving_object.base.position.y = 0.0 - moving_object.base.position.z = 0.0 - - moving_object.base.orientation.roll = 0.0 - moving_object.base.orientation.pitch = 0.0 - moving_object.base.orientation.yaw = 0.0 - - """Serialize""" - bytes_buffer = sensorview.SerializeToString() - f.write(struct.pack(" 1000000000: + sv_ground_truth.timestamp.seconds += 1 + sv_ground_truth.timestamp.nanos = 0 + sv_ground_truth.timestamp.nanos += NANO_INCREMENT + + moving_object.vehicle_classification.type = 2 + + moving_object.base.dimension.length = MOVING_OBJECT_LENGTH + moving_object.base.dimension.width = MOVING_OBJECT_WIDTH + moving_object.base.dimension.height = MOVING_OBJECT_HEIGHT + + moving_object.base.position.x += 0.5 + moving_object.base.position.y = 0.0 + moving_object.base.position.z = 0.0 + + moving_object.base.orientation.roll = 0.0 + moving_object.base.orientation.pitch = 0.0 + moving_object.base.orientation.yaw = 0.0 + + """Serialize""" + bytes_buffer = sensorview.SerializeToString() + f.write(struct.pack(" Date: Tue, 14 Mar 2023 12:23:27 +0100 Subject: [PATCH 2/2] Correct source highlighting, md links to adoc links Signed-off-by: Philip Windecker --- README.md | 2 +- doc/architecture/trace_file_example.adoc | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d75e337ba..26464592e 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ The Open Simulation Interface [[1]](https://www.hot.ei.tum.de/forschung/aut 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. -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. +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. [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/ diff --git a/doc/architecture/trace_file_example.adoc b/doc/architecture/trace_file_example.adoc index 8142e90bd..9de8dd43b 100644 --- a/doc/architecture/trace_file_example.adoc +++ b/doc/architecture/trace_file_example.adoc @@ -4,7 +4,8 @@ include::{root-path}_config.adoc[] endif::[] [#top-osi_trace_file_example] = OSI trace file example -[source,ruby] + +[source, python] ---- # generate_osi_messages.py from osi3.osi_sensorview_pb2 import SensorView @@ -66,10 +67,12 @@ if __name__ == "__main__": ---- To run the script execute the following command in the terminal: + +[source, bash] ---- python3 generate_osi_messages.py ---- -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). +This will output an osi file (`sv_330_361_1000_movingobject.osi`) which can be visualized and played back by the https://github.com/OpenSimulationInterface/osi-visualizer[osi-visualizer^]. -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). \ No newline at end of file +See Google's documentation for more tutorials on how to use protocol buffers with https://developers.google.com/protocol-buffers/docs/pythontutorial[Python^] or https://developers.google.com/protocol-buffers/docs/cpptutorial[C++^]. \ No newline at end of file