From dc28e3375af892c5803bd56a77afaf2d3f3d7e38 Mon Sep 17 00:00:00 2001 From: Lola Marrero Date: Fri, 11 Jul 2025 13:47:31 -0700 Subject: [PATCH 1/3] Add carla 0.10.0 support --- .github/workflows/run-simulators.yml | 11 +- .github/workflows/weekly-ci-tests.yml | 47 - assets/maps/CARLA/Town10HD_Opt.xodr | 17962 ++++++++++++++++ docs/simulators.rst | 28 +- .../Carla_Challenge/carlaChallenge1.scenic | 6 +- .../Carla_Challenge/carlaChallenge10.scenic | 9 +- .../Carla_Challenge/carlaChallenge2.scenic | 10 +- .../carlaChallenge3_dynamic.scenic | 21 +- .../carlaChallenge3_static.scenic | 6 +- .../Carla_Challenge/carlaChallenge4.scenic | 6 +- .../Carla_Challenge/carlaChallenge5.scenic | 8 +- .../Carla_Challenge/carlaChallenge6.scenic | 8 +- .../Carla_Challenge/carlaChallenge7.scenic | 12 +- .../Carla_Challenge/carlaChallenge8.scenic | 9 +- .../Carla_Challenge/carlaChallenge9.scenic | 4 +- .../bypassing/bypassing_01.scenic | 12 +- .../bypassing/bypassing_02.scenic | 16 +- .../bypassing/bypassing_03.scenic | 14 +- .../bypassing/bypassing_04.scenic | 14 +- .../bypassing/bypassing_05.scenic | 8 +- .../intersection/intersection_01.scenic | 20 +- .../intersection/intersection_02.scenic | 16 +- .../intersection/intersection_03.scenic | 20 +- .../intersection/intersection_04.scenic | 16 +- .../intersection/intersection_05.scenic | 16 +- .../intersection/intersection_06.scenic | 18 +- .../intersection/intersection_07.scenic | 14 +- .../intersection/intersection_08.scenic | 10 +- .../intersection/intersection_09.scenic | 8 +- .../intersection/intersection_10.scenic | 18 +- .../pedestrian/pedestrian_01.scenic | 25 +- .../pedestrian/pedestrian_02.scenic | 19 +- .../pedestrian/pedestrian_03.scenic | 8 +- .../pedestrian/pedestrian_04.scenic | 8 +- .../pedestrian/pedestrian_05.scenic | 8 +- .../OAS_Scenarios/oas_scenario_05.scenic | 10 +- .../OAS_Scenarios/oas_scenario_06.scenic | 12 +- examples/carla/adjacentLanes.scenic | 4 +- examples/carla/adjacentOpposingPair.scenic | 4 +- examples/carla/backgroundActivity.scenic | 8 +- examples/carla/car.scenic | 2 +- examples/carla/check_across_runs.py | 56 + .../manual_control/carlaChallenge1.scenic | 6 +- .../carlaChallenge3_dynamic.scenic | 8 +- .../manual_control/carlaChallenge4.scenic | 6 +- .../manual_control/carlaChallenge7.scenic | 6 +- examples/carla/pedestrian.scenic | 6 +- examples/carla/test.scenic | 90 + examples/carla/test2.scenic | 15 + examples/carla/test3.scenic | 15 + examples/carla/test_ped_script.py | 48 + examples/carla/test_script.py | 50 + examples/carla/trafficLights.scenic | 6 +- src/scenic/core/regions.py | 4 - src/scenic/simulators/carla/blueprints.py | 382 +- src/scenic/simulators/carla/model.scenic | 68 +- src/scenic/simulators/carla/simulator.py | 68 +- src/scenic/simulators/carla/utils/visuals.py | 2 + tests/core/test_regions.py | 27 - tests/simulators/carla/test_actions.py | 41 +- tests/simulators/carla/test_blueprints.py | 8 +- 61 files changed, 18915 insertions(+), 472 deletions(-) delete mode 100644 .github/workflows/weekly-ci-tests.yml create mode 100644 assets/maps/CARLA/Town10HD_Opt.xodr create mode 100644 examples/carla/check_across_runs.py create mode 100644 examples/carla/test.scenic create mode 100644 examples/carla/test2.scenic create mode 100644 examples/carla/test3.scenic create mode 100644 examples/carla/test_ped_script.py create mode 100644 examples/carla/test_script.py diff --git a/.github/workflows/run-simulators.yml b/.github/workflows/run-simulators.yml index 89e0819fd..4d201611c 100644 --- a/.github/workflows/run-simulators.yml +++ b/.github/workflows/run-simulators.yml @@ -144,10 +144,19 @@ jobs: ssh -o StrictHostKeyChecking=no -o ServerAliveInterval=60 -o ServerAliveCountMax=3 -i private_key ${USER_NAME}@${HOSTNAME} ' cd /home/ubuntu/actions/Scenic && source venv/bin/activate && - carla_versions=($(find /software -maxdepth 1 -type d -name 'carla*')) && + # run carla0.9.15 first + carla_versions=($(find /software -maxdepth 1 -type d -name 'carla*' | sort -V)) && for version in "${carla_versions[@]}"; do echo "============================= CARLA $version =============================" export CARLA_ROOT="$version" + + # install local wheel for carla0.10.0 + if [[ "$version" == "/software/carla0.10.0" ]]; then + WHL=$(ls "$version"/PythonAPI/carla/dist/carla-0.10.0-cp310-cp310-linux_x86_64.whl) + echo "Installing local wheel: $WHL" + python3 -m pip install --force-reinstall "$WHL" + fi + pytest tests/simulators/carla done ' diff --git a/.github/workflows/weekly-ci-tests.yml b/.github/workflows/weekly-ci-tests.yml deleted file mode 100644 index da15e1f93..000000000 --- a/.github/workflows/weekly-ci-tests.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Weekly CI tests - -# No permissions needed -permissions: {} - -# Trigger every Thursday at 9:15 AM Pacific Time (16:15 UTC) -on: - schedule: - - cron: '15 16 * * 4' - -jobs: - run-tests: - uses: ./.github/workflows/run-tests.yml - with: - # Use the default branch" (i.e. main) - ref: '' - - notify: - name: Notify Slack - needs: run-tests - runs-on: ubuntu-latest - if: always() - steps: - - name: Post result to Slack - uses: slackapi/slack-github-action@b0fa283ad8fea605de13dc3f449259339835fc52 - with: - webhook: ${{ secrets.SLACK_WEBHOOK_URL}} - webhook-type: incoming-webhook - payload: | - { - "blocks": [ - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*Weekly CI tests* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|run #${{ github.run_number }}> finished." - } - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "${{ needs.run-tests.result == 'success' && '✅ All tests passed!' || '🚨 Some tests failed!' }}" - } - } - ] - } diff --git a/assets/maps/CARLA/Town10HD_Opt.xodr b/assets/maps/CARLA/Town10HD_Opt.xodr new file mode 100644 index 000000000..1c776433d --- /dev/null +++ b/assets/maps/CARLA/Town10HD_Opt.xodr @@ -0,0 +1,17962 @@ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + +
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+
+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/simulators.rst b/docs/simulators.rst index 2b1e22df0..bd2a48d1d 100644 --- a/docs/simulators.rst +++ b/docs/simulators.rst @@ -57,14 +57,23 @@ Our interface to the `CARLA `_ simulator enables using Sceni The interface supports dynamic scenarios written using the CARLA world model (:obj:`scenic.simulators.carla.model`) as well as scenarios using the cross-platform :ref:`driving_domain`. To use the interface, please follow these instructions: -1. Install the latest version of CARLA (we've tested versions 0.9.9 through 0.9.14) from the `CARLA Release Page `_. - Note that CARLA currently only supports Linux and Windows. +1. Install the latest version of CARLA (we've tested versions 0.9.9 through 0.10.0) from the `CARLA Release Page `_. + Note that CARLA currently only supports Linux and Windows. If you plan to use **0.10.0**, double-check its higher system requirements in the `CARLA UE5 quick-start guide `_. 2. Install Scenic in your Python virtual environment as instructed in :ref:`quickstart`. 3. Within the same virtual environment, install CARLA's Python API. How to do this depends on the CARLA version and whether you built it from source: .. tabs:: + .. tab:: 0.10.0 + + If you're using **CARLA 0.10.0** (not yet on PyPI), install the client wheel that ships with the simulator: + + .. code-block:: text + + cd CARLA_ROOT/PythonAPI/dist/ + python3 -m pip install carla-*.*.*-cp3*-linux_x86_64.whl + .. tab:: 0.9.12+ Run the following command, replacing ``X.Y.Z`` with the version of CARLA you installed: @@ -99,9 +108,22 @@ To use the interface, please follow these instructions: You can check that the ``carla`` package was correctly installed by running :command:`python -c 'import carla'`: if it prints ``No module named 'carla'``, the installation didn't work. We suggest upgrading to a newer version of CARLA so that you can use :command:`pip` to install the Python API. -To start CARLA, run the command :command:`./CarlaUE4.sh` in your CARLA folder. +To start CARLA, run the command :command:`./CarlaUE4.sh` in your CARLA folder (for **CARLA 0.10.0**, use :command:`./CarlaUnreal.sh` instead). Once CARLA is running, you can run dynamic Scenic scenarios following the instructions in :ref:`the dynamics tutorial `. +.. note:: + + All scenarios in ``examples/carla`` run unmodified on both CARLA 0.9.x and 0.10.0 + (except **carlaChallenge4**, which uses a bicycle blueprint removed in 0.10.0). + Only the upgraded **Town10HD_Opt** map is supported in 0.10.0. + + If you write new scenarios against CARLA 0.10.0, remember the blueprint library + has changed. It’s a good idea to inspect which blueprints are available before + selecting your IDs:: + + client.get_world().get_blueprint_library() + + Grand Theft Auto V ------------------ diff --git a/examples/carla/Carla_Challenge/carlaChallenge1.scenic b/examples/carla/Carla_Challenge/carlaChallenge1.scenic index aba7b40ef..af3830a0b 100644 --- a/examples/carla/Carla_Challenge/carlaChallenge1.scenic +++ b/examples/carla/Carla_Challenge/carlaChallenge1.scenic @@ -9,12 +9,12 @@ To run this file using the Carla simulator: """ ## SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc) -param map = localPath('../../../assets/maps/CARLA/Town01.xodr') -param carla_map = 'Town01' +param map = localPath('../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ## CONSTANTS -EGO_MODEL = "vehicle.lincoln.mkz_2017" +EGO_MODEL = "vehicle.nissan.patrol" EGO_SPEED = 10 ## DEFINING BEHAVIORS diff --git a/examples/carla/Carla_Challenge/carlaChallenge10.scenic b/examples/carla/Carla_Challenge/carlaChallenge10.scenic index 30e4b3b33..42891e8f1 100644 --- a/examples/carla/Carla_Challenge/carlaChallenge10.scenic +++ b/examples/carla/Carla_Challenge/carlaChallenge10.scenic @@ -9,12 +9,12 @@ To run this file using the Carla simulator: """ ## SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc) -param map = localPath('../../../assets/maps/CARLA/Town05.xodr') -param carla_map = 'Town05' +param map = localPath('../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ## CONSTANTS -EGO_MODEL = "vehicle.lincoln.mkz_2017" +EGO_MODEL = "vehicle.nissan.patrol" EGO_SPEED = 10 SAFETY_DISTANCE = 20 BRAKE_INTENSITY = 1.0 @@ -36,6 +36,9 @@ behavior EgoBehavior(speed, trajectory): fourWayIntersection = filter(lambda i: i.is4Way and not i.isSignalized, network.intersections) +if not fourWayIntersection: + raise RuntimeError("This map doesn't have any four-way unsignalized intersections.") + # make sure to put '*' to uniformly randomly select from all elements of the list intersec = Uniform(*fourWayIntersection) ego_start_lane = Uniform(*intersec.incomingLanes) diff --git a/examples/carla/Carla_Challenge/carlaChallenge2.scenic b/examples/carla/Carla_Challenge/carlaChallenge2.scenic index 4c423f2b1..903291853 100644 --- a/examples/carla/Carla_Challenge/carlaChallenge2.scenic +++ b/examples/carla/Carla_Challenge/carlaChallenge2.scenic @@ -9,12 +9,12 @@ To run this file using the Carla simulator: """ ## SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc) -param map = localPath('../../../assets/maps/CARLA/Town01.xodr') -param carla_map = 'Town01' +param map = localPath('../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ## CONSTANTS -EGO_MODEL = "vehicle.lincoln.mkz_2017" +EGO_MODEL = "vehicle.nissan.patrol" EGO_SPEED = 10 EGO_BRAKING_THRESHOLD = 12 @@ -34,7 +34,7 @@ behavior EgoBehavior(speed=10): # LEAD CAR BEHAVIOR: Follow lane, and brake after passing a threshold distance to obstacle behavior LeadingCarBehavior(speed=10): - try: + try: do FollowLaneBehavior(speed) interrupt when withinDistanceToAnyObjs(self, LEADCAR_BRAKING_THRESHOLD): @@ -56,5 +56,5 @@ ego = new Car following roadDirection from leadCar for Range(-15, -10), with blueprint EGO_MODEL, with behavior EgoBehavior(EGO_SPEED) -require (distance to intersection) > 80 +require (distance to intersection) > 50 terminate when ego.speed < 0.1 and (distance to obstacle) < 30 diff --git a/examples/carla/Carla_Challenge/carlaChallenge3_dynamic.scenic b/examples/carla/Carla_Challenge/carlaChallenge3_dynamic.scenic index 9fb37b60c..032a20b90 100644 --- a/examples/carla/Carla_Challenge/carlaChallenge3_dynamic.scenic +++ b/examples/carla/Carla_Challenge/carlaChallenge3_dynamic.scenic @@ -9,12 +9,12 @@ To run this file using the Carla simulator: """ # SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc) -param map = localPath('../../../assets/maps/CARLA/Town05.xodr') -param carla_map = 'Town05' +param map = localPath('../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model # CONSTANTS -EGO_MODEL = "vehicle.lincoln.mkz_2017" +EGO_MODEL = "vehicle.nissan.patrol" EGO_SPEED = 10 SAFETY_DISTANCE = 10 BRAKE_INTENSITY = 1.0 @@ -36,8 +36,15 @@ behavior PedestrianBehavior(min_speed=1, threshold=10): # Please refer to scenic/domains/driving/roads.py how to access detailed road infrastructure # 'network' is the 'class Network' object in roads.py -# make sure to put '*' to uniformly randomly select from all elements of the list, 'network.lanes' -lane = Uniform(*network.lanes) +# collect all the curb-side lanes +curbLanes = [ + lg.lanes[0] + for lg in network.laneGroups + if lg is lg.road.forwardLanes +] + +# make sure to put '*' to uniformly randomly select from all elements of the list +lane = Uniform(*curbLanes) spot = new OrientedPoint on lane.centerline vending_spot = new OrientedPoint following roadDirection from spot for -3 @@ -55,6 +62,6 @@ ego = new Car following roadDirection from spot for Range(-30, -20), with blueprint EGO_MODEL, with behavior EgoBehavior(EGO_SPEED) -require (distance to intersection) > 75 +require (distance to intersection) > 40 require (ego.laneSection._slowerLane is None) -terminate when (distance to spot) > 50 +terminate when (distance to spot) > 50 \ No newline at end of file diff --git a/examples/carla/Carla_Challenge/carlaChallenge3_static.scenic b/examples/carla/Carla_Challenge/carlaChallenge3_static.scenic index d01f5be21..40de4e7ab 100644 --- a/examples/carla/Carla_Challenge/carlaChallenge3_static.scenic +++ b/examples/carla/Carla_Challenge/carlaChallenge3_static.scenic @@ -9,12 +9,12 @@ To run this file using the Carla simulator: """ ## SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc) -param map = localPath('../../../assets/maps/CARLA/Town01.xodr') -param carla_map = 'Town01' +param map = localPath('../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ## CONSTANTS -EGO_MODEL = "vehicle.lincoln.mkz_2017" +EGO_MODEL = "vehicle.nissan.patrol" EGO_SPEED = 10 EGO_BRAKING_THRESHOLD = 12 diff --git a/examples/carla/Carla_Challenge/carlaChallenge4.scenic b/examples/carla/Carla_Challenge/carlaChallenge4.scenic index 4fe1cf019..aa50666b9 100644 --- a/examples/carla/Carla_Challenge/carlaChallenge4.scenic +++ b/examples/carla/Carla_Challenge/carlaChallenge4.scenic @@ -9,12 +9,12 @@ To run this file using the Carla simulator: """ ## SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc) -param map = localPath('../../../assets/maps/CARLA/Town01.xodr') -param carla_map = 'Town01' +param map = localPath('../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ## CONSTANTS -EGO_MODEL = "vehicle.lincoln.mkz_2017" +EGO_MODEL = "vehicle.nissan.patrol" BICYCLE_MIN_SPEED = 1.5 THRESHOLD = 18 BRAKE_ACTION = 1.0 diff --git a/examples/carla/Carla_Challenge/carlaChallenge5.scenic b/examples/carla/Carla_Challenge/carlaChallenge5.scenic index b97c64655..1effa5a51 100644 --- a/examples/carla/Carla_Challenge/carlaChallenge5.scenic +++ b/examples/carla/Carla_Challenge/carlaChallenge5.scenic @@ -5,8 +5,8 @@ Ego-vehicle performs a lane changing to evade a leading vehicle, which is moving To run this file using the Carla simulator: scenic examples/carla/Carla_Challenge/carlaChallenge5.scenic --2d --model scenic.simulators.carla.model --simulate """ -param map = localPath('../../../assets/maps/CARLA/Town05.xodr') -param carla_map = 'Town05' +param map = localPath('../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model #CONSTANTS @@ -19,7 +19,7 @@ DIST_THRESHOLD = 15 behavior EgoBehavior(leftpath, origpath=[]): laneChangeCompleted = False - try: + try: do FollowLaneBehavior(EGO_SPEED) interrupt when withinDistanceToAnyObjs(self, DIST_THRESHOLD) and not laneChangeCompleted: @@ -53,4 +53,4 @@ cyclist = new Car following roadDirection from ego for EGO_TO_BICYCLE, with behavior SlowCarBehavior() require (distance from ego to intersection) > 10 -require (distance from cyclist to intersection) > 10 \ No newline at end of file +require (distance from cyclist to intersection) > 10 diff --git a/examples/carla/Carla_Challenge/carlaChallenge6.scenic b/examples/carla/Carla_Challenge/carlaChallenge6.scenic index f51b68262..a7885902a 100644 --- a/examples/carla/Carla_Challenge/carlaChallenge6.scenic +++ b/examples/carla/Carla_Challenge/carlaChallenge6.scenic @@ -9,8 +9,8 @@ To run this file using the Carla simulator: # N.B. Town07 is not included with CARLA by default; see installation instructions at # https://carla.readthedocs.io/en/latest/start_quickstart/#import-additional-assets -param map = localPath('../../../assets/maps/CARLA/Town07.xodr') -param carla_map = 'Town07' +param map = localPath('../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model @@ -81,11 +81,11 @@ oncomingCar = new Car on leftLaneSec.centerline, ego = new Car at spawnPt, with behavior EgoBehavior(leftLaneSec) - + blockingCar = new Car following roadDirection from ego for BLOCKING_CAR_DIST, with viewAngle 90 deg #Make sure the oncoming Car is at a visible section of the lane require blockingCar can see oncomingCar require (distance from blockingCar to oncomingCar) < DIST_BTW_BLOCKING_ONCOMING_CARS -require (distance from blockingCar to intersection) > DIST_TO_INTERSECTION \ No newline at end of file +require (distance from blockingCar to intersection) > DIST_TO_INTERSECTION diff --git a/examples/carla/Carla_Challenge/carlaChallenge7.scenic b/examples/carla/Carla_Challenge/carlaChallenge7.scenic index 92027273b..139000da4 100644 --- a/examples/carla/Carla_Challenge/carlaChallenge7.scenic +++ b/examples/carla/Carla_Challenge/carlaChallenge7.scenic @@ -1,14 +1,14 @@ """ Scenario Description Based on 2019 Carla Challenge Traffic Scenario 07. -Ego-vehicle is going straight at an intersection but a crossing vehicle +Ego-vehicle is going straight at an intersection but a crossing vehicle runs a red light, forcing the ego-vehicle to perform a collision avoidance maneuver. -Note: The traffic light control is not implemented yet, but it will soon be. +Note: The traffic light control is not implemented yet, but it will soon be. To run this file using the Carla simulator: scenic examples/carla/Carla_Challenge/carlaChallenge7.scenic --2d --model scenic.simulators.carla.model --simulate """ -param map = localPath('../../../assets/maps/CARLA/Town05.xodr') -param carla_map = 'Town05' +param map = localPath('../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model DELAY_TIME_1 = 1 # the delay time for ego @@ -26,7 +26,7 @@ behavior CrossingCarBehavior(trajectory): do FollowTrajectoryBehavior(trajectory = trajectory) behavior EgoBehavior(trajectory): - + try: do FollowTrajectoryBehavior(trajectory=trajectory) interrupt when withinDistanceToAnyObjs(self, SAFETY_DISTANCE): @@ -57,4 +57,4 @@ crossing_car = new Car following roadDirection from csm_spwPt for DISTANCE_TO_IN with behavior CrossingCarBehavior(crossing_car_trajectory) -"""Note: Traffic light is currently not controlled but this functionality will be added very soon """ \ No newline at end of file +"""Note: Traffic light is currently not controlled but this functionality will be added very soon """ diff --git a/examples/carla/Carla_Challenge/carlaChallenge8.scenic b/examples/carla/Carla_Challenge/carlaChallenge8.scenic index e1f8125df..e084b58f0 100644 --- a/examples/carla/Carla_Challenge/carlaChallenge8.scenic +++ b/examples/carla/Carla_Challenge/carlaChallenge8.scenic @@ -9,12 +9,12 @@ To run this file using the Carla simulator: """ ## SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc) -param map = localPath('../../../assets/maps/CARLA/Town05.xodr') -param carla_map = 'Town05' +param map = localPath('../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ## CONSTANTS -EGO_MODEL = "vehicle.lincoln.mkz_2017" +EGO_MODEL = "vehicle.nissan.patrol" EGO_SPEED = 10 SAFETY_DISTANCE = 20 BRAKE_INTENSITY = 1.0 @@ -78,7 +78,6 @@ ego = new Car at ego_spawn_pt, adversary = new Car at adv_spawn_pt, with behavior AdversaryBehavior(adv_trajectory) -require (ego_start_section.laneToLeft == adv_end_section) # make sure the ego and adversary are spawned in opposite lanes -require 25 <= (distance to intersec) <= 30 +require 10 <= (distance to intersec) <= 30 require 15 <= (distance from adversary to intersec) <= 20 terminate when (distance to ego_spawn_pt) > 70 diff --git a/examples/carla/Carla_Challenge/carlaChallenge9.scenic b/examples/carla/Carla_Challenge/carlaChallenge9.scenic index 133b4e07c..209c267d7 100644 --- a/examples/carla/Carla_Challenge/carlaChallenge9.scenic +++ b/examples/carla/Carla_Challenge/carlaChallenge9.scenic @@ -5,8 +5,8 @@ Ego-vehicle is performing a right turn at an intersection, yielding to crossing To run this file using the Carla simulator: scenic examples/carla/Carla_Challenge/carlaChallenge9.scenic --2d --model scenic.simulators.carla.model --simulate """ -param map = localPath('../../../assets/maps/CARLA/Town05.xodr') -param carla_map = 'Town05' +param map = localPath('../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model DELAY_TIME_1 = 1 # the delay time for ego diff --git a/examples/carla/NHTSA_Scenarios/bypassing/bypassing_01.scenic b/examples/carla/NHTSA_Scenarios/bypassing/bypassing_01.scenic index b041174bf..12119e72f 100644 --- a/examples/carla/NHTSA_Scenarios/bypassing/bypassing_01.scenic +++ b/examples/carla/NHTSA_Scenarios/bypassing/bypassing_01.scenic @@ -1,7 +1,7 @@ """ TITLE: Bypassing 01 AUTHOR: Francis Indaheng, findaheng@berkeley.edu -DESCRIPTION: Ego vehicle performs a lane change to bypass a slow +DESCRIPTION: Ego vehicle performs a lane change to bypass a slow adversary vehicle before returning to its original lane. SOURCE: NHSTA, #16 @@ -13,22 +13,22 @@ To run this file using the Carla simulator: # MAP AND MODEL # ################################# -param map = localPath('../../../../assets/maps/CARLA/Town03.xodr') -param carla_map = 'Town03' +param map = localPath('../../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ################################# # CONSTANTS # ################################# -MODEL = 'vehicle.lincoln.mkz_2017' +MODEL = 'vehicle.nissan.patrol' param EGO_SPEED = VerifaiRange(7, 10) param ADV_DIST = VerifaiRange(10, 25) param ADV_SPEED = VerifaiRange(2, 4) -BYPASS_DIST = [15, 10] +BYPASS_DIST = [20, 15] INIT_DIST = 50 TERM_TIME = 5 @@ -53,7 +53,7 @@ behavior EgoBehavior(): laneSectionToSwitch=slowerLaneSec, target_speed=globalParameters.EGO_SPEED) do FollowLaneBehavior(target_speed=globalParameters.EGO_SPEED) for TERM_TIME seconds - terminate + terminate ################################# # SPATIAL RELATIONS # diff --git a/examples/carla/NHTSA_Scenarios/bypassing/bypassing_02.scenic b/examples/carla/NHTSA_Scenarios/bypassing/bypassing_02.scenic index b95269650..8f4cb6da0 100644 --- a/examples/carla/NHTSA_Scenarios/bypassing/bypassing_02.scenic +++ b/examples/carla/NHTSA_Scenarios/bypassing/bypassing_02.scenic @@ -1,7 +1,7 @@ """ TITLE: Bypassing 02 AUTHOR: Francis Indaheng, findaheng@berkeley.edu -DESCRIPTION: Adversary vehicle performs a lane change to bypass the +DESCRIPTION: Adversary vehicle performs a lane change to bypass the slow ego vehicle before returning to its original lane. SOURCE: NHSTA, #16 @@ -13,22 +13,22 @@ To run this file using the Carla simulator: # MAP AND MODEL # ################################# -param map = localPath('../../../../assets/maps/CARLA/Town03.xodr') -param carla_map = 'Town03' +param map = localPath('../../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ################################# # CONSTANTS # ################################# -MODEL = 'vehicle.lincoln.mkz_2017' +MODEL = 'vehicle.nissan.patrol' param EGO_SPEED = VerifaiRange(2, 4) -param ADV_DIST = VerifaiRange(-25, -10) -param ADV_SPEED = VerifaiRange(7, 10) +param ADV_DIST = VerifaiRange(-35, -25) +param ADV_SPEED = VerifaiRange(6, 8) -BYPASS_DIST = [15, 10] +BYPASS_DIST = [25, 10] INIT_DIST = 50 TERM_TIME = 5 @@ -53,7 +53,7 @@ behavior AdversaryBehavior(): laneSectionToSwitch=slowerLaneSec, target_speed=globalParameters.ADV_SPEED) do FollowLaneBehavior(target_speed=globalParameters.ADV_SPEED) for TERM_TIME seconds - terminate + terminate ################################# # SPATIAL RELATIONS # diff --git a/examples/carla/NHTSA_Scenarios/bypassing/bypassing_03.scenic b/examples/carla/NHTSA_Scenarios/bypassing/bypassing_03.scenic index 6ec12c61e..9d89d2b31 100644 --- a/examples/carla/NHTSA_Scenarios/bypassing/bypassing_03.scenic +++ b/examples/carla/NHTSA_Scenarios/bypassing/bypassing_03.scenic @@ -1,9 +1,9 @@ """ TITLE: Bypassing 03 AUTHOR: Francis Indaheng, findaheng@berkeley.edu -DESCRIPTION: Ego vehicle performs a lane change to bypass a slow -adversary vehicle but cannot return to its original lane because -the adversary accelerates. Ego vehicle must then slow down to avoid +DESCRIPTION: Ego vehicle performs a lane change to bypass a slow +adversary vehicle but cannot return to its original lane because +the adversary accelerates. Ego vehicle must then slow down to avoid collision with leading vehicle in new lane. SOURCE: NHSTA, #16 @@ -15,15 +15,15 @@ To run this file using the Carla simulator: # MAP AND MODEL # ################################# -param map = localPath('../../../../assets/maps/CARLA/Town03.xodr') -param carla_map = 'Town03' +param map = localPath('../../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ################################# # CONSTANTS # ################################# -MODEL = 'vehicle.lincoln.mkz_2017' +MODEL = 'vehicle.nissan.patrol' param EGO_SPEED = VerifaiRange(7, 10) param EGO_BRAKE = VerifaiRange(0.7, 1.0) @@ -67,7 +67,7 @@ behavior EgoBehavior(): do DecelerateBehavior(globalParameters.EGO_BRAKE) interrupt when (distance to lead) > SAFE_DIST: do FollowLaneBehavior(target_speed=LEAD_SPEED) for TERM_TIME seconds - terminate + terminate behavior AdversaryBehavior(): do FollowLaneBehavior(target_speed=globalParameters.ADV_INIT_SPEED) \ diff --git a/examples/carla/NHTSA_Scenarios/bypassing/bypassing_04.scenic b/examples/carla/NHTSA_Scenarios/bypassing/bypassing_04.scenic index f4c42378c..65db750b2 100644 --- a/examples/carla/NHTSA_Scenarios/bypassing/bypassing_04.scenic +++ b/examples/carla/NHTSA_Scenarios/bypassing/bypassing_04.scenic @@ -1,7 +1,7 @@ """ TITLE: Bypassing 04 AUTHOR: Francis Indaheng, findaheng@berkeley.edu -DESCRIPTION: Ego vehicle performs multiple lane changes to bypass +DESCRIPTION: Ego vehicle performs multiple lane changes to bypass two slow adversary vehicles. SOURCE: NHSTA, #16 @@ -13,25 +13,25 @@ To run this file using the Carla simulator: # MAP AND MODEL # ################################# -param map = localPath('../../../../assets/maps/CARLA/Town03.xodr') -param carla_map = 'Town03' +param map = localPath('../../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ################################# # CONSTANTS # ################################# -MODEL = 'vehicle.lincoln.mkz_2017' +MODEL = 'vehicle.nissan.patrol' param EGO_SPEED = VerifaiRange(6, 8) -param ADV1_DIST = VerifaiRange(20, 25) -param ADV2_DIST = globalParameters.ADV1_DIST + VerifaiRange(15, 20) +param ADV1_DIST = VerifaiRange(25, 30) +param ADV2_DIST = globalParameters.ADV1_DIST + VerifaiRange(25, 30) param ADV_SPEED = VerifaiRange(2, 4) BYPASS_DIST = 15 INIT_DIST = 50 -TERM_DIST = globalParameters.ADV2_DIST + 15 +TERM_DIST = globalParameters.ADV2_DIST + 25 ################################# # AGENT BEHAVIORS # diff --git a/examples/carla/NHTSA_Scenarios/bypassing/bypassing_05.scenic b/examples/carla/NHTSA_Scenarios/bypassing/bypassing_05.scenic index 3001bcc92..3a007a39a 100644 --- a/examples/carla/NHTSA_Scenarios/bypassing/bypassing_05.scenic +++ b/examples/carla/NHTSA_Scenarios/bypassing/bypassing_05.scenic @@ -1,7 +1,7 @@ """ TITLE: Bypassing 05 AUTHOR: Francis Indaheng, findaheng@berkeley.edu -DESCRIPTION: Ego vehicle performs multiple lane changes to bypass three +DESCRIPTION: Ego vehicle performs multiple lane changes to bypass three slow adversary vehicles. SOURCE: NHSTA, #16 @@ -13,15 +13,15 @@ To run this file using the Carla simulator: # MAP AND MODEL # ################################# -param map = localPath('../../../../assets/maps/CARLA/Town03.xodr') -param carla_map = 'Town03' +param map = localPath('../../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ################################# # CONSTANTS # ################################# -MODEL = 'vehicle.lincoln.mkz_2017' +MODEL = 'vehicle.nissan.patrol' param EGO_SPEED = VerifaiRange(7, 10) param EGO_BRAKE = VerifaiRange(0.5, 1.0) diff --git a/examples/carla/NHTSA_Scenarios/intersection/intersection_01.scenic b/examples/carla/NHTSA_Scenarios/intersection/intersection_01.scenic index d17fdb7c3..7edf0a0a5 100644 --- a/examples/carla/NHTSA_Scenarios/intersection/intersection_01.scenic +++ b/examples/carla/NHTSA_Scenarios/intersection/intersection_01.scenic @@ -1,8 +1,8 @@ """ TITLE: Intersection 01 AUTHOR: Francis Indaheng, findaheng@berkeley.edu -DESCRIPTION: Ego vehicle goes straight at 4-way intersection and must -suddenly stop to avoid collision when adversary vehicle from opposite +DESCRIPTION: Ego vehicle goes straight at 4-way intersection and must +suddenly stop to avoid collision when adversary vehicle from opposite lane makes a left turn. SOURCE: NHSTA, #30 @@ -14,26 +14,26 @@ To run this file using the Carla simulator: # MAP AND MODEL # ################################# -param map = localPath('../../../../assets/maps/CARLA/Town05.xodr') -param carla_map = 'Town05' +param map = localPath('../../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ################################# # CONSTANTS # ################################# -MODEL = 'vehicle.lincoln.mkz_2017' +MODEL = 'vehicle.nissan.patrol' -EGO_INIT_DIST = [20, 25] -param EGO_SPEED = VerifaiRange(7, 10) +EGO_INIT_DIST = [10, 15] +param EGO_SPEED = VerifaiRange(4, 6) param EGO_BRAKE = VerifaiRange(0.5, 1.0) -ADV_INIT_DIST = [15, 20] -param ADV_SPEED = VerifaiRange(7, 10) +ADV_INIT_DIST = [10, 15] +param ADV_SPEED = VerifaiRange(8, 10) param SAFETY_DIST = VerifaiRange(10, 20) CRASH_DIST = 5 -TERM_DIST = 70 +TERM_DIST = 35 ################################# # AGENT BEHAVIORS # diff --git a/examples/carla/NHTSA_Scenarios/intersection/intersection_02.scenic b/examples/carla/NHTSA_Scenarios/intersection/intersection_02.scenic index 697e302b8..c43dd84df 100644 --- a/examples/carla/NHTSA_Scenarios/intersection/intersection_02.scenic +++ b/examples/carla/NHTSA_Scenarios/intersection/intersection_02.scenic @@ -1,8 +1,8 @@ """ TITLE: Intersection 02 AUTHOR: Francis Indaheng, findaheng@berkeley.edu -DESCRIPTION: Ego vehicle makes a left turn at 4-way intersection and -must suddenly stop to avoid collision when adversary vehicle from +DESCRIPTION: Ego vehicle makes a left turn at 4-way intersection and +must suddenly stop to avoid collision when adversary vehicle from opposite lane goes straight. SOURCE: NHSTA, #30 @@ -14,26 +14,26 @@ To run this file using the Carla simulator: # MAP AND MODEL # ################################# -param map = localPath('../../../../assets/maps/CARLA/Town05.xodr') -param carla_map = 'Town05' +param map = localPath('../../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ################################# # CONSTANTS # ################################# -MODEL = 'vehicle.lincoln.mkz_2017' +MODEL = 'vehicle.nissan.patrol' -EGO_INIT_DIST = [20, 25] +EGO_INIT_DIST = [10, 15] param EGO_SPEED = VerifaiRange(7, 10) param EGO_BRAKE = VerifaiRange(0.5, 1.0) -ADV_INIT_DIST = [15, 20] +ADV_INIT_DIST = [10, 15] param ADV_SPEED = VerifaiRange(7, 10) param SAFETY_DIST = VerifaiRange(10, 20) CRASH_DIST = 5 -TERM_DIST = 70 +TERM_DIST = 35 ################################# # AGENT BEHAVIORS # diff --git a/examples/carla/NHTSA_Scenarios/intersection/intersection_03.scenic b/examples/carla/NHTSA_Scenarios/intersection/intersection_03.scenic index 859898bec..28f5d1061 100644 --- a/examples/carla/NHTSA_Scenarios/intersection/intersection_03.scenic +++ b/examples/carla/NHTSA_Scenarios/intersection/intersection_03.scenic @@ -1,8 +1,8 @@ """ TITLE: Intersection 03 AUTHOR: Francis Indaheng, findaheng@berkeley.edu -DESCRIPTION: Ego vehicle either goes straight or makes a left turn at -4-way intersection and must suddenly stop to avoid collision when +DESCRIPTION: Ego vehicle either goes straight or makes a left turn at +4-way intersection and must suddenly stop to avoid collision when adversary vehicle from lateral lane continues straight. SOURCE: NHSTA, #28 #29 @@ -14,26 +14,26 @@ To run this file using the Carla simulator: # MAP AND MODEL # ################################# -param map = localPath('../../../../assets/maps/CARLA/Town05.xodr') -param carla_map = 'Town05' +param map = localPath('../../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ################################# # CONSTANTS # ################################# -MODEL = 'vehicle.lincoln.mkz_2017' +MODEL = 'vehicle.nissan.patrol' -EGO_INIT_DIST = [20, 25] +EGO_INIT_DIST = [6, 12] param EGO_SPEED = VerifaiRange(7, 10) param EGO_BRAKE = VerifaiRange(0.5, 1.0) -ADV_INIT_DIST = [15, 20] +ADV_INIT_DIST = [6, 12] param ADV_SPEED = VerifaiRange(7, 10) param SAFETY_DIST = VerifaiRange(10, 20) CRASH_DIST = 5 -TERM_DIST = 70 +TERM_DIST = 35 ################################# # AGENT BEHAVIORS # @@ -62,8 +62,8 @@ egoSpawnPt = new OrientedPoint in egoInitLane.centerline advInitLane = Uniform(*filter(lambda m: m.type is ManeuverType.STRAIGHT, - Uniform(*filter(lambda m: - m.type is ManeuverType.STRAIGHT, + Uniform(*filter(lambda m: + m.type is ManeuverType.STRAIGHT, egoInitLane.maneuvers) ).conflictingManeuvers) ).startLane diff --git a/examples/carla/NHTSA_Scenarios/intersection/intersection_04.scenic b/examples/carla/NHTSA_Scenarios/intersection/intersection_04.scenic index 4ef689d10..94ae7556d 100644 --- a/examples/carla/NHTSA_Scenarios/intersection/intersection_04.scenic +++ b/examples/carla/NHTSA_Scenarios/intersection/intersection_04.scenic @@ -1,8 +1,8 @@ """ TITLE: Intersection 04 AUTHOR: Francis Indaheng, findaheng@berkeley.edu -DESCRIPTION: Ego vehicle either goes straight or makes a left turn at -4-way intersection and must suddenly stop to avoid collision when +DESCRIPTION: Ego vehicle either goes straight or makes a left turn at +4-way intersection and must suddenly stop to avoid collision when adversary vehicle from lateral lane makes a left turn. SOURCE: NHSTA, #28 #29 @@ -14,26 +14,26 @@ To run this file using the Carla simulator: # MAP AND MODEL # ################################# -param map = localPath('../../../../assets/maps/CARLA/Town05.xodr') -param carla_map = 'Town05' +param map = localPath('../../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ################################# # CONSTANTS # ################################# -MODEL = 'vehicle.lincoln.mkz_2017' +MODEL = 'vehicle.nissan.patrol' -EGO_INIT_DIST = [20, 25] +EGO_INIT_DIST = [6, 12] param EGO_SPEED = VerifaiRange(7, 10) param EGO_BRAKE = VerifaiRange(0.5, 1.0) -ADV_INIT_DIST = [15, 20] +ADV_INIT_DIST = [6, 12] param ADV_SPEED = VerifaiRange(7, 10) param SAFETY_DIST = VerifaiRange(10, 20) CRASH_DIST = 5 -TERM_DIST = 70 +TERM_DIST = 35 ################################# # AGENT BEHAVIORS # diff --git a/examples/carla/NHTSA_Scenarios/intersection/intersection_05.scenic b/examples/carla/NHTSA_Scenarios/intersection/intersection_05.scenic index eff0df4d9..520a8df6a 100644 --- a/examples/carla/NHTSA_Scenarios/intersection/intersection_05.scenic +++ b/examples/carla/NHTSA_Scenarios/intersection/intersection_05.scenic @@ -1,7 +1,7 @@ """ TITLE: Intersection 05 AUTHOR: Francis Indaheng, findaheng@berkeley.edu -DESCRIPTION: Ego vehicle makes a right turn at 4-way intersection +DESCRIPTION: Ego vehicle makes a right turn at 4-way intersection while adversary vehicle from opposite lane makes a left turn. SOURCE: NHSTA, #25 @@ -13,17 +13,17 @@ To run this file using the Carla simulator: # MAP AND MODEL # ################################# -param map = localPath('../../../../assets/maps/CARLA/Town05.xodr') -param carla_map = 'Town05' +param map = localPath('../../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ################################# # CONSTANTS # ################################# -MODEL = 'vehicle.lincoln.mkz_2017' +MODEL = 'vehicle.nissan.patrol' -EGO_INIT_DIST = [20, 25] +EGO_INIT_DIST = [10, 15] param EGO_SPEED = VerifaiRange(7, 10) param EGO_BRAKE = VerifaiRange(0.5, 1.0) @@ -32,7 +32,7 @@ param ADV_SPEED = VerifaiRange(7, 10) param SAFETY_DIST = VerifaiRange(10, 20) CRASH_DIST = 5 -TERM_DIST = 70 +TERM_DIST = 35 ################################# # AGENT BEHAVIORS # @@ -59,8 +59,8 @@ egoSpawnPt = new OrientedPoint in egoInitLane.centerline advInitLane = Uniform(*filter(lambda m: m.type is ManeuverType.STRAIGHT, - Uniform(*filter(lambda m: - m.type is ManeuverType.STRAIGHT, + Uniform(*filter(lambda m: + m.type is ManeuverType.STRAIGHT, egoInitLane.maneuvers) ).reverseManeuvers) ).startLane diff --git a/examples/carla/NHTSA_Scenarios/intersection/intersection_06.scenic b/examples/carla/NHTSA_Scenarios/intersection/intersection_06.scenic index 5c74c5f34..8cd87ed66 100644 --- a/examples/carla/NHTSA_Scenarios/intersection/intersection_06.scenic +++ b/examples/carla/NHTSA_Scenarios/intersection/intersection_06.scenic @@ -1,7 +1,7 @@ """ TITLE: Intersection 06 AUTHOR: Francis Indaheng, findaheng@berkeley.edu -DESCRIPTION: Ego vehicle makes a right turn at 4-way intersection while +DESCRIPTION: Ego vehicle makes a right turn at 4-way intersection while adversary vehicle from lateral lane goes straight. SOURCE: NHSTA, #25 #26 @@ -13,26 +13,26 @@ To run this file using the Carla simulator: # MAP AND MODEL # ################################# -param map = localPath('../../../../assets/maps/CARLA/Town05.xodr') -param carla_map = 'Town05' +param map = localPath('../../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ################################# # CONSTANTS # ################################# -MODEL = 'vehicle.lincoln.mkz_2017' +MODEL = 'vehicle.nissan.patrol' -EGO_INIT_DIST = [20, 25] +EGO_INIT_DIST = [6, 12] param EGO_SPEED = VerifaiRange(7, 10) param EGO_BRAKE = VerifaiRange(0.5, 1.0) -ADV_INIT_DIST = [10, 15] +ADV_INIT_DIST = [6, 12] param ADV_SPEED = VerifaiRange(7, 10) param SAFETY_DIST = VerifaiRange(10, 20) CRASH_DIST = 5 -TERM_DIST = 70 +TERM_DIST = 35 ################################# # AGENT BEHAVIORS # @@ -59,8 +59,8 @@ egoSpawnPt = new OrientedPoint in egoInitLane.centerline advInitLane = Uniform(*filter(lambda m: m.type is ManeuverType.STRAIGHT, - Uniform(*filter(lambda m: - m.type is ManeuverType.STRAIGHT, + Uniform(*filter(lambda m: + m.type is ManeuverType.STRAIGHT, egoInitLane.maneuvers) ).conflictingManeuvers) ).startLane diff --git a/examples/carla/NHTSA_Scenarios/intersection/intersection_07.scenic b/examples/carla/NHTSA_Scenarios/intersection/intersection_07.scenic index 22551f68e..064e5cd01 100644 --- a/examples/carla/NHTSA_Scenarios/intersection/intersection_07.scenic +++ b/examples/carla/NHTSA_Scenarios/intersection/intersection_07.scenic @@ -1,8 +1,8 @@ """ TITLE: Intersection 07 AUTHOR: Francis Indaheng, findaheng@berkeley.edu -DESCRIPTION: Ego vehicle makes a left turn at 3-way intersection and -must suddenly stop to avoid collision when adversary vehicle from +DESCRIPTION: Ego vehicle makes a left turn at 3-way intersection and +must suddenly stop to avoid collision when adversary vehicle from lateral lane continues straight. SOURCE: NHSTA, #30 @@ -14,22 +14,22 @@ To run this file using the Carla simulator: # MAP AND MODEL # ################################# -param map = localPath('../../../../assets/maps/CARLA/Town05.xodr') -param carla_map = 'Town05' +param map = localPath('../../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ################################# # CONSTANTS # ################################# -MODEL = 'vehicle.lincoln.mkz_2017' +MODEL = 'vehicle.nissan.patrol' EGO_INIT_DIST = [20, 40] -param EGO_SPEED = VerifaiRange(7, 10) +param EGO_SPEED = VerifaiRange(5, 8) param EGO_BRAKE = VerifaiRange(0.5, 1.0) ADV_INIT_DIST = [0, 20] -param ADV_SPEED = VerifaiRange(7, 10) +param ADV_SPEED = VerifaiRange(5, 8) param SAFETY_DIST = VerifaiRange(10, 20) CRASH_DIST = 5 diff --git a/examples/carla/NHTSA_Scenarios/intersection/intersection_08.scenic b/examples/carla/NHTSA_Scenarios/intersection/intersection_08.scenic index 89e1482ec..d7919e702 100644 --- a/examples/carla/NHTSA_Scenarios/intersection/intersection_08.scenic +++ b/examples/carla/NHTSA_Scenarios/intersection/intersection_08.scenic @@ -1,8 +1,8 @@ """ TITLE: Intersection 08 AUTHOR: Francis Indaheng, findaheng@berkeley.edu -DESCRIPTION: Ego vehicle goes straight at 3-way intersection and must -suddenly stop to avoid collision when adversary vehicle makes a left +DESCRIPTION: Ego vehicle goes straight at 3-way intersection and must +suddenly stop to avoid collision when adversary vehicle makes a left turn. SOURCE: NHSTA, #30 @@ -14,15 +14,15 @@ To run this file using the Carla simulator: # MAP AND MODEL # ################################# -param map = localPath('../../../../assets/maps/CARLA/Town05.xodr') -param carla_map = 'Town05' +param map = localPath('../../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ################################# # CONSTANTS # ################################# -MODEL = 'vehicle.lincoln.mkz_2017' +MODEL = 'vehicle.nissan.patrol' EGO_INIT_DIST = [20, 40] param EGO_SPEED = VerifaiRange(7, 10) diff --git a/examples/carla/NHTSA_Scenarios/intersection/intersection_09.scenic b/examples/carla/NHTSA_Scenarios/intersection/intersection_09.scenic index e9c81ae4b..a924e2b81 100644 --- a/examples/carla/NHTSA_Scenarios/intersection/intersection_09.scenic +++ b/examples/carla/NHTSA_Scenarios/intersection/intersection_09.scenic @@ -1,7 +1,7 @@ """ TITLE: Intersection 09 AUTHOR: Francis Indaheng, findaheng@berkeley.edu -DESCRIPTION: Ego vehicle makes a right turn at 3-way intersection +DESCRIPTION: Ego vehicle makes a right turn at 3-way intersection while adversary vehicle from lateral lane goes straight. SOURCE: NHSTA, #28 #29 @@ -13,15 +13,15 @@ To run this file using the Carla simulator: # MAP AND MODEL # ################################# -param map = localPath('../../../../assets/maps/CARLA/Town05.xodr') -param carla_map = 'Town05' +param map = localPath('../../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ################################# # CONSTANTS # ################################# -MODEL = 'vehicle.lincoln.mkz_2017' +MODEL = 'vehicle.nissan.patrol' EGO_INIT_DIST = [20, 25] param EGO_SPEED = VerifaiRange(7, 10) diff --git a/examples/carla/NHTSA_Scenarios/intersection/intersection_10.scenic b/examples/carla/NHTSA_Scenarios/intersection/intersection_10.scenic index 50f34b6ec..58fc08199 100644 --- a/examples/carla/NHTSA_Scenarios/intersection/intersection_10.scenic +++ b/examples/carla/NHTSA_Scenarios/intersection/intersection_10.scenic @@ -1,8 +1,8 @@ """ TITLE: Intersection 10 AUTHOR: Francis Indaheng, findaheng@berkeley.edu -DESCRIPTION: Ego Vehicle waits at 4-way intersection while adversary -vehicle in adjacent lane passes before performing a lane change to +DESCRIPTION: Ego Vehicle waits at 4-way intersection while adversary +vehicle in adjacent lane passes before performing a lane change to bypass a stationary vehicle waiting to make a left turn. SOURCE: NHSTA, #16 @@ -14,27 +14,27 @@ To run this file using the Carla simulator: # MAP AND MODEL # ################################# -param map = localPath('../../../../assets/maps/CARLA/Town05.xodr') -param carla_map = 'Town05' +param map = localPath('../../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ################################# # CONSTANTS # ################################# -MODEL = 'vehicle.lincoln.mkz_2017' +MODEL = 'vehicle.nissan.patrol' -param EGO_INIT_DIST = VerifaiRange(10, 15) +param EGO_INIT_DIST = VerifaiRange(18, 20) param EGO_SPEED = VerifaiRange(7, 10) param EGO_BRAKE = VerifaiRange(0.5, 1.0) STAT_INIT_DIST = [0, 5] ADV_INIT_DIST = [15, 20] -ADV_SPEED = 10 +ADV_SPEED = 12 BYPASS_DIST = 8 -TERM_DIST = 70 +TERM_DIST = 40 ################################# # AGENT BEHAVIORS # @@ -55,7 +55,7 @@ behavior EgoBehavior(): intersection = Uniform(*filter(lambda i: i.is4Way, network.intersections)) -statInitLane = Uniform(*filter(lambda lane: +statInitLane = Uniform(*filter(lambda lane: all([sec._laneToRight is not None for sec in lane.sections]), intersection.incomingLanes)) statSpawnPt = new OrientedPoint in statInitLane.centerline diff --git a/examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_01.scenic b/examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_01.scenic index c07454ccb..72674fafe 100644 --- a/examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_01.scenic +++ b/examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_01.scenic @@ -1,27 +1,27 @@ """ TITLE: Pedestrian 01 AUTHOR: Francis Indaheng, findaheng@berkeley.edu -DESCRIPTION: Ego vehicle must suddenly stop to avoid collision when +DESCRIPTION: Ego vehicle must suddenly stop to avoid collision when pedestrian crosses the road unexpectedly. SOURCE: Carla Challenge, #03 To run this file using the Carla simulator: - scenic examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_01.scenic --2d --model scenic.simulators.carla.model --simulate + scenic examples/carala/NHTSA_Scenarios/pedestrian/pedestrian_01.scenic --2d --model scenic.simulators.carla.model --simulate """ ################################# # MAP AND MODEL # ################################# -param map = localPath('../../../../assets/maps/CARLA/Town01.xodr') -param carla_map = 'Town01' +param map = localPath('../../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ################################# # CONSTANTS # ################################# -MODEL = 'vehicle.lincoln.mkz_2017' +MODEL = 'vehicle.nissan.patrol' param EGO_INIT_DIST = VerifaiRange(-30, -20) param EGO_SPEED = VerifaiRange(7, 10) @@ -31,7 +31,7 @@ PED_MIN_SPEED = 1.0 PED_THRESHOLD = 20 param SAFETY_DIST = VerifaiRange(10, 15) -BUFFER_DIST = 75 +BUFFER_DIST = 50 CRASH_DIST = 5 TERM_DIST = 50 @@ -51,7 +51,16 @@ behavior EgoBehavior(): # SPATIAL RELATIONS # ################################# -lane = Uniform(*network.lanes) +# collect all the curb-side lanes +curbLanes = [ + lg.lanes[0] + for lg in network.laneGroups + if lg is lg.road.forwardLanes +] + +# make sure to put '*' to uniformly randomly select from all elements of the list +lane = Uniform(*curbLanes) + spawnPt = new OrientedPoint on lane.centerline ################################# @@ -68,6 +77,4 @@ ped = new Pedestrian right of spawnPt by 3, with behavior CrossingBehavior(ego, PED_MIN_SPEED, PED_THRESHOLD) require (distance to intersection) > BUFFER_DIST -require always (ego.laneSection._slowerLane is None) -require always (ego.laneSection._fasterLane is None) terminate when (distance to spawnPt) > TERM_DIST diff --git a/examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_02.scenic b/examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_02.scenic index eb4c0ea40..d682e4bf7 100644 --- a/examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_02.scenic +++ b/examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_02.scenic @@ -1,7 +1,7 @@ """ TITLE: Pedestrian 02 AUTHOR: Francis Indaheng, findaheng@berkeley.edu -DESCRIPTION: Both ego and adversary vehicles must suddenly stop to avoid +DESCRIPTION: Both ego and adversary vehicles must suddenly stop to avoid collision when pedestrian crosses the road unexpectedly. SOURCE: Carla Challenge, #03 @@ -13,15 +13,15 @@ To run this file using the Carla simulator: # MAP AND MODEL # ################################# -param map = localPath('../../../../assets/maps/CARLA/Town01.xodr') -param carla_map = 'Town01' +param map = localPath('../../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ################################# # CONSTANTS # ################################# -MODEL = 'vehicle.lincoln.mkz_2017' +MODEL = 'vehicle.nissan.patrol' param EGO_INIT_DIST = VerifaiRange(-30, -20) param EGO_SPEED = VerifaiRange(7, 10) @@ -35,7 +35,7 @@ PED_MIN_SPEED = 1.0 PED_THRESHOLD = 20 param SAFETY_DIST = VerifaiRange(10, 15) -BUFFER_DIST = 75 +BUFFER_DIST = 50 CRASH_DIST = 5 TERM_DIST = 50 @@ -63,8 +63,9 @@ behavior AdvBehavior(): # SPATIAL RELATIONS # ################################# -road = Uniform(*filter(lambda r: len(r.forwardLanes.lanes) == len(r.backwardLanes.lanes) == 1, network.roads)) +road = Uniform(*filter(lambda r: len(r.forwardLanes.lanes) > 0 and len(r.backwardLanes.lanes) > 0, network.roads)) egoLane = Uniform(road.forwardLanes.lanes)[0] +advLane = Uniform(*road.backwardLanes.lanes) spawnPt = new OrientedPoint on egoLane.centerline advSpawnPt = new OrientedPoint following roadDirection from spawnPt for globalParameters.ADV_INIT_DIST @@ -81,14 +82,10 @@ ped = new Pedestrian right of spawnPt by 3, with regionContainedIn None, with behavior CrossingBehavior(ego, PED_MIN_SPEED, PED_THRESHOLD) -adv = new Car left of advSpawnPt by 3, +adv = new Car left of advSpawnPt by 7, with blueprint MODEL, with heading 180 deg relative to spawnPt.heading, with behavior AdvBehavior() require (distance from spawnPt to intersection) > BUFFER_DIST -require always (ego.laneSection._slowerLane is None) -require always (ego.laneSection._fasterLane is None) -require always (adv.laneSection._slowerLane is None) -require always (adv.laneSection._fasterLane is None) terminate when (distance to spawnPt) > TERM_DIST diff --git a/examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_03.scenic b/examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_03.scenic index d07736569..1ac6a93eb 100644 --- a/examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_03.scenic +++ b/examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_03.scenic @@ -1,7 +1,7 @@ """ TITLE: Pedestrian 03 AUTHOR: Francis Indaheng, findaheng@berkeley.edu -DESCRIPTION: Ego vehicle makes a left turn at an intersection and must +DESCRIPTION: Ego vehicle makes a left turn at an intersection and must suddenly stop to avoid collision when pedestrian crosses the crosswalk. SOURCE: Carla Challenge, #04 @@ -13,15 +13,15 @@ To run this file using the Carla simulator: # MAP AND MODEL # ################################# -param map = localPath('../../../../assets/maps/CARLA/Town05.xodr') -param carla_map = 'Town05' +param map = localPath('../../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ################################# # CONSTANTS # ################################# -MODEL = 'vehicle.lincoln.mkz_2017' +MODEL = 'vehicle.nissan.patrol' EGO_INIT_DIST = [20, 25] param EGO_SPEED = VerifaiRange(7, 10) diff --git a/examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_04.scenic b/examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_04.scenic index edc9ff90c..4fe9289f1 100644 --- a/examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_04.scenic +++ b/examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_04.scenic @@ -1,7 +1,7 @@ """ TITLE: Pedestrian 04 AUTHOR: Francis Indaheng, findaheng@berkeley.edu -DESCRIPTION: Ego vehicle makes a right turn at an intersection and must +DESCRIPTION: Ego vehicle makes a right turn at an intersection and must yield when pedestrian crosses the crosswalk. SOURCE: Carla Challenge, #04 @@ -13,15 +13,15 @@ To run this file using the Carla simulator: # MAP AND MODEL # ################################# -param map = localPath('../../../../assets/maps/CARLA/Town05.xodr') -param carla_map = 'Town05' +param map = localPath('../../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ################################# # CONSTANTS # ################################# -MODEL = 'vehicle.lincoln.mkz_2017' +MODEL = 'vehicle.nissan.patrol' EGO_INIT_DIST = [20, 25] param EGO_SPEED = VerifaiRange(7, 10) diff --git a/examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_05.scenic b/examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_05.scenic index b2b6dbb4a..6e37f69fa 100644 --- a/examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_05.scenic +++ b/examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_05.scenic @@ -1,7 +1,7 @@ """ TITLE: Pedestrian 05 AUTHOR: Francis Indaheng, findaheng@berkeley.edu -DESCRIPTION: Ego vehicle goes straight at an intersection and must +DESCRIPTION: Ego vehicle goes straight at an intersection and must yield when pedestrian crosses the crosswalk. SOURCE: Carla Challenge, #04 @@ -13,15 +13,15 @@ To run this file using the Carla simulator: # MAP AND MODEL # ################################# -param map = localPath('../../../../assets/maps/CARLA/Town05.xodr') -param carla_map = 'Town05' +param map = localPath('../../../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ################################# # CONSTANTS # ################################# -MODEL = 'vehicle.lincoln.mkz_2017' +MODEL = 'vehicle.nissan.patrol' EGO_INIT_DIST = [20, 25] param EGO_SPEED = VerifaiRange(7, 10) diff --git a/examples/carla/OAS_Scenarios/oas_scenario_05.scenic b/examples/carla/OAS_Scenarios/oas_scenario_05.scenic index 4573b8376..b98f461a9 100644 --- a/examples/carla/OAS_Scenarios/oas_scenario_05.scenic +++ b/examples/carla/OAS_Scenarios/oas_scenario_05.scenic @@ -3,11 +3,11 @@ Voyage OAS Scenario Unique ID: 2-2-XX-CF-STR-CAR:Pa>E:03 The lead car suddenly stops and then resumes moving forward To run this file using the Carla simulator: - scenic examples/carla/NHTSA_Scenarios/OAS_Scenarios/oas_scenario_05.scenic --2d --model scenic.simulators.carla.model --simulate + scenic examples/carla/OAS_Scenarios/oas_scenario_05.scenic --2d --model scenic.simulators.carla.model --simulate """ -param map = localPath('../../../assets/maps/CARLA/Town01.xodr') # or other CARLA map that definitely works -param carla_map = 'Town01' +param map = localPath('../../../assets/maps/CARLA/Town10HD_Opt.xodr') # or other CARLA map that definitely works +param carla_map = 'Town10HD_Opt' model scenic.domains.driving.model MAX_BREAK_THRESHOLD = 1 @@ -28,7 +28,7 @@ behavior CollisionAvoidance(): behavior FollowLeadCarBehavior(): - try: + try: do FollowLaneBehavior() interrupt when withinDistanceToAnyObjs(self, SAFETY_DISTANCE): @@ -43,4 +43,4 @@ other = new Car on select_lane.centerline, with behavior LeadCarBehavior() ego = new Car following roadDirection from other for INITIAL_DISTANCE_APART, - with behavior FollowLeadCarBehavior() \ No newline at end of file + with behavior FollowLeadCarBehavior() diff --git a/examples/carla/OAS_Scenarios/oas_scenario_06.scenic b/examples/carla/OAS_Scenarios/oas_scenario_06.scenic index f9c0b8aeb..35bf5b050 100644 --- a/examples/carla/OAS_Scenarios/oas_scenario_06.scenic +++ b/examples/carla/OAS_Scenarios/oas_scenario_06.scenic @@ -1,15 +1,15 @@ """ Scenario Description Voyage OAS Scenario Unique ID: 2-2-XX-CF-STR-CAR:Pa>E:03 The car ahead of ego that is badly parked over the sidewalk cuts into ego vehicle's lane. -This scenario may fail if there exists any obstacle (e.g. fences) on the sidewalk +This scenario may fail if there exists any obstacle (e.g. fences) on the sidewalk To run this file using the Carla simulator: - scenic examples/carla/NHTSA_Scenarios/OAS_Scenarios/oas_scenario_06.scenic --2d --model scenic.simulators.carla.model --simulate + scenic examples/carla/OAS_Scenarios/oas_scenario_06.scenic --2d --model scenic.simulators.carla.model --simulate """ -param map = localPath('../../../assets/maps/CARLA/Town01.xodr') # or other CARLA map that definitely works -param carla_map = 'Town01' +param map = localPath('../../../assets/maps/CARLA/Town10HD_Opt.xodr') # or other CARLA map that definitely works +param carla_map = 'Town10HD_Opt' model scenic.domains.driving.model MAX_BREAK_THRESHOLD = 1 @@ -31,7 +31,7 @@ behavior CollisionAvoidance(): behavior EgoBehavior(target_speed): - try: + try: do FollowLaneBehavior(target_speed=target_speed) interrupt when withinDistanceToAnyObjs(self, SAFETY_DISTANCE): @@ -44,7 +44,7 @@ ego_lane = select_road.lanes[0] ego = new Car on ego_lane.centerline, with behavior EgoBehavior(target_speed=EGO_SPEED) - + spot = new OrientedPoint on visible curb parkedHeadingAngle = Uniform(-1,1)*Range(10,20) deg diff --git a/examples/carla/adjacentLanes.scenic b/examples/carla/adjacentLanes.scenic index 4bf11661e..ac1feb1ff 100644 --- a/examples/carla/adjacentLanes.scenic +++ b/examples/carla/adjacentLanes.scenic @@ -3,11 +3,11 @@ To run this file using the Carla simulator: scenic examples/carla/adjacentLanes.scenic --2d --model scenic.simulators.carla.model ''' -param map = localPath('../../assets/maps/CARLA/Town03.xodr') +param map = localPath('../../assets/maps/CARLA/Town10HD_Opt.xodr') model scenic.simulators.carla.model # Cars on adjacent lanes of the first section of Road 69 -roadSec = network.elements['road69'].sections[0] +roadSec = network.elements['road0'].sections[0] ego = new Car in roadSec.forwardLanes[0], # rightmost lane with color Color(1, 0, 0) c1 = new Car in roadSec.forwardLanes[1], # next lane to left diff --git a/examples/carla/adjacentOpposingPair.scenic b/examples/carla/adjacentOpposingPair.scenic index f28044289..28405c873 100644 --- a/examples/carla/adjacentOpposingPair.scenic +++ b/examples/carla/adjacentOpposingPair.scenic @@ -2,10 +2,10 @@ To run this file using the Carla simulator: scenic examples/carla/adjacentOpposingPair.scenic --2d --model scenic.simulators.carla.model ''' -param map = localPath('../../assets/maps/CARLA/Town01.xodr') +param map = localPath('../../assets/maps/CARLA/Town10HD_Opt.xodr') model scenic.simulators.carla.model ego = new Car with visibleDistance 20 c2 = new Car visible c3 = new Car at c2 offset by Range(-10, 1) @ 0 -require abs(relative heading of c3 from c2) >= 150 deg \ No newline at end of file +require abs(relative heading of c3 from c2) >= 150 deg diff --git a/examples/carla/backgroundActivity.scenic b/examples/carla/backgroundActivity.scenic index 8b29e1f01..9ed8e8289 100644 --- a/examples/carla/backgroundActivity.scenic +++ b/examples/carla/backgroundActivity.scenic @@ -7,11 +7,11 @@ To run this file using the Carla simulator: scenic examples/carla/backgroundActivity.scenic --2d --model scenic.simulators.carla.model --simulate """ # SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc) -param map = localPath('../../assets/maps/CARLA/Town05.xodr') # or other CARLA map that definitely works -param carla_map = 'Town05' +param map = localPath('../../assets/maps/CARLA/Town10HD_Opt.xodr') # or other CARLA map that definitely works +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model -EGO_MODEL = "vehicle.lincoln.mkz_2017" +EGO_MODEL = "vehicle.nissan.patrol" EGO_SPEED = 10 # EGO BEHAVIOR: Follow lane and brake when reaches threshold distance to obstacle @@ -27,7 +27,7 @@ behavior PedestrianBehavior(min_speed=1, threshold=10): ## DEFINING SPATIAL RELATIONS # Please refer to scenic/domains/driving/roads.py how to access detailed road infrastructure -# 'network' is the 'class Network' object in roads.py +# 'network' is the 'class Network' object in roads.py # Background activity background_vehicles = [] diff --git a/examples/carla/car.scenic b/examples/carla/car.scenic index 1f4c68cb7..7011f2b31 100644 --- a/examples/carla/car.scenic +++ b/examples/carla/car.scenic @@ -2,7 +2,7 @@ To run this file using the Carla simulator: scenic examples/carla/car.scenic --2d --model scenic.simulators.carla.model --simulate ''' -param map = localPath('../../assets/maps/CARLA/Town01.xodr') +param map = localPath('../../assets/maps/CARLA/Town10HD_Opt.xodr') model scenic.simulators.carla.model ego = new Car diff --git a/examples/carla/check_across_runs.py b/examples/carla/check_across_runs.py new file mode 100644 index 000000000..1b30ebe61 --- /dev/null +++ b/examples/carla/check_across_runs.py @@ -0,0 +1,56 @@ +import random +import math +import scenic +from scenic.simulators.carla import CarlaSimulator + +code = """ +param map = "assets/maps/CARLA/Town10HD_Opt.xodr" +model scenic.simulators.carla.model +param carla_map = "Town10HD_Opt" +param time_step = 1.0/10 +param weather = "HardRainNoon" + +behavior DriveFullThrottle(): + while True: + take SetThrottleAction(1) + +ego = new Car at (-42, -137), + with behavior DriveFullThrottle, + with blueprint "vehicle.nissan.patrol" + +record initial ego.position as StartPos +record final ego.position as EndPos +record final ego.speed as CarSpeed +terminate after 8 seconds +""" + +def run_one(seed): + random.seed(seed) + scenario = scenic.scenarioFromString(code, mode2D=True) + scene, _ = scenario.generate() + + sim = CarlaSimulator( + carla_map="Town10HD_Opt", + map_path="assets/maps/CARLA/Town10HD_Opt.xodr", + ) + recs = sim.simulate(scene).result.records + + start_pos = recs["StartPos"] + end_pos = recs["EndPos"] + dx = end_pos[0] - start_pos[0] + dy = end_pos[1] - start_pos[1] + return math.hypot(dx, dy) + +def run_multiple(seed, runs=20): + print(f"== Running seed {seed} for {runs} runs ==") + distances = [] + for i in range(1, runs + 1): + dist = run_one(seed) + distances.append(dist) + print(f"Run {i:2d}: {dist:.2f} m") + return distances + +if __name__ == "__main__": + SEED = 52 + TRIALS = 30 + run_multiple(SEED, TRIALS) diff --git a/examples/carla/manual_control/carlaChallenge1.scenic b/examples/carla/manual_control/carlaChallenge1.scenic index bb024a335..94dfae3f6 100644 --- a/examples/carla/manual_control/carlaChallenge1.scenic +++ b/examples/carla/manual_control/carlaChallenge1.scenic @@ -9,13 +9,13 @@ To run this file using the Carla simulator: """ ## SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc) -param map = localPath('../../../assets/maps/CARLA/Town01.xodr') # or other CARLA map that definitely works -param carla_map = 'Town01' +param map = localPath('../../../assets/maps/CARLA/Town10HD_Opt.xodr') # or other CARLA map that definitely works +param carla_map = 'Town10HD_Opt' param render = 0 model scenic.simulators.carla.model ## CONSTANTS -EGO_MODEL = "vehicle.lincoln.mkz_2017" +EGO_MODEL = "vehicle.nissan.patrol" EGO_SPEED = 10 ## DEFINING SPATIAL RELATIONS diff --git a/examples/carla/manual_control/carlaChallenge3_dynamic.scenic b/examples/carla/manual_control/carlaChallenge3_dynamic.scenic index 1ae36f3f4..1ead57a5b 100644 --- a/examples/carla/manual_control/carlaChallenge3_dynamic.scenic +++ b/examples/carla/manual_control/carlaChallenge3_dynamic.scenic @@ -9,13 +9,13 @@ To run this file using the Carla simulator: """ # SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc) -param map = localPath('../../../assets/maps/CARLA/Town05.xodr') # or other CARLA map that definitely works -param carla_map = 'Town05' +param map = localPath('../../../assets/maps/CARLA/Town10HD_Opt.xodr') # or other CARLA map that definitely works +param carla_map = 'Town10HD_Opt' param render = 0 model scenic.simulators.carla.model # CONSTANTS -EGO_MODEL = "vehicle.lincoln.mkz_2017" +EGO_MODEL = "vehicle.nissan.patrol" EGO_SPEED = 10 PEDESTRIAN_MIN_SPEED = 0.5 @@ -29,7 +29,7 @@ behavior PedestrianBehavior(min_speed=1, threshold=10): ## DEFINING SPATIAL RELATIONS # Please refer to scenic/domains/driving/roads.py how to access detailed road infrastructure -# 'network' is the 'class Network' object in roads.py +# 'network' is the 'class Network' object in roads.py # make sure to put '*' to uniformly randomly select from all elements of the list, 'network.lanes' lane = Uniform(*network.lanes) diff --git a/examples/carla/manual_control/carlaChallenge4.scenic b/examples/carla/manual_control/carlaChallenge4.scenic index 4b3eb48e5..546bb51f5 100644 --- a/examples/carla/manual_control/carlaChallenge4.scenic +++ b/examples/carla/manual_control/carlaChallenge4.scenic @@ -9,13 +9,13 @@ To run this file using the Carla simulator: """ ## SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc) -param map = localPath('../../../assets/maps/CARLA/Town01.xodr') # or other CARLA map that definitely works -param carla_map = 'Town01' +param map = localPath('../../../assets/maps/CARLA/Town10HD_Opt.xodr') # or other CARLA map that definitely works +param carla_map = 'Town10HD_Opt' param render = 0 model scenic.simulators.carla.model ## CONSTANTS -EGO_MODEL = "vehicle.lincoln.mkz_2017" +EGO_MODEL = "vehicle.nissan.patrol" BICYCLE_MIN_SPEED = 1 THRESHOLD = 15 diff --git a/examples/carla/manual_control/carlaChallenge7.scenic b/examples/carla/manual_control/carlaChallenge7.scenic index 49477f9c7..27af9793c 100644 --- a/examples/carla/manual_control/carlaChallenge7.scenic +++ b/examples/carla/manual_control/carlaChallenge7.scenic @@ -9,8 +9,8 @@ To run this file using the Carla simulator: """ ## SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc) -param map = localPath('../../../assets/maps/CARLA/Town05.xodr') # or other CARLA map that definitely works -param carla_map = 'Town05' +param map = localPath('../../../assets/maps/CARLA/Town10HD_Opt.xodr') # or other CARLA map that definitely works +param carla_map = 'Town10HD_Opt' param render = 0 model scenic.simulators.carla.model @@ -58,7 +58,7 @@ adv_trajectory = [adv_maneuver.startLane, adv_maneuver.connectingLane, adv_maneu ego_spawn_pt = new OrientedPoint in ego_maneuver.startLane.centerline adv_spawn_pt = new OrientedPoint in adv_maneuver.startLane.centerline -# Set a specific vehicle model for the Truck. +# Set a specific vehicle model for the Truck. # The referenceable types of vehicles supported in carla are listed in scenic/simulators/carla/model.scenic # For each vehicle type, the supported models are listed in scenic/simulators/carla/blueprints.scenic ego = new Car at ego_spawn_pt, diff --git a/examples/carla/pedestrian.scenic b/examples/carla/pedestrian.scenic index 3298d69d6..e4338e6ec 100644 --- a/examples/carla/pedestrian.scenic +++ b/examples/carla/pedestrian.scenic @@ -2,9 +2,9 @@ To run this file using the Carla simulator: scenic examples/carla/pedestrian.scenic --2d --model scenic.simulators.carla.model --simulate ''' -param map = localPath('../../assets/maps/CARLA/Town03.xodr') -param carla_map = 'Town03' +param map = localPath('../../assets/maps/CARLA/Town10HD_Opt.xodr') +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ego = new Car -new Pedestrian on visible sidewalk \ No newline at end of file +new Pedestrian on visible sidewalk diff --git a/examples/carla/test.scenic b/examples/carla/test.scenic new file mode 100644 index 000000000..19ea41ebc --- /dev/null +++ b/examples/carla/test.scenic @@ -0,0 +1,90 @@ +param map = localPath('../../assets/maps/CARLA/Town10HD_Opt.xodr') +model scenic.simulators.carla.model +param carla_map = "Town10HD_Opt" +param time_step = 1.0/10 + +# behavior DriveWithThrottle(): +# while True: +# take SetThrottleAction(1) + +# ego = new Car + +# ego = new Car at (369, -326), with behavior DriveWithThrottle + +# ego = new Pedestrian with blueprint "walker.pedestrian.0024", +# with regionContainedIn None, +# at (-107.52, -50.87) + +# ego = new Car at (-3.3, -68), with behavior DriveWithThrottle + # with regionContainedIn None + + +ego = new Car at (-3.57, -66.12), with behavior FollowLaneBehavior(1) + +# """ Scenario Description +# Traffic Scenario 03 (dynamic). +# Obstacle avoidance without prior action. +# The ego-vehicle encounters an obstacle / unexpected entity on the road and must perform an +# emergency brake or an avoidance maneuver. + +# To run this file using the Carla simulator: +# scenic examples/carla/Carla_Challenge/carlaChallenge3_dynamic.scenic --2d --model scenic.simulators.carla.model --simulate +# """ + +# # SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc) +# param map = localPath('../../../assets/maps/CARLA/Town10HD_Opt.xodr') +# param carla_map = 'Town10HD_Opt' +# model scenic.simulators.carla.model + +# # CONSTANTS +# EGO_MODEL = "vehicle.nissan.patrol" +# EGO_SPEED = 6 +# SAFETY_DISTANCE = 10 +# BRAKE_INTENSITY = 1.0 + +# PEDESTRIAN_MIN_SPEED = 2.0 +# THRESHOLD = 30 + +# # EGO BEHAVIOR: Follow lane and brake when reaches threshold distance to obstacle +# behavior EgoBehavior(speed=10): +# try: +# do FollowLaneBehavior(target_speed=speed) +# interrupt when withinDistanceToObjsInLane(self, SAFETY_DISTANCE): +# take SetBrakeAction(BRAKE_INTENSITY) + +# behavior PedestrianBehavior(min_speed=1, threshold=10): +# do CrossingBehavior(ego, min_speed, threshold) + +# ## DEFINING SPATIAL RELATIONS +# # Please refer to scenic/domains/driving/roads.py how to access detailed road infrastructure +# # 'network' is the 'class Network' object in roads.py + +# # collect all the curb-side lanes +# curbLanes = [ +# lg.lanes[0] +# for lg in network.laneGroups +# if lg is lg.road.forwardLanes +# ] + +# # make sure to put '*' to uniformly randomly select from all elements of the list +# lane = Uniform(*curbLanes) + +# spot = new OrientedPoint on lane.centerline +# vending_spot = new OrientedPoint following roadDirection from spot for -3 + +# pedestrian = new Pedestrian right of spot by 3, +# with heading 90 deg relative to spot.heading, +# with regionContainedIn None, +# with behavior PedestrianBehavior(PEDESTRIAN_MIN_SPEED, THRESHOLD) + +# vending_machine = new VendingMachine right of vending_spot by 3, +# with heading -90 deg relative to vending_spot.heading, +# with regionContainedIn None + +# ego = new Car following roadDirection from spot for Range(-30, -20), +# with blueprint EGO_MODEL, +# with behavior EgoBehavior(EGO_SPEED) + +# require (distance to intersection) > 40 +# require (ego.laneSection._slowerLane is None) +# terminate when (distance to spot) > 50 \ No newline at end of file diff --git a/examples/carla/test2.scenic b/examples/carla/test2.scenic new file mode 100644 index 000000000..80133b914 --- /dev/null +++ b/examples/carla/test2.scenic @@ -0,0 +1,15 @@ +param map = localPath('../../assets/maps/CARLA/Town10HD_Opt.xodr') +model scenic.simulators.carla.model +param carla_map = "Town10HD_Opt" +param time_step = 1.0/10 + + +behavior DriveFullThrottle(): + while True: + take SetThrottleAction(1) + +ego = new Car at (-42, -137), + with behavior DriveFullThrottle, + with blueprint "vehicle.nissan.patrol" + +terminate after 8 seconds \ No newline at end of file diff --git a/examples/carla/test3.scenic b/examples/carla/test3.scenic new file mode 100644 index 000000000..0e3305ef0 --- /dev/null +++ b/examples/carla/test3.scenic @@ -0,0 +1,15 @@ +param map = localPath('../../assets/maps/CARLA/Town10HD_Opt.xodr') +model scenic.simulators.carla.model +param carla_map = "Town10HD_Opt" +param time_step = 1.0/10 + +behavior CrossStreet(): + while True: + take SetWalkingDirectionAction(self.heading), SetWalkingSpeedAction(1) + +ego = new Car at (-42, -137) + +ped = new Pedestrian at (-35, -145.30), with regionContainedIn None, + with heading ego.heading + 90 deg, + with behavior CrossStreet() + diff --git a/examples/carla/test_ped_script.py b/examples/carla/test_ped_script.py new file mode 100644 index 000000000..d074b06ca --- /dev/null +++ b/examples/carla/test_ped_script.py @@ -0,0 +1,48 @@ +import scenic +import math +from scenic.simulators.carla import CarlaSimulator + +code = f""" +param map = "assets/maps/CARLA/Town10HD_Opt.xodr" +model scenic.simulators.carla.model +param carla_map = "Town10HD_Opt" +param time_step = 1.0/10 + +behavior CrossStreet(): + while True: + take SetWalkingDirectionAction(self.heading), SetWalkingSpeedAction(1) + +ego = new Car at (-42, -137) + +ped = new Pedestrian at (-35, -145.30), with regionContainedIn None, + with heading ego.heading + 90 deg, + with behavior CrossStreet() + +record initial ped.position as StartPos +record final ped.position as EndPos +record final ped.speed as PedSpeed +terminate after 8 seconds +""" + +scenario = scenic.scenarioFromString(code, mode2D=True) +scene, _ = scenario.generate() +simulator = CarlaSimulator( + carla_map="Town10HD_Opt", + map_path="assets/maps/CARLA/Town10HD_Opt.xodr", +) +# simulation = simulator.simulate(scene, maxSteps=10) +simulation = simulator.simulate(scene,) + +records = simulation.result.records +print("FINAL SPEED: ", records["PedSpeed"]) + + +start_pos = records['StartPos'] +end_pos = records['EndPos'] + +# get distance +dx = end_pos[0] - start_pos[0] +dy = end_pos[1] - start_pos[1] +dist = math.hypot(dx, dy) + +print(f"Traveled {dist:.2f} m in 8 s") \ No newline at end of file diff --git a/examples/carla/test_script.py b/examples/carla/test_script.py new file mode 100644 index 000000000..21ca5a156 --- /dev/null +++ b/examples/carla/test_script.py @@ -0,0 +1,50 @@ +import scenic +import math +from scenic.simulators.carla import CarlaSimulator + +code = f""" +param map = "assets/maps/CARLA/Town10HD_Opt.xodr" +model scenic.simulators.carla.model +param carla_map = "Town10HD_Opt" +param time_step = 1.0/10 + +behavior DriveFullThrottle(): + while True: + take SetThrottleAction(1) + +ego = new Car at (-42, -137), + with behavior DriveFullThrottle, + with blueprint "vehicle.nissan.patrol" + + +record initial ego.position as StartPos +record final ego.position as EndPos +record final ego.speed as CarSpeed +# record ego.speed as SpeedLog +terminate after 8 seconds +""" + +scenario = scenic.scenarioFromString(code, mode2D=True) +scene, _ = scenario.generate() +#simulator = scenario.getSimulator() +simulator = CarlaSimulator( + carla_map="Town10HD_Opt", + map_path="assets/maps/CARLA/Town10HD_Opt.xodr", + timeout=60, +) +# simulation = simulator.simulate(scene, maxSteps=10) +simulation = simulator.simulate(scene,) + +records = simulation.result.records +print("FINAL SPEED: ", records["CarSpeed"]) +# print("SPEED LOG: ", records["SpeedLog"]) + +start_pos = records['StartPos'] +end_pos = records['EndPos'] + +# get distance +dx = end_pos[0] - start_pos[0] +dy = end_pos[1] - start_pos[1] +dist = math.hypot(dx, dy) + +print(f"Traveled {dist:.2f} m in 8 s") \ No newline at end of file diff --git a/examples/carla/trafficLights.scenic b/examples/carla/trafficLights.scenic index 17013211f..6e2143da7 100644 --- a/examples/carla/trafficLights.scenic +++ b/examples/carla/trafficLights.scenic @@ -6,12 +6,12 @@ To run this file using the Carla simulator: """ ## SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc) -param map = localPath('../../assets/maps/CARLA/Town01.xodr') # or other CARLA map that definitely works -param carla_map = 'Town01' +param map = localPath('../../assets/maps/CARLA/Town10HD_Opt.xodr') # or other CARLA map that definitely works +param carla_map = 'Town10HD_Opt' model scenic.simulators.carla.model ## CONSTANTS -EGO_MODEL = "vehicle.lincoln.mkz_2017" +EGO_MODEL = "vehicle.nissan.patrol" EGO_SPEED = 10 ## DEFINING BEHAVIORS diff --git a/src/scenic/core/regions.py b/src/scenic/core/regions.py index 940e050d9..6047ec6ab 100644 --- a/src/scenic/core/regions.py +++ b/src/scenic/core/regions.py @@ -2721,10 +2721,6 @@ def __init__( # Extract vertex cast_pt = toVector(pt) - # Filter out zero distance segments - if last_pt == cast_pt: - continue - if cast_pt not in self.vec_to_vert: self.vec_to_vert[cast_pt] = vertex_iter vertex_iter += 1 diff --git a/src/scenic/simulators/carla/blueprints.py b/src/scenic/simulators/carla/blueprints.py index 1293b1b4e..71854fe7b 100644 --- a/src/scenic/simulators/carla/blueprints.py +++ b/src/scenic/simulators/carla/blueprints.py @@ -1,7 +1,36 @@ -"""CARLA blueprints for cars, pedestrians, etc.""" +""" +CARLA blueprints for cars, pedestrians, etc. + +Defines CARLA Actor blueprints for Scenic, with version-specific overrides. + +At import time we detect the installed CARLA Python package version and +select the appropriate sets of blueprint IDs for vehicles, pedestrians, +props, etc. If a blueprint is renamed in a newer CARLA, we map old names +via `oldBlueprintNames`. + +NOTE: CARLA 0.10.x currently ships *no* bicycle, motorcycle, box or +iron-plate props—those appear only in ≤0.9.x. +""" + +from importlib.metadata import PackageNotFoundError, version + +# --------------------------------------------------------------------------- +# Detect CARLA version +# --------------------------------------------------------------------------- + +try: + carla_pkg_version = version("carla") +except PackageNotFoundError: + # during docs builds or no client installed, assume an older version + carla_pkg_version = "0.0.0" + +is_carla_0_10 = carla_pkg_version.startswith("0.10") + +# --------------------------------------------------------------------------- +# Legacy name mappings +# --------------------------------------------------------------------------- #: Mapping from current names of blueprints to ones in old CARLA versions. -#: #: We provide a tuple of old names in case they change more than once. oldBlueprintNames = { "vehicle.dodge.charger_police": ("vehicle.dodge_charger.police",), @@ -11,61 +40,229 @@ "vehicle.ford.mustang": ("vehicle.mustang.mustang",), } -## Vehicle blueprints - -#: blueprints for cars -carModels = [ - "vehicle.audi.a2", - "vehicle.audi.etron", - "vehicle.audi.tt", - "vehicle.bmw.grandtourer", - "vehicle.chevrolet.impala", - "vehicle.citroen.c3", - "vehicle.dodge.charger_police", - "vehicle.jeep.wrangler_rubicon", - "vehicle.lincoln.mkz_2017", - "vehicle.mercedes.coupe", - "vehicle.mini.cooper_s", - "vehicle.ford.mustang", - "vehicle.nissan.micra", - "vehicle.nissan.patrol", - "vehicle.seat.leon", - "vehicle.tesla.model3", - "vehicle.toyota.prius", - "vehicle.volkswagen.t2", -] - -#: blueprints for bicycles -bicycleModels = [ - "vehicle.bh.crossbike", - "vehicle.diamondback.century", - "vehicle.gazelle.omafiets", -] - -#: blueprints for motorcycles -motorcycleModels = [ - "vehicle.harley-davidson.low_rider", - "vehicle.kawasaki.ninja", - "vehicle.yamaha.yzf", -] - -#: blueprints for trucks -truckModels = [ - "vehicle.carlamotors.carlacola", - "vehicle.tesla.cybertruck", -] - -## Prop blueprints - -#: blueprints for trash cans -trashModels = [ - "static.prop.trashcan01", - "static.prop.trashcan02", - "static.prop.trashcan03", - "static.prop.trashcan04", - "static.prop.trashcan05", - "static.prop.bin", -] +# --------------------------------------------------------------------------- +# Version-specific blueprint lists +# --------------------------------------------------------------------------- + +if is_carla_0_10: + # -- CARLA 0.10.x ------------------------------------------------------- + + #: blueprints for cars in CARLA 0.10.x + carModels = [ + "vehicle.taxi.ford", + "vehicle.dodgecop.charger", + "vehicle.dodge.charger", + "vehicle.nissan.patrol", + "vehicle.mini.cooper", + "vehicle.lincoln.mkz", + ] + + #: blueprints for trucks in CARLA 0.10.x + truckModels = [ + "vehicle.ambulance.ford", + "vehicle.sprinter.mercedes", + "vehicle.fuso.mitsubishi", + "vehicle.carlacola.actors", + "vehicle.firetruck.actors", + ] + + #: blueprints for trash cans in CARLA 0.10.x + trashModels = [ + "static.prop.trashcan01", + "static.prop.trashcan02", + "static.prop.trashcan03", + "static.prop.trashcan04", + ] + + #: blueprints for containers in CARLA 0.10.x + containerModels = [ + "static.prop.container", + ] + + #: blueprints for tables in CARLA 0.10.x + tableModels = [ + "static.prop.plastictable", + ] + + #: blueprints for flowerpots in CARLA 0.10.x + plantpotModels = [ + "static.prop.plantpot01", + "static.prop.plantpot02", + "static.prop.plantpot03", + "static.prop.plantpot04", + "static.prop.plantpot05", + "static.prop.plantpot06", + "static.prop.plantpot07", + ] + + #: blueprints for creased boxes in CARLA 0.10.x + creasedboxModels = [ + "static.prop.creasedbox01", + ] + + #: blueprints for benches in CARLA 0.10.x + benchModels = [ + "static.prop.bench01", + "static.prop.bench02", + ] + + #: blueprints for pedestrians in CARLA 0.10.x + walkerModels = [ + "walker.pedestrian.0015", + "walker.pedestrian.0016", + "walker.pedestrian.0017", + "walker.pedestrian.0018", + "walker.pedestrian.0019", + "walker.pedestrian.0020", + "walker.pedestrian.0021", + "walker.pedestrian.0022", + "walker.pedestrian.0023", + "walker.pedestrian.0024", + "walker.pedestrian.0025", + "walker.pedestrian.0026", + "walker.pedestrian.0027", + "walker.pedestrian.0028", + ] + + #: blueprints for bicycles (none in 0.10.x) + bicycleModels = [] + + #: blueprints for motorcycles (none in 0.10.x) + motorcycleModels = [] + + #: blueprints for boxes (none in 0.10.x) + boxModels = [] + + #: blueprints for iron plates (none in 0.10.x) + ironplateModels = [] + +else: + # -- CARLA ≤0.9.x ------------------------------------------------------- + + #: blueprints for cars + carModels = [ + "vehicle.audi.a2", + "vehicle.audi.etron", + "vehicle.audi.tt", + "vehicle.bmw.grandtourer", + "vehicle.chevrolet.impala", + "vehicle.citroen.c3", + "vehicle.dodge.charger_police", + "vehicle.jeep.wrangler_rubicon", + "vehicle.lincoln.mkz_2017", + "vehicle.mercedes.coupe", + "vehicle.mini.cooper_s", + "vehicle.ford.mustang", + "vehicle.nissan.micra", + "vehicle.nissan.patrol", + "vehicle.seat.leon", + "vehicle.tesla.model3", + "vehicle.toyota.prius", + "vehicle.volkswagen.t2", + ] + + #: blueprints for trucks + truckModels = [ + "vehicle.carlamotors.carlacola", + "vehicle.tesla.cybertruck", + ] + + #: blueprints for trash cans + trashModels = [ + "static.prop.trashcan01", + "static.prop.trashcan02", + "static.prop.trashcan03", + "static.prop.trashcan04", + "static.prop.trashcan05", + "static.prop.bin", + ] + + #: blueprints for containers + containerModels = [ + "static.prop.container", + "static.prop.clothcontainer", + "static.prop.glasscontainer", + ] + + #: blueprints for tables + tableModels = [ + "static.prop.table", + "static.prop.plastictable", + ] + + #: blueprints for flowerpots + plantpotModels = [ + "static.prop.plantpot01", + "static.prop.plantpot02", + "static.prop.plantpot03", + "static.prop.plantpot04", + "static.prop.plantpot05", + "static.prop.plantpot06", + "static.prop.plantpot07", + "static.prop.plantpot08", + ] + + #: blueprints for creased boxes + creasedboxModels = [ + "static.prop.creasedbox01", + "static.prop.creasedbox02", + "static.prop.creasedbox03", + ] + + #: blueprints for benches + benchModels = [ + "static.prop.bench01", + "static.prop.bench02", + "static.prop.bench03", + ] + + #: blueprints for pedestrians + walkerModels = [ + "walker.pedestrian.0001", + "walker.pedestrian.0002", + "walker.pedestrian.0003", + "walker.pedestrian.0004", + "walker.pedestrian.0005", + "walker.pedestrian.0006", + "walker.pedestrian.0007", + "walker.pedestrian.0008", + "walker.pedestrian.0009", + "walker.pedestrian.0010", + "walker.pedestrian.0011", + "walker.pedestrian.0012", + "walker.pedestrian.0013", + "walker.pedestrian.0014", + ] + + #: blueprints for bicycles + bicycleModels = [ + "vehicle.bh.crossbike", + "vehicle.diamondback.century", + "vehicle.gazelle.omafiets", + ] + + #: blueprints for motorcycles + motorcycleModels = [ + "vehicle.harley-davidson.low_rider", + "vehicle.kawasaki.ninja", + "vehicle.yamaha.yzf", + ] + + #: blueprints for boxes + boxModels = [ + "static.prop.box01", + "static.prop.box02", + "static.prop.box03", + ] + + #: blueprints for iron plates + ironplateModels = [ + "static.prop.ironplank", + ] + +# --------------------------------------------------------------------------- +# Models shared by all versions +# --------------------------------------------------------------------------- #: blueprints for traffic cones coneModels = [ @@ -117,19 +314,6 @@ "static.prop.trashbag", ] -#: blueprints for containers -containerModels = [ - "static.prop.container", - "static.prop.clothcontainer", - "static.prop.glasscontainer", -] - -#: blueprints for tables -tableModels = [ - "static.prop.table", - "static.prop.plastictable", -] - #: blueprints for traffic barriers barrierModels = [ "static.prop.streetbarrier", @@ -137,18 +321,6 @@ "static.prop.chainbarrierend", ] -#: blueprints for flowerpots -plantpotModels = [ - "static.prop.plantpot01", - "static.prop.plantpot02", - "static.prop.plantpot03", - "static.prop.plantpot04", - "static.prop.plantpot05", - "static.prop.plantpot06", - "static.prop.plantpot07", - "static.prop.plantpot08", -] - #: blueprints for mailboxes mailboxModels = [ "static.prop.mailbox", @@ -159,13 +331,6 @@ "static.prop.gnome", ] -#: blueprints for creased boxes -creasedboxModels = [ - "static.prop.creasedbox01", - "static.prop.creasedbox02", - "static.prop.creasedbox03", -] - #: blueprints for briefcases, suitcases, etc. caseModels = [ "static.prop.travelcase", @@ -173,20 +338,6 @@ "static.prop.guitarcase", ] -#: blueprints for boxes -boxModels = [ - "static.prop.box01", - "static.prop.box02", - "static.prop.box03", -] - -#: blueprints for benches -benchModels = [ - "static.prop.bench01", - "static.prop.bench02", - "static.prop.bench03", -] - #: blueprints for barrels barrelModels = [ "static.prop.barrel", @@ -202,32 +353,7 @@ "static.prop.kiosk_01", ] -#: blueprints for iron plates -ironplateModels = [ - "static.prop.ironplank", -] - #: blueprints for traffic warning signs trafficwarningModels = [ "static.prop.trafficwarning", ] - -## Walker blueprints - -#: blueprints for pedestrians -walkerModels = [ - "walker.pedestrian.0001", - "walker.pedestrian.0002", - "walker.pedestrian.0003", - "walker.pedestrian.0004", - "walker.pedestrian.0005", - "walker.pedestrian.0006", - "walker.pedestrian.0007", - "walker.pedestrian.0008", - "walker.pedestrian.0009", - "walker.pedestrian.0010", - "walker.pedestrian.0011", - "walker.pedestrian.0012", - "walker.pedestrian.0013", - "walker.pedestrian.0014", -] diff --git a/src/scenic/simulators/carla/model.scenic b/src/scenic/simulators/carla/model.scenic index 66433de53..f7448ce52 100644 --- a/src/scenic/simulators/carla/model.scenic +++ b/src/scenic/simulators/carla/model.scenic @@ -19,7 +19,7 @@ Global Parameters: interrupts CARLA to run behaviors, check requirements, etc.), in seconds. Default is 0.1 seconds. snapToGroundDefault (bool): Default value for :prop:`snapToGround` on `CarlaActor` objects. - Default is True if :ref:`2D compatibility mode` is enabled and False otherwise. + Default is True if :ref:`2D compatibility mode` is enabled and False otherwise. weather (str or dict): Weather to use for the simulation. Can be either a string identifying one of the CARLA weather presets (e.g. 'ClearSunset') or a @@ -30,7 +30,7 @@ Global Parameters: (127.0.0.1). port (int): Port on which to connect to CARLA. Default is 2000. timeout (float): Maximum time to wait when attempting to connect to CARLA, in - seconds. Default is 10. + seconds. Default is 60. render (int): Whether or not to have CARLA create a window showing the simulations from the point of view of the ego object: 1 for yes, 0 @@ -76,7 +76,7 @@ map_town = pathlib.Path(globalParameters.map).stem param carla_map = map_town param address = '127.0.0.1' param port = 2000 -param timeout = 10 +param timeout = 60 param render = 1 if globalParameters.render not in [0, 1]: raise ValueError('render param must be either 0 or 1') @@ -187,16 +187,30 @@ class Car(Vehicle): class NPCCar(Car): # no distinction between these in CARLA pass -class Bicycle(Vehicle): - width: 1 - length: 2 - blueprint: Uniform(*blueprints.bicycleModels) - - -class Motorcycle(Vehicle): - width: 1 - length:2 - blueprint: Uniform(*blueprints.motorcycleModels) +if blueprints.bicycleModels: + class Bicycle(Vehicle): + width: 1 + length: 2 + blueprint: Uniform(*blueprints.bicycleModels) +else: + class Bicycle(Vehicle): + def __init__(self, *args, **kwargs): + raise RuntimeError( + f"'Bicycle' object cannot be used: no bicycle blueprints available in CARLA {blueprints.carla_pkg_version}." + ) + + +if blueprints.motorcycleModels: + class Motorcycle(Vehicle): + width: 1 + length:2 + blueprint: Uniform(*blueprints.motorcycleModels) +else: + class Motorcycle(Vehicle): + def __init__(self, *args, **kwargs): + raise RuntimeError( + f"'Motorcycle' object cannot be used: no motorcycle blueprints available in CARLA {blueprints.carla_pkg_version}." + ) class Truck(Vehicle): @@ -221,6 +235,10 @@ class Pedestrian(Pedestrian, CarlaActor, Walks, _CarlaPedestrian): self.control.direction = _utils.scenicToCarlaVector3D(*direction) def setWalkingSpeed(self, speed): + # if blueprints.is_carla_0_10: + # speed *= 3.6 + # if blueprints.carla_pkg_version == "0.9.15": + # speed /= 10 self.control.speed = speed @@ -302,8 +320,15 @@ class Case(Prop): blueprint: Uniform(*blueprints.caseModels) -class Box(Prop): - blueprint: Uniform(*blueprints.boxModels) +if blueprints.boxModels: + class Box(Prop): + blueprint: Uniform(*blueprints.boxModels) +else: + class Box(Prop): + def __init__(self, *args, **kwargs): + raise RuntimeError( + f"'Box' object cannot be used: no box blueprints available in CARLA {blueprints.carla_pkg_version}." + ) class Bench(Prop): @@ -322,8 +347,15 @@ class Kiosk(Prop): blueprint: Uniform(*blueprints.kioskModels) -class IronPlate(Prop): - blueprint: Uniform(*blueprints.ironplateModels) +if blueprints.ironplateModels: + class IronPlate(Prop): + blueprint: Uniform(*blueprints.ironplateModels) +else: + class IronPlate(Prop): + def __init__(self, *args, **kwargs): + raise RuntimeError( + f"'Iron plate' object cannot be used: no iron plate blueprints available in CARLA {blueprints.carla_pkg_version}." + ) class TrafficWarning(Prop): @@ -411,7 +443,7 @@ def setClosestTrafficLightStatus(vehicle, color, distance=100): color = _utils.scenicToCarlaTrafficLightStatus(color) if color is None: raise RuntimeError('Color must be red/yellow/green/off/unknown.') - + traffic_light = _getClosestTrafficLight(vehicle, distance) if traffic_light is not None: traffic_light.set_state(color) diff --git a/src/scenic/simulators/carla/simulator.py b/src/scenic/simulators/carla/simulator.py index 6469281d7..f90ea990b 100644 --- a/src/scenic/simulators/carla/simulator.py +++ b/src/scenic/simulators/carla/simulator.py @@ -17,6 +17,10 @@ import pygame from scenic.core.simulators import SimulationCreationError +from scenic.domains.driving.controllers import ( + PIDLateralController, + PIDLongitudinalController, +) from scenic.domains.driving.simulators import DrivingSimulation, DrivingSimulator from scenic.simulators.carla.blueprints import oldBlueprintNames import scenic.simulators.carla.utils.utils as utils @@ -33,7 +37,7 @@ def __init__( map_path, address="127.0.0.1", port=2000, - timeout=10, + timeout=60, render=True, record="", timestep=0.1, @@ -46,6 +50,8 @@ def __init__( if carla_map is not None: try: self.world = self.client.load_world(carla_map) + # self.world = self.client.get_world() + # print("CURRENT CARLA MAP: ", self.world.get_map().name) except Exception as e: raise RuntimeError(f"CARLA could not load world '{carla_map}'") from e else: @@ -154,7 +160,9 @@ def setup(self): self.cameraManager = visuals.CameraManager(self.world, egoActor, self.hud) self.cameraManager._transform_index = camPosIndex self.cameraManager.set_sensor(camIndex) - self.cameraManager.set_transform(self.camTransform) + if self.client.get_server_version() != "0.10.0": + self.cameraManager.set_transform(self.camTransform) + # self.cameraManager.set_transform(self.camTransform) self.world.tick() ## allowing manualgearshift to take effect # TODO still need this? @@ -224,7 +232,7 @@ def createObjectInSimulator(self, obj): if carlaActor is None: raise SimulationCreationError(f"Unable to spawn object {obj}") obj.carlaActor = carlaActor - + carlaActor.set_simulate_physics(obj.physics) if isinstance(carlaActor, carla.Vehicle): @@ -302,6 +310,9 @@ def getProperties(self, obj, properties): return values def destroy(self): + # Tick once so CARLA registers any pending spawns, allowing destroy() to clean them up after a partial spawn failure. + self.world.tick() + for obj in self.objects: if obj.carlaActor is not None: if isinstance(obj.carlaActor, carla.Vehicle): @@ -310,6 +321,7 @@ def destroy(self): obj.carlaController.stop() obj.carlaController.destroy() obj.carlaActor.destroy() + if self.render and self.cameraManager: self.cameraManager.destroy_sensor() @@ -317,3 +329,53 @@ def destroy(self): self.world.tick() super().destroy() + + def getLaneFollowingControllers(self, agent): + if self.client.get_server_version() == "0.10.0": + dt = self.timestep + if agent.isCar: + lon_controller = PIDLongitudinalController( + K_P=1.0, K_D=0.2, K_I=1.4, dt=dt + ) + lat_controller = PIDLateralController(K_P=1.0, K_D=0.2, K_I=0.0, dt=dt) + else: + lon_controller = PIDLongitudinalController( + K_P=0.5, K_D=0.05, K_I=0.0, dt=dt + ) + lat_controller = PIDLateralController(K_P=1.0, K_D=0.2, K_I=0.0, dt=dt) + return lon_controller, lat_controller + return super().getLaneFollowingControllers(agent) + + def getTurningControllers(self, agent): + """Get longitudinal and lateral controllers for turning.""" + if self.client.get_server_version() == "0.10.0": + dt = self.timestep + if agent.isCar: + lon_controller = PIDLongitudinalController( + K_P=1.0, K_D=0.2, K_I=1.4, dt=dt + ) + lat_controller = PIDLateralController(K_P=2.0, K_D=0.2, K_I=0.0, dt=dt) + else: + lon_controller = PIDLongitudinalController( + K_P=0.5, K_D=0.05, K_I=0.0, dt=dt + ) + lat_controller = PIDLateralController(K_P=2.0, K_D=0.2, K_I=0.0, dt=dt) + return lon_controller, lat_controller + return super().getTurningControllers(agent) + + def getLaneChangingControllers(self, agent): + """Get longitudinal and lateral controllers for lane changing.""" + if self.client.get_server_version() == "0.10.0": + dt = self.timestep + if agent.isCar: + lon_controller = PIDLongitudinalController( + K_P=1.0, K_D=0.2, K_I=1.4, dt=dt + ) + lat_controller = PIDLateralController(K_P=0.08, K_D=0.3, K_I=0.0, dt=dt) + else: + lon_controller = PIDLongitudinalController( + K_P=0.5, K_D=0.05, K_I=0.0, dt=dt + ) + lat_controller = PIDLateralController(K_P=0.1, K_D=0.3, K_I=0.0, dt=dt) + return lon_controller, lat_controller + return super().getLaneChangingControllers(agent) diff --git a/src/scenic/simulators/carla/utils/visuals.py b/src/scenic/simulators/carla/utils/visuals.py index 4995c0ee9..c73e832e3 100644 --- a/src/scenic/simulators/carla/utils/visuals.py +++ b/src/scenic/simulators/carla/utils/visuals.py @@ -271,6 +271,7 @@ def __init__(self, world, actor, hud): self._surface = None self._actor = actor self._hud = hud + self.images = [] self._camera_transforms = [ carla.Transform(carla.Location(x=-5.5, z=2.8), carla.Rotation(pitch=-15)), carla.Transform(carla.Location(x=1.6, z=1.7)), @@ -364,6 +365,7 @@ def _parse_image(weak_self, image): array = array[:, :, :3] array = array[:, :, ::-1] self._surface = pygame.surfarray.make_surface(array.swapaxes(0, 1)) + self.images.append(image) def destroy_sensor(self): if self.sensor is not None: diff --git a/tests/core/test_regions.py b/tests/core/test_regions.py index 2f1f0dc8a..ca5a7adb7 100644 --- a/tests/core/test_regions.py +++ b/tests/core/test_regions.py @@ -724,33 +724,6 @@ def test_mesh_path_intersection(): assert r2.containsPoint(point) -def test_polygonal_footprint_path_intersection(): - polyline_list = [] - - for z in range(-2, 3): - polyline_list.append([]) - target_list = polyline_list[-1] - for y in range(-5, 6, 2): - for x in range(-5, 6, 2): - target_list.append((x, y, 0)) - target_list.append((x, y + 1, 0)) - target_list.append((x + 1, y + 1, 0)) - target_list.append((x + 1, y, 0)) - - r1 = PathRegion(polylines=polyline_list) - r2 = CircularRegion((0, 0), 5) - - r = r1.intersect(r2.footprint) - - assert isinstance(r, PathRegion) - - for _ in range(100): - point = r.uniformPointInner() - assert r.containsPoint(point) - assert r1.containsPoint(point) - assert r2.containsPoint(point) - - def test_pointset_region(): PointSetRegion("foo", [(1, 2), (3, 4), (5, 6)]) PointSetRegion("bar", [(1, 2, 1), (3, 4, 2), (5, 6, 3)]) diff --git a/tests/simulators/carla/test_actions.py b/tests/simulators/carla/test_actions.py index 7914ad04a..3dc4dbce6 100644 --- a/tests/simulators/carla/test_actions.py +++ b/tests/simulators/carla/test_actions.py @@ -14,12 +14,13 @@ except ModuleNotFoundError: pytest.skip("carla package not installed", allow_module_level=True) +from scenic.simulators.carla.blueprints import is_carla_0_10 from tests.utils import compileScenic, sampleScene def checkCarlaPath(): - CARLA_ROOT = os.environ.get("CARLA_ROOT") - if not CARLA_ROOT: + CARLA_ROOT = Path(os.environ.get("CARLA_ROOT", "")) + if not CARLA_ROOT.exists(): pytest.skip("CARLA_ROOT env variable not set.") return CARLA_ROOT @@ -39,11 +40,24 @@ def getCarlaSimulator(getAssetPath): carla_process = None if not isCarlaServerRunning(): CARLA_ROOT = checkCarlaPath() + # decide which startup script to use + ue_script = ( + "CarlaUnreal.sh" + if (CARLA_ROOT / "CarlaUnreal.sh").exists() + else "CarlaUE4.sh" + ) + # and which binary to kill later + exec_name = ( + "CarlaUnreal-Linux-Shipping" + if ue_script == "CarlaUnreal.sh" + else "CarlaUE4-Linux-Shipping" + ) + carla_process = subprocess.Popen( - f"bash {CARLA_ROOT}/CarlaUE4.sh -RenderOffScreen", shell=True + f"bash {CARLA_ROOT / ue_script} -RenderOffScreen", shell=True ) - for _ in range(180): + for _ in range(600): if isCarlaServerRunning(): break time.sleep(1) @@ -55,7 +69,10 @@ def getCarlaSimulator(getAssetPath): base = getAssetPath("maps/CARLA") - def _getCarlaSimulator(town): + def _getCarlaSimulator(town=None): + if town is None: + town = "Town10HD_Opt" if is_carla_0_10 else "Town01" + path = os.path.join(base, f"{town}.xodr") simulator = CarlaSimulator(map_path=path, carla_map=town, timeout=180) return simulator, town, path @@ -63,11 +80,11 @@ def _getCarlaSimulator(town): yield _getCarlaSimulator if carla_process: - subprocess.run("killall -9 CarlaUE4-Linux-Shipping", shell=True) + subprocess.run(f"killall -9 {exec_name}", shell=True) def test_throttle(getCarlaSimulator): - simulator, town, mapPath = getCarlaSimulator("Town01") + simulator, town, mapPath = getCarlaSimulator() code = f""" param map = r'{mapPath}' param carla_map = '{town}' @@ -79,7 +96,7 @@ def test_throttle(getCarlaSimulator): while True: take SetThrottleAction(1) - ego = new Car at (369, -326), with behavior DriveWithThrottle + ego = new Car at (-3.3, -68), with behavior DriveWithThrottle record ego.speed as CarSpeed terminate after 5 steps """ @@ -91,7 +108,7 @@ def test_throttle(getCarlaSimulator): def test_brake(getCarlaSimulator): - simulator, town, mapPath = getCarlaSimulator("Town01") + simulator, town, mapPath = getCarlaSimulator() code = f""" param map = r'{mapPath}' param carla_map = '{town}' @@ -111,8 +128,8 @@ def test_brake(getCarlaSimulator): do DriveWithThrottle() for 2 steps do Brake() for 6 steps - ego = new Car at (369, -326), - with blueprint 'vehicle.toyota.prius', + ego = new Car at (-3.3, -68), + with blueprint 'vehicle.nissan.patrol', with behavior DriveThenBrake record final ego.speed as CarSpeed terminate after 8 steps @@ -121,4 +138,4 @@ def test_brake(getCarlaSimulator): scene = sampleScene(scenario) simulation = simulator.simulate(scene) finalSpeed = simulation.result.records["CarSpeed"] - assert finalSpeed == pytest.approx(0.0, abs=1e-1) + assert finalSpeed == pytest.approx(0.0, abs=2e-1) \ No newline at end of file diff --git a/tests/simulators/carla/test_blueprints.py b/tests/simulators/carla/test_blueprints.py index 4b7dcba25..8bba64e63 100644 --- a/tests/simulators/carla/test_blueprints.py +++ b/tests/simulators/carla/test_blueprints.py @@ -47,7 +47,10 @@ def model_blueprint(simulator, mapPath, town, modelType, modelName): param time_step = 1.0/10 model scenic.simulators.carla.model - ego = new {modelType} with blueprint '{modelName}' + ego = new {modelType} with blueprint '{modelName}', + # at (-107.52, -50.87), + at (-3.3, -68), + with regionContainedIn None terminate after 1 steps """ scenario = compileScenic(code, mode2D=True) @@ -88,11 +91,10 @@ def model_blueprint(simulator, mapPath, town, modelType, modelName): "Pedestrian": walkerModels, } - @pytest.mark.parametrize( "modelType, modelName", [(type, name) for type, names in model_data.items() for name in names], ) def test_model_blueprints(getCarlaSimulator, modelType, modelName): - simulator, town, mapPath = getCarlaSimulator("Town01") + simulator, town, mapPath = getCarlaSimulator() model_blueprint(simulator, mapPath, town, modelType, modelName) From 48708756d6ceb6cc90f41425c485489d04ba8705 Mon Sep 17 00:00:00 2001 From: Lola Marrero Date: Fri, 11 Jul 2025 16:17:24 -0700 Subject: [PATCH 2/3] clean up code --- docs/simulators.rst | 18 ++-- examples/carla/check_across_runs.py | 56 ------------ examples/carla/test.scenic | 90 -------------------- examples/carla/test2.scenic | 15 ---- examples/carla/test3.scenic | 15 ---- examples/carla/test_ped_script.py | 48 ----------- examples/carla/test_script.py | 50 ----------- src/scenic/simulators/carla/model.scenic | 4 - src/scenic/simulators/carla/simulator.py | 7 +- src/scenic/simulators/carla/utils/visuals.py | 2 - tests/simulators/carla/test_blueprints.py | 2 +- 11 files changed, 9 insertions(+), 298 deletions(-) delete mode 100644 examples/carla/check_across_runs.py delete mode 100644 examples/carla/test.scenic delete mode 100644 examples/carla/test2.scenic delete mode 100644 examples/carla/test3.scenic delete mode 100644 examples/carla/test_ped_script.py delete mode 100644 examples/carla/test_script.py diff --git a/docs/simulators.rst b/docs/simulators.rst index bd2a48d1d..14bf5e67d 100644 --- a/docs/simulators.rst +++ b/docs/simulators.rst @@ -111,18 +111,12 @@ We suggest upgrading to a newer version of CARLA so that you can use :command:`p To start CARLA, run the command :command:`./CarlaUE4.sh` in your CARLA folder (for **CARLA 0.10.0**, use :command:`./CarlaUnreal.sh` instead). Once CARLA is running, you can run dynamic Scenic scenarios following the instructions in :ref:`the dynamics tutorial `. -.. note:: - - All scenarios in ``examples/carla`` run unmodified on both CARLA 0.9.x and 0.10.0 - (except **carlaChallenge4**, which uses a bicycle blueprint removed in 0.10.0). - Only the upgraded **Town10HD_Opt** map is supported in 0.10.0. - - If you write new scenarios against CARLA 0.10.0, remember the blueprint library - has changed. It’s a good idea to inspect which blueprints are available before - selecting your IDs:: - - client.get_world().get_blueprint_library() - +.. note:: CARLA 0.10.0 compatibility + + - All ``examples/carla`` scenarios now support both CARLA 0.9.x and 0.10.0. + - Only the **Town10HD_Opt** map is available in 0.10.0. + - The 0.10.0 blueprint library is different (for example, bicycle blueprints are currently unavailable). + - There are some differences in physics in 0.10.0 (for example, pedestrians movement is slower). Grand Theft Auto V diff --git a/examples/carla/check_across_runs.py b/examples/carla/check_across_runs.py deleted file mode 100644 index 1b30ebe61..000000000 --- a/examples/carla/check_across_runs.py +++ /dev/null @@ -1,56 +0,0 @@ -import random -import math -import scenic -from scenic.simulators.carla import CarlaSimulator - -code = """ -param map = "assets/maps/CARLA/Town10HD_Opt.xodr" -model scenic.simulators.carla.model -param carla_map = "Town10HD_Opt" -param time_step = 1.0/10 -param weather = "HardRainNoon" - -behavior DriveFullThrottle(): - while True: - take SetThrottleAction(1) - -ego = new Car at (-42, -137), - with behavior DriveFullThrottle, - with blueprint "vehicle.nissan.patrol" - -record initial ego.position as StartPos -record final ego.position as EndPos -record final ego.speed as CarSpeed -terminate after 8 seconds -""" - -def run_one(seed): - random.seed(seed) - scenario = scenic.scenarioFromString(code, mode2D=True) - scene, _ = scenario.generate() - - sim = CarlaSimulator( - carla_map="Town10HD_Opt", - map_path="assets/maps/CARLA/Town10HD_Opt.xodr", - ) - recs = sim.simulate(scene).result.records - - start_pos = recs["StartPos"] - end_pos = recs["EndPos"] - dx = end_pos[0] - start_pos[0] - dy = end_pos[1] - start_pos[1] - return math.hypot(dx, dy) - -def run_multiple(seed, runs=20): - print(f"== Running seed {seed} for {runs} runs ==") - distances = [] - for i in range(1, runs + 1): - dist = run_one(seed) - distances.append(dist) - print(f"Run {i:2d}: {dist:.2f} m") - return distances - -if __name__ == "__main__": - SEED = 52 - TRIALS = 30 - run_multiple(SEED, TRIALS) diff --git a/examples/carla/test.scenic b/examples/carla/test.scenic deleted file mode 100644 index 19ea41ebc..000000000 --- a/examples/carla/test.scenic +++ /dev/null @@ -1,90 +0,0 @@ -param map = localPath('../../assets/maps/CARLA/Town10HD_Opt.xodr') -model scenic.simulators.carla.model -param carla_map = "Town10HD_Opt" -param time_step = 1.0/10 - -# behavior DriveWithThrottle(): -# while True: -# take SetThrottleAction(1) - -# ego = new Car - -# ego = new Car at (369, -326), with behavior DriveWithThrottle - -# ego = new Pedestrian with blueprint "walker.pedestrian.0024", -# with regionContainedIn None, -# at (-107.52, -50.87) - -# ego = new Car at (-3.3, -68), with behavior DriveWithThrottle - # with regionContainedIn None - - -ego = new Car at (-3.57, -66.12), with behavior FollowLaneBehavior(1) - -# """ Scenario Description -# Traffic Scenario 03 (dynamic). -# Obstacle avoidance without prior action. -# The ego-vehicle encounters an obstacle / unexpected entity on the road and must perform an -# emergency brake or an avoidance maneuver. - -# To run this file using the Carla simulator: -# scenic examples/carla/Carla_Challenge/carlaChallenge3_dynamic.scenic --2d --model scenic.simulators.carla.model --simulate -# """ - -# # SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc) -# param map = localPath('../../../assets/maps/CARLA/Town10HD_Opt.xodr') -# param carla_map = 'Town10HD_Opt' -# model scenic.simulators.carla.model - -# # CONSTANTS -# EGO_MODEL = "vehicle.nissan.patrol" -# EGO_SPEED = 6 -# SAFETY_DISTANCE = 10 -# BRAKE_INTENSITY = 1.0 - -# PEDESTRIAN_MIN_SPEED = 2.0 -# THRESHOLD = 30 - -# # EGO BEHAVIOR: Follow lane and brake when reaches threshold distance to obstacle -# behavior EgoBehavior(speed=10): -# try: -# do FollowLaneBehavior(target_speed=speed) -# interrupt when withinDistanceToObjsInLane(self, SAFETY_DISTANCE): -# take SetBrakeAction(BRAKE_INTENSITY) - -# behavior PedestrianBehavior(min_speed=1, threshold=10): -# do CrossingBehavior(ego, min_speed, threshold) - -# ## DEFINING SPATIAL RELATIONS -# # Please refer to scenic/domains/driving/roads.py how to access detailed road infrastructure -# # 'network' is the 'class Network' object in roads.py - -# # collect all the curb-side lanes -# curbLanes = [ -# lg.lanes[0] -# for lg in network.laneGroups -# if lg is lg.road.forwardLanes -# ] - -# # make sure to put '*' to uniformly randomly select from all elements of the list -# lane = Uniform(*curbLanes) - -# spot = new OrientedPoint on lane.centerline -# vending_spot = new OrientedPoint following roadDirection from spot for -3 - -# pedestrian = new Pedestrian right of spot by 3, -# with heading 90 deg relative to spot.heading, -# with regionContainedIn None, -# with behavior PedestrianBehavior(PEDESTRIAN_MIN_SPEED, THRESHOLD) - -# vending_machine = new VendingMachine right of vending_spot by 3, -# with heading -90 deg relative to vending_spot.heading, -# with regionContainedIn None - -# ego = new Car following roadDirection from spot for Range(-30, -20), -# with blueprint EGO_MODEL, -# with behavior EgoBehavior(EGO_SPEED) - -# require (distance to intersection) > 40 -# require (ego.laneSection._slowerLane is None) -# terminate when (distance to spot) > 50 \ No newline at end of file diff --git a/examples/carla/test2.scenic b/examples/carla/test2.scenic deleted file mode 100644 index 80133b914..000000000 --- a/examples/carla/test2.scenic +++ /dev/null @@ -1,15 +0,0 @@ -param map = localPath('../../assets/maps/CARLA/Town10HD_Opt.xodr') -model scenic.simulators.carla.model -param carla_map = "Town10HD_Opt" -param time_step = 1.0/10 - - -behavior DriveFullThrottle(): - while True: - take SetThrottleAction(1) - -ego = new Car at (-42, -137), - with behavior DriveFullThrottle, - with blueprint "vehicle.nissan.patrol" - -terminate after 8 seconds \ No newline at end of file diff --git a/examples/carla/test3.scenic b/examples/carla/test3.scenic deleted file mode 100644 index 0e3305ef0..000000000 --- a/examples/carla/test3.scenic +++ /dev/null @@ -1,15 +0,0 @@ -param map = localPath('../../assets/maps/CARLA/Town10HD_Opt.xodr') -model scenic.simulators.carla.model -param carla_map = "Town10HD_Opt" -param time_step = 1.0/10 - -behavior CrossStreet(): - while True: - take SetWalkingDirectionAction(self.heading), SetWalkingSpeedAction(1) - -ego = new Car at (-42, -137) - -ped = new Pedestrian at (-35, -145.30), with regionContainedIn None, - with heading ego.heading + 90 deg, - with behavior CrossStreet() - diff --git a/examples/carla/test_ped_script.py b/examples/carla/test_ped_script.py deleted file mode 100644 index d074b06ca..000000000 --- a/examples/carla/test_ped_script.py +++ /dev/null @@ -1,48 +0,0 @@ -import scenic -import math -from scenic.simulators.carla import CarlaSimulator - -code = f""" -param map = "assets/maps/CARLA/Town10HD_Opt.xodr" -model scenic.simulators.carla.model -param carla_map = "Town10HD_Opt" -param time_step = 1.0/10 - -behavior CrossStreet(): - while True: - take SetWalkingDirectionAction(self.heading), SetWalkingSpeedAction(1) - -ego = new Car at (-42, -137) - -ped = new Pedestrian at (-35, -145.30), with regionContainedIn None, - with heading ego.heading + 90 deg, - with behavior CrossStreet() - -record initial ped.position as StartPos -record final ped.position as EndPos -record final ped.speed as PedSpeed -terminate after 8 seconds -""" - -scenario = scenic.scenarioFromString(code, mode2D=True) -scene, _ = scenario.generate() -simulator = CarlaSimulator( - carla_map="Town10HD_Opt", - map_path="assets/maps/CARLA/Town10HD_Opt.xodr", -) -# simulation = simulator.simulate(scene, maxSteps=10) -simulation = simulator.simulate(scene,) - -records = simulation.result.records -print("FINAL SPEED: ", records["PedSpeed"]) - - -start_pos = records['StartPos'] -end_pos = records['EndPos'] - -# get distance -dx = end_pos[0] - start_pos[0] -dy = end_pos[1] - start_pos[1] -dist = math.hypot(dx, dy) - -print(f"Traveled {dist:.2f} m in 8 s") \ No newline at end of file diff --git a/examples/carla/test_script.py b/examples/carla/test_script.py deleted file mode 100644 index 21ca5a156..000000000 --- a/examples/carla/test_script.py +++ /dev/null @@ -1,50 +0,0 @@ -import scenic -import math -from scenic.simulators.carla import CarlaSimulator - -code = f""" -param map = "assets/maps/CARLA/Town10HD_Opt.xodr" -model scenic.simulators.carla.model -param carla_map = "Town10HD_Opt" -param time_step = 1.0/10 - -behavior DriveFullThrottle(): - while True: - take SetThrottleAction(1) - -ego = new Car at (-42, -137), - with behavior DriveFullThrottle, - with blueprint "vehicle.nissan.patrol" - - -record initial ego.position as StartPos -record final ego.position as EndPos -record final ego.speed as CarSpeed -# record ego.speed as SpeedLog -terminate after 8 seconds -""" - -scenario = scenic.scenarioFromString(code, mode2D=True) -scene, _ = scenario.generate() -#simulator = scenario.getSimulator() -simulator = CarlaSimulator( - carla_map="Town10HD_Opt", - map_path="assets/maps/CARLA/Town10HD_Opt.xodr", - timeout=60, -) -# simulation = simulator.simulate(scene, maxSteps=10) -simulation = simulator.simulate(scene,) - -records = simulation.result.records -print("FINAL SPEED: ", records["CarSpeed"]) -# print("SPEED LOG: ", records["SpeedLog"]) - -start_pos = records['StartPos'] -end_pos = records['EndPos'] - -# get distance -dx = end_pos[0] - start_pos[0] -dy = end_pos[1] - start_pos[1] -dist = math.hypot(dx, dy) - -print(f"Traveled {dist:.2f} m in 8 s") \ No newline at end of file diff --git a/src/scenic/simulators/carla/model.scenic b/src/scenic/simulators/carla/model.scenic index f7448ce52..6c307aa42 100644 --- a/src/scenic/simulators/carla/model.scenic +++ b/src/scenic/simulators/carla/model.scenic @@ -235,10 +235,6 @@ class Pedestrian(Pedestrian, CarlaActor, Walks, _CarlaPedestrian): self.control.direction = _utils.scenicToCarlaVector3D(*direction) def setWalkingSpeed(self, speed): - # if blueprints.is_carla_0_10: - # speed *= 3.6 - # if blueprints.carla_pkg_version == "0.9.15": - # speed /= 10 self.control.speed = speed diff --git a/src/scenic/simulators/carla/simulator.py b/src/scenic/simulators/carla/simulator.py index f90ea990b..47fc43569 100644 --- a/src/scenic/simulators/carla/simulator.py +++ b/src/scenic/simulators/carla/simulator.py @@ -50,8 +50,6 @@ def __init__( if carla_map is not None: try: self.world = self.client.load_world(carla_map) - # self.world = self.client.get_world() - # print("CURRENT CARLA MAP: ", self.world.get_map().name) except Exception as e: raise RuntimeError(f"CARLA could not load world '{carla_map}'") from e else: @@ -162,7 +160,6 @@ def setup(self): self.cameraManager.set_sensor(camIndex) if self.client.get_server_version() != "0.10.0": self.cameraManager.set_transform(self.camTransform) - # self.cameraManager.set_transform(self.camTransform) self.world.tick() ## allowing manualgearshift to take effect # TODO still need this? @@ -232,7 +229,7 @@ def createObjectInSimulator(self, obj): if carlaActor is None: raise SimulationCreationError(f"Unable to spawn object {obj}") obj.carlaActor = carlaActor - + carlaActor.set_simulate_physics(obj.physics) if isinstance(carlaActor, carla.Vehicle): @@ -312,7 +309,7 @@ def getProperties(self, obj, properties): def destroy(self): # Tick once so CARLA registers any pending spawns, allowing destroy() to clean them up after a partial spawn failure. self.world.tick() - + for obj in self.objects: if obj.carlaActor is not None: if isinstance(obj.carlaActor, carla.Vehicle): diff --git a/src/scenic/simulators/carla/utils/visuals.py b/src/scenic/simulators/carla/utils/visuals.py index c73e832e3..4995c0ee9 100644 --- a/src/scenic/simulators/carla/utils/visuals.py +++ b/src/scenic/simulators/carla/utils/visuals.py @@ -271,7 +271,6 @@ def __init__(self, world, actor, hud): self._surface = None self._actor = actor self._hud = hud - self.images = [] self._camera_transforms = [ carla.Transform(carla.Location(x=-5.5, z=2.8), carla.Rotation(pitch=-15)), carla.Transform(carla.Location(x=1.6, z=1.7)), @@ -365,7 +364,6 @@ def _parse_image(weak_self, image): array = array[:, :, :3] array = array[:, :, ::-1] self._surface = pygame.surfarray.make_surface(array.swapaxes(0, 1)) - self.images.append(image) def destroy_sensor(self): if self.sensor is not None: diff --git a/tests/simulators/carla/test_blueprints.py b/tests/simulators/carla/test_blueprints.py index 8bba64e63..8f195f536 100644 --- a/tests/simulators/carla/test_blueprints.py +++ b/tests/simulators/carla/test_blueprints.py @@ -48,7 +48,6 @@ def model_blueprint(simulator, mapPath, town, modelType, modelName): model scenic.simulators.carla.model ego = new {modelType} with blueprint '{modelName}', - # at (-107.52, -50.87), at (-3.3, -68), with regionContainedIn None terminate after 1 steps @@ -91,6 +90,7 @@ def model_blueprint(simulator, mapPath, town, modelType, modelName): "Pedestrian": walkerModels, } + @pytest.mark.parametrize( "modelType, modelName", [(type, name) for type, names in model_data.items() for name in names], From b4758e0be1a3baa3bce2caddb3a9a00646ac572f Mon Sep 17 00:00:00 2001 From: lola Date: Tue, 15 Jul 2025 12:06:03 -0700 Subject: [PATCH 3/3] update with main --- .github/workflows/weekly-ci-tests.yml | 47 ++++++++++++++++++++++++++ src/scenic/core/regions.py | 4 +++ tests/core/test_regions.py | 27 +++++++++++++++ tests/simulators/carla/test_actions.py | 4 +-- 4 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/weekly-ci-tests.yml diff --git a/.github/workflows/weekly-ci-tests.yml b/.github/workflows/weekly-ci-tests.yml new file mode 100644 index 000000000..da15e1f93 --- /dev/null +++ b/.github/workflows/weekly-ci-tests.yml @@ -0,0 +1,47 @@ +name: Weekly CI tests + +# No permissions needed +permissions: {} + +# Trigger every Thursday at 9:15 AM Pacific Time (16:15 UTC) +on: + schedule: + - cron: '15 16 * * 4' + +jobs: + run-tests: + uses: ./.github/workflows/run-tests.yml + with: + # Use the default branch" (i.e. main) + ref: '' + + notify: + name: Notify Slack + needs: run-tests + runs-on: ubuntu-latest + if: always() + steps: + - name: Post result to Slack + uses: slackapi/slack-github-action@b0fa283ad8fea605de13dc3f449259339835fc52 + with: + webhook: ${{ secrets.SLACK_WEBHOOK_URL}} + webhook-type: incoming-webhook + payload: | + { + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*Weekly CI tests* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|run #${{ github.run_number }}> finished." + } + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "${{ needs.run-tests.result == 'success' && '✅ All tests passed!' || '🚨 Some tests failed!' }}" + } + } + ] + } diff --git a/src/scenic/core/regions.py b/src/scenic/core/regions.py index 6047ec6ab..940e050d9 100644 --- a/src/scenic/core/regions.py +++ b/src/scenic/core/regions.py @@ -2721,6 +2721,10 @@ def __init__( # Extract vertex cast_pt = toVector(pt) + # Filter out zero distance segments + if last_pt == cast_pt: + continue + if cast_pt not in self.vec_to_vert: self.vec_to_vert[cast_pt] = vertex_iter vertex_iter += 1 diff --git a/tests/core/test_regions.py b/tests/core/test_regions.py index ca5a7adb7..2f1f0dc8a 100644 --- a/tests/core/test_regions.py +++ b/tests/core/test_regions.py @@ -724,6 +724,33 @@ def test_mesh_path_intersection(): assert r2.containsPoint(point) +def test_polygonal_footprint_path_intersection(): + polyline_list = [] + + for z in range(-2, 3): + polyline_list.append([]) + target_list = polyline_list[-1] + for y in range(-5, 6, 2): + for x in range(-5, 6, 2): + target_list.append((x, y, 0)) + target_list.append((x, y + 1, 0)) + target_list.append((x + 1, y + 1, 0)) + target_list.append((x + 1, y, 0)) + + r1 = PathRegion(polylines=polyline_list) + r2 = CircularRegion((0, 0), 5) + + r = r1.intersect(r2.footprint) + + assert isinstance(r, PathRegion) + + for _ in range(100): + point = r.uniformPointInner() + assert r.containsPoint(point) + assert r1.containsPoint(point) + assert r2.containsPoint(point) + + def test_pointset_region(): PointSetRegion("foo", [(1, 2), (3, 4), (5, 6)]) PointSetRegion("bar", [(1, 2, 1), (3, 4, 2), (5, 6, 3)]) diff --git a/tests/simulators/carla/test_actions.py b/tests/simulators/carla/test_actions.py index 3dc4dbce6..112250ed5 100644 --- a/tests/simulators/carla/test_actions.py +++ b/tests/simulators/carla/test_actions.py @@ -52,7 +52,7 @@ def getCarlaSimulator(getAssetPath): if ue_script == "CarlaUnreal.sh" else "CarlaUE4-Linux-Shipping" ) - + carla_process = subprocess.Popen( f"bash {CARLA_ROOT / ue_script} -RenderOffScreen", shell=True ) @@ -138,4 +138,4 @@ def test_brake(getCarlaSimulator): scene = sampleScene(scenario) simulation = simulator.simulate(scene) finalSpeed = simulation.result.records["CarSpeed"] - assert finalSpeed == pytest.approx(0.0, abs=2e-1) \ No newline at end of file + assert finalSpeed == pytest.approx(0.0, abs=2e-1)