add default values to CarlaMap class and remove copy-pasted ones

This commit is contained in:
danil-tolkachev 2018-06-28 09:57:51 +03:00 committed by Danil Tolkachev
parent 860dbe908e
commit 2d84d24207
4 changed files with 4 additions and 9 deletions

View File

@ -13,12 +13,7 @@ from carla.planner.map import CarlaMap
class CityTrack(object):
def __init__(self, city_name):
# These values are fixed for every city.
self._node_density = 50.0
self._pixel_density = 0.1643
self._map = CarlaMap(city_name, self._pixel_density, self._node_density)
self._map = CarlaMap(city_name)
self._astar = AStar()

View File

@ -31,7 +31,7 @@ def color_to_angle(color):
class CarlaMap(object):
def __init__(self, city, pixel_density, node_density):
def __init__(self, city, pixel_density=0.1643, node_density=50):
dir_path = os.path.dirname(__file__)
city_file = os.path.join(dir_path, city + '.txt')

View File

@ -170,7 +170,7 @@ class CarlaGame(object):
self._on_new_episode()
if self._city_name is not None:
self._map = CarlaMap(self._city_name, 0.1643, 50.0)
self._map = CarlaMap(self._city_name)
self._map_shape = self._map.map_image.shape
self._map_view = self._map.get_map(WINDOW_HEIGHT)

View File

@ -39,7 +39,7 @@ def view_start_positions(args):
try:
image = mpimg.imread('carla/planner/%s.png' % scene.map_name)
carla_map = CarlaMap(scene.map_name, 0.1653, 50)
carla_map = CarlaMap(scene.map_name)
except IOError as exception:
logging.error(exception)
logging.error('Cannot find map "%s"', scene.map_name)