Skip to content

Commit 97b2f87

Browse files
committed
Merge branch 'master' of https://github.com/OpenSimulationInterface/open-simulation-interface into 455-introducing-emitting-objects
2 parents dff18a9 + a9e6a71 commit 97b2f87

14 files changed

+927
-596
lines changed

.github/pull_request_template.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#### Reference to a related issue in the repository
1+
#### Reference to a related issue in the repository
22
Add a reference to a related issue in the repository.
33

44
#### Add a description
@@ -10,14 +10,13 @@ What does it fix?
1010
Is this a bug fix or a feature? Does it break any existing functionality or force me to update to a new version?
1111
How has it been tested?
1212

13-
#### Mention a member
14-
Add @mentions of the person or team responsible for reviewing proposed changes.
13+
#### Take this checklist as orientation for yourself, if this PR is ready for the Change Control Board:
14+
- [ ] My suggestion follows the [style and contributors guidelines](https://opensimulationinterface.github.io/osi-documentation/open-simulation-interface/doc/howtocontribute.html).
15+
- [ ] I have taken care about the [documentation](https://opensimulationinterface.github.io/osi-documentation/open-simulation-interface/doc/commenting.html).
16+
- [ ] I have done the [DCO signoff](https://opensimulationinterface.github.io/osi-documentation/open-simulation-interface/doc/howtocontribute.html#developer-certification-of-origin-dco).
17+
- [ ] My changes generate no errors when passing CI tests.
18+
- [ ] I have successfully implemented and tested my fix/feature locally.
19+
- [ ] Appropriate reviewer(s) are assigned.
1520

16-
#### Check the checklist
17-
18-
- [ ] My code and comments follow the [style guidelines](https://opensimulationinterface.github.io/osi-documentation/osi/commenting.html) and [contributors guidelines](https://opensimulationinterface.github.io/osi-documentation/osi/howtocontribute.html) of this project.
19-
- [ ] I have performed a self-review of my own code.
20-
- [ ] I have made corresponding changes to the [documentation](https://github.com/OpenSimulationInterface/osi-documentation).
21-
- [ ] My changes generate no new warnings.
22-
- [ ] I have added tests that prove my fix is effective or that my feature works.
23-
- [ ] New and existing unit tests / travis ci pass locally with my changes.
21+
If you can’t check all of them, please explain why.
22+
If all boxes are checked or commented and you have achieved at least one positive review, you can assign the label ReadyForCCBReview!

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ githooks/pre-commit
3535

3636
# PyCharm specific files
3737
.idea
38+
.vscode/settings.json

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.5)
22

33
project(open_simulation_interface)
44

5+
# set default compiler
6+
set(CMAKE_CXX_STANDARD 11)
7+
58
# Set a default build type if none was specified
69
set(default_build_type "Release")
710
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
@@ -71,6 +74,7 @@ set(OSI_PROTO_FILES
7174
osi_roadmarking.proto
7275
osi_lane.proto
7376
osi_featuredata.proto
77+
osi_logicaldetectiondata.proto
7478
osi_object.proto
7579
osi_occupant.proto
7680
osi_sensordata.proto

README.md

Lines changed: 55 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -15,67 +15,74 @@ For more information on OSI see the [official documentation](https://opensimulat
1515
[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
18-
##### Example of writing and reading an OSI message in `Python`
18+
##### Example of generating OSI messages in `Python`
1919
```python
20+
# generate_osi_messages.py
2021
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
2228

2329
def main():
24-
"""Initialize SensorView and SensorData"""
30+
"""Initialize SensorView"""
31+
f = open("sv_330_361_1000_movingobject.osi", "ab")
2532
sensorview = SensorView()
26-
sensordata = SensorData()
27-
28-
"""Clear SensorData"""
29-
sensordata.Clear()
3033

31-
"""Get boundary line attributes from SensorView"""
3234
sv_ground_truth = sensorview.global_ground_truth
33-
sv_lane_boundary = sv_ground_truth.lane_boundary.add()
34-
sv_boundary_line = sv_lane_boundary.boundary_line.add()
35-
sv_boundary_line.position.x = 1699.20
36-
sv_boundary_line.position.y = 100.16
37-
sv_boundary_line.position.z = 0.0
38-
sv_boundary_line.width = 0.13
39-
sv_boundary_line.height = 0.0
40-
41-
"""Set boundary line attributes to SensorData"""
42-
sd_lane_boundary = sensordata.lane_boundary.add()
43-
sd_boundary_line = sd_lane_boundary.boundary_line.add()
44-
sd_boundary_line.position.x = sv_boundary_line.position.x
45-
sd_boundary_line.position.y = sv_boundary_line.position.y
46-
sd_boundary_line.position.z = sv_boundary_line.position.z
47-
sd_boundary_line.width = sv_boundary_line.width
48-
sd_boundary_line.height = sv_boundary_line.height
49-
50-
"""Serialize SensorData which can be send"""
51-
string_buffer = sensordata.SerializeToString()
52-
53-
"""Clear SensorData to show parsing from string"""
54-
sensordata.Clear()
55-
56-
"""The received string buffer can now be parsed"""
57-
sensordata.ParseFromString(string_buffer)
58-
59-
"""Print SensorData"""
60-
print(sensordata)
35+
sv_ground_truth.version.version_major = 3
36+
sv_ground_truth.version.version_minor = 3
37+
sv_ground_truth.version.version_patch = 0
38+
39+
sv_ground_truth.timestamp.seconds = 0
40+
sv_ground_truth.timestamp.nanos = 0
41+
42+
moving_object = sv_ground_truth.moving_object.add()
43+
moving_object.id.value = 42
44+
45+
# Generate 1000 OSI messages for a duration of 10 seconds
46+
for i in range(1000):
47+
48+
# Increment the time
49+
if sv_ground_truth.timestamp.nanos > 1000000000:
50+
sv_ground_truth.timestamp.seconds += 1
51+
sv_ground_truth.timestamp.nanos = 0
52+
sv_ground_truth.timestamp.nanos += NANO_INCREMENT
53+
54+
moving_object.vehicle_classification.type = 2
55+
56+
moving_object.base.dimension.length = MOVING_OBJECT_LENGTH
57+
moving_object.base.dimension.width = MOVING_OBJECT_WIDTH
58+
moving_object.base.dimension.height = MOVING_OBJECT_HEIGHT
59+
60+
moving_object.base.position.x += 0.5
61+
moving_object.base.position.y = 0.0
62+
moving_object.base.position.z = 0.0
63+
64+
moving_object.base.orientation.roll = 0.0
65+
moving_object.base.orientation.pitch = 0.0
66+
moving_object.base.orientation.yaw = 0.0
67+
68+
"""Serialize"""
69+
bytes_buffer = sensorview.SerializeToString()
70+
f.write(struct.pack("<L", len(bytes_buffer)))
71+
f.write(bytes_buffer)
72+
73+
f.close()
6174

6275
if __name__ == "__main__":
6376
main()
6477
```
65-
**Output**:
78+
79+
To run the script execute the following command in the terminal:
6680
```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
7882
```
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+
7986
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).
8087
## Installation
8188
##### Dependencies

doc/osifiles.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ OSI common provides the building blocks for the OSI field messages.
5656
`osi_featuredata.proto`_
5757
---------------------------------
5858

59+
`osi_logicaldetectiondata.proto`_
60+
---------------------------------
61+
5962
`osi_object.proto`_
6063
---------------------------------
6164

osi_common.proto

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,3 +491,30 @@ message StatePoint
491491
//
492492
optional Orientation3d orientation = 3;
493493
}
494+
//
495+
// \brief Detailed WavelengthRange message.
496+
//
497+
// Defines the start (minimum) and the end (maximum) values of the wavelength.
498+
// Additionally, the number of samples within this range is defined in this message.
499+
//
500+
message WavelengthData
501+
{
502+
// The start, or the minimum wavelength value.
503+
//
504+
// Unit: m
505+
//
506+
optional double start = 1;
507+
508+
// The end, or the maximum wavelength value.
509+
//
510+
// Unit: m
511+
//
512+
optional double end = 2;
513+
514+
// Number of samples to be considered within the defined wavelength range.
515+
// The number of samples includes the start and the end values that are defined in this message, starting from the "start" value.
516+
// \note This defines the number of wavelengths to be computed during simulation, not to be confused with samples_per_pixel.
517+
//
518+
optional double samples_number = 3;
519+
}
520+

osi_detectedobject.proto

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ message DetectedMovingObject
159159
//
160160
// \note The bounding box does NOT includes mirrors for vehicles.
161161
// \note The parent frame of \c base is the sensor's vehicle frame.
162+
// \note The height includes the ground_clearance. It always goes from the
163+
// top to the ground.
162164
//
163165
optional BaseMoving base = 2;
164166

@@ -188,6 +190,9 @@ message DetectedMovingObject
188190
//
189191
// Percentage value of the object width in the corresponding lane.
190192
//
193+
// \note DEPRECATED: Use assigned_lane_percentage in MovingObjectClassification
194+
// instead.
195+
//
191196
// \rules
192197
// is_greater_than_or_equal_to: 0
193198
// is_less_than_or_equal_to: 100
@@ -199,6 +204,9 @@ message DetectedMovingObject
199204
//
200205
// Percentage value of the object width in the corresponding lane.
201206
//
207+
// \note DEPRECATED: Use assigned_lane_percentage in MovingObjectClassification
208+
// instead.
209+
//
202210
// \rules
203211
// is_greater_than_or_equal_to: 0
204212
// is_less_than_or_equal_to: 100
@@ -307,6 +315,10 @@ message DetectedMovingObject
307315
// [1] Patton, K. T. & Thibodeau, G. A. (2015). <em>Anatomy & Physiology</em>. 9th Edition. Elsevier. Missouri, U.S.A. ISBN 978-0-323-34139-4. p. 1229.
308316
//
309317
optional Orientation3d upper_body_pose = 5;
318+
319+
// Specific information about the classification of a moving object.
320+
//
321+
optional MovingObject.MovingObjectClassification moving_object_classification = 6;
310322
}
311323

312324
// Definition of available reference points. Left/middle/right and

0 commit comments

Comments
 (0)