Skip to content

Commit

Permalink
fix: defaulting carla_map to map .xodr path in scenic files (#237)
Browse files Browse the repository at this point in the history
* fix: defaulting carla_map to map .xodr path in scenic files

---------

Co-authored-by: Armando Banuelos <abanuelo@Armandos-MacBook-Pro.local>
Co-authored-by: Armando Banuelos <abanuelo@Armandos-MBP.lan>
  • Loading branch information
3 people committed May 7, 2024
1 parent 01af6b1 commit 1924fbc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/scenic/simulators/carla/model.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Global Parameters:
.. _carla.WeatherParameters: https://carla.readthedocs.io/en/latest/python_api/#carlaweatherparameters
"""

import pathlib
from scenic.domains.driving.model import *

import scenic.simulators.carla.blueprints as blueprints
Expand Down Expand Up @@ -70,7 +70,8 @@ except ModuleNotFoundError:
class _CarlaVehicle: pass
class _CarlaPedestrian: pass

param carla_map = None
map_town = pathlib.Path(globalParameters.map).stem
param carla_map = map_town
param address = '127.0.0.1'
param port = 2000
param timeout = 10
Expand Down
11 changes: 11 additions & 0 deletions tests/simulators/carla/test_carla.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@
)


def test_map_param_parse(getAssetPath):
mapPath = getAssetPath("maps/CARLA/Town01.xodr")
code = f"""
param map = r'{mapPath}'
model scenic.simulators.carla.model
ego = new Car
"""
scenario = compileScenic(code, mode2D=True)
assert scenario.params["carla_map"] == "Town01"


def test_basic(loadLocalScenario):
scenario = loadLocalScenario("basic.scenic", mode2D=True)
scenario.generate(maxIterations=1000)
Expand Down

0 comments on commit 1924fbc

Please sign in to comment.