Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,202 changes: 1,202 additions & 0 deletions assets/maps/CARLA/Town10HD_Opt.net.xml

Large diffs are not rendered by default.

17,962 changes: 17,962 additions & 0 deletions assets/maps/CARLA/Town10HD_Opt.xodr

Large diffs are not rendered by default.

22 changes: 19 additions & 3 deletions docs/simulators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,23 @@ Our interface to the `CARLA <https://carla.org/>`_ 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.16) from the `CARLA Release Page <https://github.com/carla-simulator/carla/releases>`_.
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 <https://github.com/carla-simulator/carla/releases>`_.
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 <https://carla-ue5.readthedocs.io/en/latest/start_quickstart/>`_.
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:
Expand Down Expand Up @@ -111,9 +120,16 @@ 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 <dynamics_running_examples>`.

.. 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, car and pedestrian movement is slower).


Grand Theft Auto V
------------------
Expand Down
6 changes: 3 additions & 3 deletions examples/carla/Carla_Challenge/carlaChallenge1.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions examples/carla/Carla_Challenge/carlaChallenge10.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions examples/carla/Carla_Challenge/carlaChallenge2.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
17 changes: 12 additions & 5 deletions examples/carla/Carla_Challenge/carlaChallenge3_dynamic.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions examples/carla/Carla_Challenge/carlaChallenge3_static.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions examples/carla/Carla_Challenge/carlaChallenge4.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/carla/Carla_Challenge/carlaChallenge5.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/carla/Carla_Challenge/carlaChallenge6.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
4 changes: 2 additions & 2 deletions examples/carla/Carla_Challenge/carlaChallenge7.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ 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
Expand Down
9 changes: 4 additions & 5 deletions examples/carla/Carla_Challenge/carlaChallenge8.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions examples/carla/Carla_Challenge/carlaChallenge9.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions examples/carla/NHTSA_Scenarios/bypassing/bypassing_01.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions examples/carla/NHTSA_Scenarios/bypassing/bypassing_02.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -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(2, 4)

Expand Down
6 changes: 3 additions & 3 deletions examples/carla/NHTSA_Scenarios/bypassing/bypassing_03.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions examples/carla/NHTSA_Scenarios/bypassing/bypassing_04.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -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(6, 8)

Expand Down
6 changes: 3 additions & 3 deletions examples/carla/NHTSA_Scenarios/bypassing/bypassing_05.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 #
Expand Down
Loading
Loading