Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

11 implement osi validation check against a set of rules #12

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
78ff7b2
Add test generating output trace files
ClemensLinnhoff May 28, 2024
7b3e93c
Workaroung for crashing pipeline during esmini checkout
ClemensLinnhoff May 28, 2024
86d6f41
Enable multiple trace files
ClemensLinnhoff May 28, 2024
4672d3e
Put multiple trace files in zip to add as artifact
ClemensLinnhoff May 28, 2024
8cad6f4
Merge branch 'main' into 11-implement-osi-validation-check-against-a-…
ClemensLinnhoff May 28, 2024
0777ecd
Build osi-validation in pipeline
ClemensLinnhoff May 28, 2024
c3c9e59
Check every filename with default rules
ClemensLinnhoff May 28, 2024
5ef7228
Fix if condition on osi-validation job
ClemensLinnhoff May 28, 2024
ad46fce
Fix osi-validation caching
ClemensLinnhoff May 28, 2024
22ca84c
Add branch of osi-validation
ClemensLinnhoff May 28, 2024
81138ba
Add rules
ClemensLinnhoff May 28, 2024
9f47aae
Fix rules folder in pipeline
ClemensLinnhoff May 28, 2024
e57bea0
Add input rules
ClemensLinnhoff Jun 3, 2024
13c329d
Add optional and required attributes to interface message description…
ClemensLinnhoff Jun 3, 2024
8b44434
Add input trace file checks
ClemensLinnhoff Jun 3, 2024
33b088c
Use osi-validation develop branch
ClemensLinnhoff Jun 3, 2024
b1b06a6
Replace input trace file in integration test 001
ClemensLinnhoff Jun 4, 2024
8ff6090
Remove field checker from pipeline
ClemensLinnhoff Jun 4, 2024
ee4b80d
Add velocity to input trace file
ClemensLinnhoff Jun 4, 2024
acb885a
Add orientation
ClemensLinnhoff Jun 4, 2024
942db7f
Remove checking out osi-validation develop branch.
ClemensLinnhoff Jun 13, 2024
ca5ec5b
Update OSI submodule
ClemensLinnhoff Jun 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/build_osi-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build osi-validation

on:
workflow_call:

jobs:
build_esmini:
name: Build osi-validation
runs-on: ubuntu-latest

steps:
- name: Cache osi-validation
id: cache-osi-validation
uses: actions/cache@v3
with:
path: /tmp/osi-validation
key: ${{ runner.os }}-osi-validation

- name: Get osi-validation
if: steps.cache-osi-validation.outputs.cache-hit != 'true'
working-directory: /tmp
env:
GIT_CLONE_PROTECTION_ACTIVE: false
run: git clone https://github.com/OpenSimulationInterface/osi-validation.git

- name: Update Submodules
if: steps.cache-osi-validation.outputs.cache-hit != 'true'
working-directory: /tmp/osi-validation
run: git submodule update --init

- name: Build osi-validation
if: steps.cache-osi-validation.outputs.cache-hit != 'true'
working-directory: /tmp/osi-validation
run: |
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements_develop.txt
cd open-simulation-interface && python3 -m pip install . && cd ..
python3 -m pip install -r requirements.txt
python3 rules2yml.py -d rules
python3 -m pip install .

- name: Generate default rules
if: steps.cache-osi-validation.outputs.cache-hit != 'true'
working-directory: /tmp/osi-validation
run: |
source .venv/bin/activate
python3 rules2yml.py

- name: Add Commit ID to Cache
if: steps.cache-osi-validation.outputs.cache-hit != 'true'
working-directory: /tmp/osi-validation
run: |
git rev-parse --short HEAD > commit-id.txt
79 changes: 0 additions & 79 deletions .github/workflows/build_osi_field_checker.yml

This file was deleted.

86 changes: 69 additions & 17 deletions .github/workflows/cl2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
name: Build esmini FMU
uses: ./.github/workflows/build_esmini.yml

build_osi_field_checker_fmu:
name: Build OSI Field Checker FMU
uses: ./.github/workflows/build_osi_field_checker.yml
build_osi-validation:
name: Build osi-validation
uses: ./.github/workflows/build_osi-validation.yml

build_openmcx:
name: Build OpenMCx
Expand All @@ -39,7 +39,7 @@ jobs:
matrix: ${{ steps.set-matrix.outputs.matrix }}

run_integration_test:
needs: [build_tracefile_player, build_tracefile_writer, build_openmcx, build_osi_field_checker_fmu, build_esmini, generate_integration_test_paths]
needs: [build_tracefile_player, build_tracefile_writer, build_openmcx, build_esmini, generate_integration_test_paths]
name: Integration Test
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -91,12 +91,12 @@ jobs:
path: /tmp/esmini_fmu
key: ${{ runner.os }}-esmini-fmu

- name: Cache OSI Field Checker
id: cache-osi-field-checker
- name: Cache osi-validation
id: cache-osi-validation
uses: actions/cache@v3
with:
path: /tmp/osi-field-checker
key: ${{ runner.os }}-osi-field-checker
path: /tmp/osi-validation
key: ${{ runner.os }}-osi-validation

- name: Cache OpenMCx
id: cache-openmcx
Expand All @@ -121,6 +121,35 @@ jobs:
- name: Install dependencies
run: sudo apt install -y libxml2-dev zlib1g-dev libzip-dev

- name: Check For Input Trace Files
id: check-for-input-trace-files
working-directory: ./test/integration/${{ matrix.path }}
run: |
( count=`ls -1 *.osi 2>/dev/null | wc -l`
if [ $count == 0 ]; then
echo No trace file found.
echo "found_trace=0" >> $GITHUB_OUTPUT
elif [ $count == 1 ]; then
echo One trace file found.
echo "found_trace=1" >> $GITHUB_OUTPUT
filename=$(ls -1 *.osi)
else
echo More than one trace file.
echo "found_trace=1" >> $GITHUB_OUTPUT
fi
)

- name: Check Input Trace Files with osi-validation and model output rules
if: steps.check-for-input-trace-files.outputs.found_trace == 1
run: |
if [ -d "./rules/input_rules" ]; then
source /tmp/osi-validation/.venv/bin/activate
for filename in ./test/integration/${{ matrix.path }}/*.osi; do
osivalidator --rules ./rules/input_rules --data ${filename}
done
else echo "No custom input rules found in ./rules/input_rules";
fi

- name: Create Output Folder
working-directory: ./test/integration/${{ matrix.path }}
run: mkdir output
Expand All @@ -129,31 +158,54 @@ jobs:
id: cosimulation
run: ./openmcx/install/openmcx ./test/integration/${{ matrix.path }}/SystemStructure.ssd

- name: Check For Trace Files
id: check-for-trace-files
- name: Check For Output Trace Files
id: check-for-output-trace-files
working-directory: ./test/integration/${{ matrix.path }}/output
run: |
( count=`ls -1 *.osi 2>/dev/null | wc -l`
if [ $count == 0 ]; then
echo No trace file found.
echo "found_trace=0" >> $GITHUB_OUTPUT
elif [ $count == 1 ]; then
echo One trace file found.
echo "found_trace=1" >> $GITHUB_OUTPUT
filename=$(ls -1 *.osi)
echo "trace_file_name=${filename}" >> $GITHUB_OUTPUT
else
echo More than one trace file.
echo "found_trace=0" >> $GITHUB_OUTPUT
echo "found_trace=1" >> $GITHUB_OUTPUT
zip ${{ matrix.path }}.zip *.osi
echo "trace_file_name=${{ matrix.path }}.zip" >> $GITHUB_OUTPUT
fi
)

- name: Archive Trace File
if: steps.check-for-trace-files.outputs.found_trace == 1
- name: Archive Output Trace Files
if: steps.check-for-output-trace-files.outputs.found_trace == 1
uses: actions/upload-artifact@v3
with:
name: ${{ steps.check-for-trace-files.outputs.trace_file_name }}
path: ./test/integration/${{ matrix.path }}/output/${{ steps.check-for-trace-files.outputs.trace_file_name }}

name: ${{ steps.check-for-output-trace-files.outputs.trace_file_name }}
path: ./test/integration/${{ matrix.path }}/output/${{ steps.check-for-output-trace-files.outputs.trace_file_name }}

- name: Check Output Trace Files with osi-validation and default rules
if: steps.check-for-output-trace-files.outputs.found_trace == 1
working-directory: ./test/integration/${{ matrix.path }}/output
run: |
source /tmp/osi-validation/.venv/bin/activate
for filename in ./*.osi; do
osivalidator --rules /tmp/osi-validation/rules/ --data ${filename}
done

- name: Check Output Trace Files with osi-validation and model output rules
if: steps.check-for-output-trace-files.outputs.found_trace == 1
run: |
if [ -d "./rules/output_rules" ]; then
source /tmp/osi-validation/.venv/bin/activate
for filename in ./test/integration/${{ matrix.path }}/output/*.osi; do
osivalidator --rules ./rules/output_rules --data ${filename}
done
else echo "No custom output rules found in ./rules/output_rules";
fi

- name: Check For Python Scripts
id: check-for-python-scripts
working-directory: ./test/integration/${{ matrix.path }}
Expand Down Expand Up @@ -186,7 +238,7 @@ jobs:
- name: Run Trace File Analysis
if: steps.check-for-python-scripts.outputs.found_script == 1
working-directory: ./test/integration/${{ matrix.path }}
run: python3 ${{ steps.check-for-python-scripts.outputs.python_file_name }} output/${{ steps.check-for-trace-files.outputs.trace_file_name }}
run: python3 ${{ steps.check-for-python-scripts.outputs.python_file_name }} output/${{ steps.check-for-output-trace-files.outputs.trace_file_name }}

- name: Failed?
if: steps.cosimulation.outputs.failed == 1
Expand Down
38 changes: 21 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,33 @@ Each parameter should have a short description as shown in the following example
## Interface

What interfaces are used as model input and model output?
All required field of the interface shall be named in a list as shown in the following example.
All required and optional messages of the interface shall be named in a list as shown in the following example.

### Input: Required Fields in osi3::SensorView and/or osi3::TrafficCommand

* `sensor_view.global_ground_truth.timestamp`
* `sensor_view.global_ground_truth.host_vehicle_id`
* `sensor_view.global_ground_truth.moving_object.id`
* `sensor_view.global_ground_truth.moving_object.base.position`
* `sensor_view.global_ground_truth.moving_object.base.orientation`
* `sensor_view.global_ground_truth.moving_object.base.velocity`
* `traffic_command.traffic_participant_id`
* `traffic_command.action`
| OSI Message | Required / Optional |
|------------------------------------------------------------------|---------------------|
| `sensor_view.global_ground_truth.timestamp` | required |
| `sensor_view.global_ground_truth.host_vehicle_id` | required |
| `sensor_view.global_ground_truth.moving_object.id` | required |
| `sensor_view.global_ground_truth.moving_object.base.position` | required |
| `sensor_view.global_ground_truth.moving_object.base.orientation` | required |
| `sensor_view.global_ground_truth.moving_object.base.velocity` | required |
| `traffic_command.traffic_participant_id` | required |
| `traffic_command.action` | optional |

### Output: Fields in osi3::TrafficUpdate and/or osi3::TrafficCommandUpdate filled by the Model

* `traffic_update.version`
* `traffic_update.timestamp`
* `traffic_update.update.base.position`
* `traffic_update.update.base.orientation`
* `traffic_update.update.base.velocity`
* `traffic_command_update.version`
* `traffic_command_update.timestamp`
* `traffic_command_update.dismissed_action`
| OSI Message | Required / Optional |
|-------------------------------------------|---------------------|
| `traffic_update.version` | required |
| `traffic_update.timestamp` | required |
| `traffic_update.update.base.position` | required |
| `traffic_update.update.base.orientation` | required |
| `traffic_update.update.base.velocity` | required |
| `traffic_command_update.version` | required |
| `traffic_command_update.timestamp` | required |
| `traffic_command_update.dismissed_action` | optional |

## Build Instructions

Expand Down
2 changes: 1 addition & 1 deletion lib/open-simulation-interface
Submodule open-simulation-interface updated 69 files
+24 −0 .github/.pyspelling.yml
+390 −0 .github/spelling_custom_words_en_US.txt
+1 −1 .github/workflows/antora-generator.yml
+128 −36 .github/workflows/protobuf.yml
+9 −9 .github/workflows/release.yml
+2 −2 .gitignore
+2 −1 CMakeLists.txt
+1 −0 MANIFEST.in
+1 −1 VERSION
+4 −2 doc/architecture/architecture_overview.adoc
+0 −9 doc/architecture/feature_data.adoc
+29 −0 doc/architecture/formatting_script.adoc
+0 −56 doc/architecture/formatting_scripts.adoc
+1 −0 doc/architecture/reference_points_coordinate_systems.adoc
+4 −0 doc/architecture/sensor_data.adoc
+6 −5 doc/architecture/trace_file_formats.adoc
+19 −5 doc/architecture/trace_file_naming.adoc
+ doc/images/OSI_Planned_Route.png
+ doc/images/OSI_Route_Segment.png
+ doc/images/osi-streaming-principle.png
+1 −3 doc/open-simulation-interface_user_guide.adoc
+26 −12 doc/setup/installing_linux_python.adoc
+2 −2 doc/setup/installing_prerequisites.adoc
+30 −2 doc/setup/installing_windows_python.adoc
+0 −244 format/OSITrace.py
+0 −63 format/osi2read.py
+0 −75 format/txt2osi.py
+66 −0 osi3trace/osi2read.py
+188 −0 osi3trace/osi_trace.py
+165 −9 osi_common.proto
+18 −2 osi_detectedobject.proto
+2 −2 osi_environment.proto
+30 −12 osi_featuredata.proto
+60 −2 osi_groundtruth.proto
+8 −3 osi_hostvehicledata.proto
+6 −5 osi_lane.proto
+5 −1 osi_logicaldetectiondata.proto
+140 −6 osi_logicallane.proto
+8 −0 osi_motionrequest.proto
+70 −15 osi_object.proto
+7 −6 osi_referenceline.proto
+5 −1 osi_roadmarking.proto
+138 −0 osi_route.proto
+50 −0 osi_sensordata.proto
+16 −3 osi_sensorview.proto
+15 −2 osi_sensorviewconfiguration.proto
+9 −1 osi_streamingupdate.proto
+30 −14 osi_trafficcommand.proto
+12 −0 osi_trafficcommandupdate.proto
+2 −1 osi_trafficlight.proto
+12 −11 osi_trafficsign.proto
+9 −1 osi_trafficupdate.proto
+35 −0 pyproject.toml
+2 −0 requirements_tests.txt
+2 −1 rules.yml
+111 −78 setup.py
+107 −44 tests/test_comment_type.py
+26 −9 tests/test_doxygen_output.py
+18 −5 tests/test_invalid_comment.py
+76 −27 tests/test_invalid_enum.py
+87 −47 tests/test_invalid_html.py
+168 −59 tests/test_invalid_message.py
+8 −3 tests/test_invalid_punctuation.py
+7 −2 tests/test_invalid_tabs.py
+8 −3 tests/test_newline.py
+23 −4 tests/test_non_ascii.py
+535 −10 tests/test_osi_trace.py
+77 −22 tests/test_rules.py
+39 −10 tests/test_units.py
Loading
Loading