Skip to content

Commit

Permalink
Merge branch 'main' into dfremont_optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
dfremont committed Jan 18, 2025
2 parents d633f10 + dcd0213 commit 9352f85
Show file tree
Hide file tree
Showing 70 changed files with 429 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/on-call-reminder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.12'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.11"]
python-version: ["3.12"]
os: [ubuntu-latest]
extras: ["test-full"]
runs-on: ${{ matrix.os }}
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ jobs:
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest, windows-latest]
extras: ["test", "test-full"]
os: [ubuntu-latest, windows-latest, macos-13, macos-latest]
include:
# Only run slow tests on the latest version of Python
- python-version: "3.12"
slow: true
runs-on: ${{ matrix.os }}

steps:
Expand Down Expand Up @@ -63,8 +66,8 @@ jobs:
- name: Install Scenic and dependencies
run: |
python -m pip install -e ".[${{ matrix.extras }}]"
python -m pip install -e ".[test-full]"
- name: Run pytest
run: |
pytest ${{ inputs.options || '--no-graphics' }}
pytest ${{ inputs.options || (matrix.slow && '--no-graphics' || '--fast --no-graphics') }}
2 changes: 2 additions & 0 deletions docs/simulators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ We have several interfaces to the `Webots robotics simulator <https://cyberbotic
Our main interface provides a generic world model that can be used with any Webots world and supports dynamic scenarios.
See the :file:`examples/webots` folder for example Scenic scenarios and Webots worlds using this interface, and `scenic.simulators.webots` for documentation.

Scenic currently interfaces with Webots versions greater than or equal to 2023a.

Scenic also includes more specialized world models for use with Webots:

* A general model for traffic scenarios, used in `our VerifAI paper`_.
Expand Down
3 changes: 3 additions & 0 deletions examples/carla/Carla_Challenge/carlaChallenge1.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Traffic Scenario 01.
Control loss without previous action.
The ego-vehicle loses control due to bad conditions on the road and it must recover, coming back to
its original lane.
To run this file using the Carla simulator:
scenic examples/carla/Carla_Challenge/carlaChallenge1.scenic --2d --model scenic.simulators.carla.model --simulate
"""

## SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc)
Expand Down
3 changes: 3 additions & 0 deletions examples/carla/Carla_Challenge/carlaChallenge10.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Traffic Scenario 10.
Crossing negotiation at an unsignalized intersection.
The ego-vehicle needs to negotiate with other vehicles to cross an unsignalized intersection. In
this situation it is assumed that the first to enter the intersection has priority.
To run this file using the Carla simulator:
scenic examples/carla/Carla_Challenge/carlaChallenge10.scenic --2d --model scenic.simulators.carla.model --simulate
"""

## SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc)
Expand Down
3 changes: 3 additions & 0 deletions examples/carla/Carla_Challenge/carlaChallenge2.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Traffic Scenario 02.
Longitudinal control after leading vehicle’s brake.
The leading vehicle decelerates suddenly due to an obstacle and the ego-vehicle must perform an
emergency brake or an avoidance maneuver.
To run this file using the Carla simulator:
scenic examples/carla/Carla_Challenge/carlaChallenge2.scenic --2d --model scenic.simulators.carla.model --simulate
"""

## SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc)
Expand Down
3 changes: 3 additions & 0 deletions examples/carla/Carla_Challenge/carlaChallenge3_dynamic.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ 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)
Expand Down
3 changes: 3 additions & 0 deletions examples/carla/Carla_Challenge/carlaChallenge3_static.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Traffic Scenario 03 (static).
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_static.scenic --2d --model scenic.simulators.carla.model --simulate
"""

## SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc)
Expand Down
3 changes: 3 additions & 0 deletions examples/carla/Carla_Challenge/carlaChallenge4.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Traffic Scenario 04.
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/carlaChallenge4.scenic --2d --model scenic.simulators.carla.model --simulate
"""

## SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc)
Expand Down
3 changes: 3 additions & 0 deletions examples/carla/Carla_Challenge/carlaChallenge5.scenic
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
""" Scenario Description
Based on 2019 Carla Challenge Traffic Scenario 05.
Ego-vehicle performs a lane changing to evade a leading vehicle, which is moving too slowly.
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'
Expand Down
3 changes: 3 additions & 0 deletions examples/carla/Carla_Challenge/carlaChallenge6.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Based on CARLA Challenge Scenario 6: https://carlachallenge.org/challenge/nhtsa/
Ego-vehicle must go around a blocking object
using the opposite lane, yielding to oncoming traffic.
To run this file using the Carla simulator:
scenic examples/carla/Carla_Challenge/carlaChallenge6.scenic --2d --model scenic.simulators.carla.model --simulate
"""

# N.B. Town07 is not included with CARLA by default; see installation instructions at
Expand Down
3 changes: 3 additions & 0 deletions examples/carla/Carla_Challenge/carlaChallenge7.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Based on 2019 Carla Challenge Traffic Scenario 07.
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.
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'
Expand Down
3 changes: 3 additions & 0 deletions examples/carla/Carla_Challenge/carlaChallenge8.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Traffic Scenario 08.
Unprotected left turn at intersection with oncoming traffic.
The ego-vehicle is performing an unprotected left turn at an intersection, yielding to oncoming
traffic.
To run this file using the Carla simulator:
scenic examples/carla/Carla_Challenge/carlaChallenge8.scenic --2d --model scenic.simulators.carla.model --simulate
"""

## SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc)
Expand Down
3 changes: 3 additions & 0 deletions examples/carla/Carla_Challenge/carlaChallenge9.scenic
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
""" Scenario Description
Based on 2019 Carla Challenge Traffic Scenario 09.
Ego-vehicle is performing a right turn at an intersection, yielding to crossing traffic.
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'
Expand Down
3 changes: 3 additions & 0 deletions examples/carla/NHTSA_Scenarios/bypassing/bypassing_01.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ AUTHOR: Francis Indaheng, [email protected]
DESCRIPTION: Ego vehicle performs a lane change to bypass a slow
adversary vehicle before returning to its original lane.
SOURCE: NHSTA, #16
To run this file using the Carla simulator:
scenic examples/carla/NHTSA_Scenarios/bypassing/bypassing_01.scenic --2d --model scenic.simulators.carla.model --simulate
"""

#################################
Expand Down
3 changes: 3 additions & 0 deletions examples/carla/NHTSA_Scenarios/bypassing/bypassing_02.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ AUTHOR: Francis Indaheng, [email protected]
DESCRIPTION: Adversary vehicle performs a lane change to bypass the
slow ego vehicle before returning to its original lane.
SOURCE: NHSTA, #16
To run this file using the Carla simulator:
scenic examples/carla/NHTSA_Scenarios/bypassing/bypassing_02.scenic --2d --model scenic.simulators.carla.model --simulate
"""

#################################
Expand Down
3 changes: 3 additions & 0 deletions examples/carla/NHTSA_Scenarios/bypassing/bypassing_03.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ 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
To run this file using the Carla simulator:
scenic examples/carla/NHTSA_Scenarios/bypassing/bypassing_03.scenic --2d --model scenic.simulators.carla.model --simulate
"""

#################################
Expand Down
3 changes: 3 additions & 0 deletions examples/carla/NHTSA_Scenarios/bypassing/bypassing_04.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ AUTHOR: Francis Indaheng, [email protected]
DESCRIPTION: Ego vehicle performs multiple lane changes to bypass
two slow adversary vehicles.
SOURCE: NHSTA, #16
To run this file using the Carla simulator:
scenic examples/carla/NHTSA_Scenarios/bypassing/bypassing_04.scenic --2d --model scenic.simulators.carla.model --simulate
"""

#################################
Expand Down
3 changes: 3 additions & 0 deletions examples/carla/NHTSA_Scenarios/bypassing/bypassing_05.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ AUTHOR: Francis Indaheng, [email protected]
DESCRIPTION: Ego vehicle performs multiple lane changes to bypass three
slow adversary vehicles.
SOURCE: NHSTA, #16
To run this file using the Carla simulator:
scenic examples/carla/NHTSA_Scenarios/bypassing/bypassing_05.scenic --2d --model scenic.simulators.carla.model --simulate
"""

#################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ 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
To run this file using the Carla simulator:
scenic examples/carla/NHTSA_Scenarios/intersection/intersection_01.scenic --2d --model scenic.simulators.carla.model --simulate
"""

#################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ 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
To run this file using the Carla simulator:
scenic examples/carla/NHTSA_Scenarios/intersection/intersection_02.scenic --2d --model scenic.simulators.carla.model --simulate
"""

#################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ 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
To run this file using the Carla simulator:
scenic examples/carla/NHTSA_Scenarios/intersection/intersection_03.scenic --2d --model scenic.simulators.carla.model --simulate
"""

#################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ 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
To run this file using the Carla simulator:
scenic examples/carla/NHTSA_Scenarios/intersection/intersection_04.scenic --2d --model scenic.simulators.carla.model --simulate
"""

#################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ AUTHOR: Francis Indaheng, [email protected]
DESCRIPTION: Ego vehicle makes a right turn at 4-way intersection
while adversary vehicle from opposite lane makes a left turn.
SOURCE: NHSTA, #25
To run this file using the Carla simulator:
scenic examples/carla/NHTSA_Scenarios/intersection/intersection_05.scenic --2d --model scenic.simulators.carla.model --simulate
"""

#################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ AUTHOR: Francis Indaheng, [email protected]
DESCRIPTION: Ego vehicle makes a right turn at 4-way intersection while
adversary vehicle from lateral lane goes straight.
SOURCE: NHSTA, #25 #26
To run this file using the Carla simulator:
scenic examples/carla/NHTSA_Scenarios/intersection/intersection_06.scenic --2d --model scenic.simulators.carla.model --simulate
"""

#################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ 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
To run this file using the Carla simulator:
scenic examples/carla/NHTSA_Scenarios/intersection/intersection_07.scenic --2d --model scenic.simulators.carla.model --simulate
"""

#################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ 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
To run this file using the Carla simulator:
scenic examples/carla/NHTSA_Scenarios/intersection/intersection_08.scenic --2d --model scenic.simulators.carla.model --simulate
"""

#################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ AUTHOR: Francis Indaheng, [email protected]
DESCRIPTION: Ego vehicle makes a right turn at 3-way intersection
while adversary vehicle from lateral lane goes straight.
SOURCE: NHSTA, #28 #29
To run this file using the Carla simulator:
scenic examples/carla/NHTSA_Scenarios/intersection/intersection_09.scenic --2d --model scenic.simulators.carla.model --simulate
"""

#################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ 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
To run this file using the Carla simulator:
scenic examples/carla/NHTSA_Scenarios/intersection/intersection_10.scenic --2d --model scenic.simulators.carla.model --simulate
"""

#################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ AUTHOR: Francis Indaheng, [email protected]
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
"""

#################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ AUTHOR: Francis Indaheng, [email protected]
DESCRIPTION: Both ego and adversary vehicles 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_02.scenic --2d --model scenic.simulators.carla.model --simulate
"""

#################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ AUTHOR: Francis Indaheng, [email protected]
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
To run this file using the Carla simulator:
scenic examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_03.scenic --2d --model scenic.simulators.carla.model --simulate
"""

#################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ AUTHOR: Francis Indaheng, [email protected]
DESCRIPTION: Ego vehicle makes a right turn at an intersection and must
yield when pedestrian crosses the crosswalk.
SOURCE: Carla Challenge, #04
To run this file using the Carla simulator:
scenic examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_04.scenic --2d --model scenic.simulators.carla.model --simulate
"""

#################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ AUTHOR: Francis Indaheng, [email protected]
DESCRIPTION: Ego vehicle goes straight at an intersection and must
yield when pedestrian crosses the crosswalk.
SOURCE: Carla Challenge, #04
To run this file using the Carla simulator:
scenic examples/carla/NHTSA_Scenarios/pedestrian/pedestrian_05.scenic --2d --model scenic.simulators.carla.model --simulate
"""

#################################
Expand Down
3 changes: 3 additions & 0 deletions examples/carla/OAS_Scenarios/oas_scenario_05.scenic
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
""" Scenario Description
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
"""

param map = localPath('../../../assets/maps/CARLA/Town01.xodr') # or other CARLA map that definitely works
Expand Down
3 changes: 3 additions & 0 deletions examples/carla/OAS_Scenarios/oas_scenario_06.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
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
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
"""


Expand Down
5 changes: 5 additions & 0 deletions examples/carla/adjacentLanes.scenic
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
'''
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')
model scenic.simulators.carla.model

Expand Down
Loading

0 comments on commit 9352f85

Please sign in to comment.