Fixed issues with new map.name

This commit is contained in:
Guillermo 2021-08-02 16:24:37 +02:00 committed by bernat
parent 84293dad93
commit 5127b63d91
4 changed files with 5 additions and 16 deletions

View File

@ -284,7 +284,7 @@ class HUD(object):
'Client: % 16.0f FPS' % clock.get_fps(),
'',
'Vehicle: % 20s' % get_actor_display_name(world.player, truncate=20),
'Map: % 20s' % world.map.name,
'Map: % 20s' % world.map.name.split('/')[-1],
'Simulation time: % 12s' % datetime.timedelta(seconds=int(self.simulation_time)),
'',
'Speed: % 15.0f km/h' % (3.6 * math.sqrt(vel.x**2 + vel.y**2 + vel.z**2)),

View File

@ -63,13 +63,7 @@ import glob
import os
import sys
try:
# sys.path.append(glob.glob('../carla/dist/carla-*%d.%d-%s.egg' % (
print(os.path.abspath(__file__))
print(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(glob.glob(os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + '/carla/dist/carla-*%d.%d-%s.egg' % (
# sys.path.append(glob.glob(os.path.dirname(os.path.abspath(__file__)) + '/dist/carla-*%d.%d-%s.egg' % (
# sys.path.append(glob.glob(os.path.dirname(os.path.abspath(__file__)) + '/../carla/dist/carla-*%d.%d-%s.egg' % (
try:sys.path.append(glob.glob(os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + '/carla/dist/carla-*%d.%d-%s.egg' % (
sys.version_info.major,
sys.version_info.minor,
'win-amd64' if os.name == 'nt' else 'linux-x86_64'))[0])
@ -608,7 +602,7 @@ class HUD(object):
'Client: % 16.0f FPS' % clock.get_fps(),
'',
'Vehicle: % 20s' % get_actor_display_name(world.player, truncate=20),
'Map: % 20s' % world.map.name,
'Map: % 20s' % world.map.name.split('/')[-1],
'Simulation time: % 12s' % datetime.timedelta(seconds=int(self.simulation_time)),
'',
'Speed: % 15.0f km/h' % (3.6 * math.sqrt(v.x**2 + v.y**2 + v.z**2)),

View File

@ -64,12 +64,7 @@ import os
import sys
try:
# sys.path.append(glob.glob('../carla/dist/carla-*%d.%d-%s.egg' % (
print(os.path.abspath(__file__))
print(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(glob.glob(os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + '/carla/dist/carla-*%d.%d-%s.egg' % (
# sys.path.append(glob.glob(os.path.dirname(os.path.abspath(__file__)) + '/dist/carla-*%d.%d-%s.egg' % (
# sys.path.append(glob.glob(os.path.dirname(os.path.abspath(__file__)) + '/../carla/dist/carla-*%d.%d-%s.egg' % (
sys.version_info.major,
sys.version_info.minor,
'win-amd64' if os.name == 'nt' else 'linux-x86_64'))[0])
@ -616,7 +611,7 @@ class HUD(object):
'Client: % 16.0f FPS' % clock.get_fps(),
'',
'Vehicle: % 20s' % get_actor_display_name(world.player, truncate=20),
'Map: % 20s' % world.map.name,
'Map: % 20s' % world.map.name.split('/')[-1],
'Simulation time: % 12s' % datetime.timedelta(seconds=int(self.simulation_time)),
'',
'Speed: % 15.0f km/h' % (3.6 * math.sqrt(v.x**2 + v.y**2 + v.z**2)),

View File

@ -470,7 +470,7 @@ class MapImage(object):
opendrive_hash = str(hash_func.hexdigest())
# Build path for saving or loading the cached rendered map
filename = carla_map.name + "_" + opendrive_hash + ".tga"
filename = carla_map.name.split('/')[-1] + "_" + opendrive_hash + ".tga"
dirname = os.path.join("cache", "no_rendering_mode")
full_path = str(os.path.join(dirname, filename))