Skip to content

Commit

Permalink
chore: Updating examples for CARLA and driving domain (#257)
Browse files Browse the repository at this point in the history
* chore: Updating examples for CARLA and driving domain

* chore: fixing comments to illustrate use of carla simulator

---------

Co-authored-by: Armando Bañuelos <[email protected]>
Co-authored-by: Armando Banuelos <[email protected]>
  • Loading branch information
3 people authored Dec 18, 2024
1 parent 9d82eda commit ca74ae9
Show file tree
Hide file tree
Showing 55 changed files with 185 additions and 6 deletions.
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
4 changes: 4 additions & 0 deletions examples/carla/adjacentOpposingPair.scenic
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
'''
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')
model scenic.simulators.carla.model

Expand Down
9 changes: 8 additions & 1 deletion examples/carla/backgroundActivity.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Background Activity
The simulation is filled with vehicles that freely roam around the town.
This simulates normal driving conditions, without any abnormal behaviors
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
Expand All @@ -18,6 +21,10 @@ behavior EgoBehavior(speed=10):
interrupt when withinDistanceToObjsInLane(self, 10):
take SetBrakeAction(1.0)

# PEDESTRIAN BEHAVIOR: cross the street
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
Expand All @@ -36,7 +43,7 @@ background_walkers = []
for _ in range(10):
sideWalk = Uniform(*network.sidewalks)
background_walker = new Pedestrian in sideWalk,
with behavior WalkBehavior()
with behavior PedestrianBehavior()
background_walkers.append(background_walker)


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

Expand Down
Loading

0 comments on commit ca74ae9

Please sign in to comment.