Adding a few seconds after loading a new map to let UE4 to free memory
This commit is contained in:
parent
f1d6b9778e
commit
3e2b29ecc3
|
@ -18,7 +18,7 @@ except IndexError:
|
|||
pass
|
||||
|
||||
import carla
|
||||
|
||||
import time
|
||||
|
||||
TESTING_ADDRESS = ('localhost', 3654)
|
||||
|
||||
|
@ -32,6 +32,8 @@ class SmokeTest(unittest.TestCase):
|
|||
|
||||
def tearDown(self):
|
||||
self.client.load_world("Town03")
|
||||
# workaround: give time to UE4 to clean memory after loading (old assets)
|
||||
time.sleep(5)
|
||||
self.world = None
|
||||
self.client = None
|
||||
|
||||
|
|
|
@ -82,6 +82,8 @@ class Scenario(object):
|
|||
self.client.reload_world()
|
||||
if settings is not None:
|
||||
self.world.apply_settings(settings)
|
||||
# workaround: give time to UE4 to clean memory after loading (old assets)
|
||||
time.sleep(5)
|
||||
|
||||
def reset_spectator(self, spectator_tr):
|
||||
spectator = self.world.get_spectator()
|
||||
|
@ -416,6 +418,8 @@ class TestCollisionDeterminism(SmokeTest):
|
|||
|
||||
# Loading Town03 for test
|
||||
self.client.load_world("Town03")
|
||||
# workaround: give time to UE4 to clean memory after loading (old assets)
|
||||
time.sleep(5)
|
||||
|
||||
try:
|
||||
test_collision = CollisionScenarioTester(scene=TwoCarsHighSpeedCollision(self.client, self.world, True), output_path=output_path)
|
||||
|
@ -440,6 +444,8 @@ class TestCollisionDeterminism(SmokeTest):
|
|||
|
||||
# Loading Town03 for test
|
||||
self.client.load_world("Town03")
|
||||
# workaround: give time to UE4 to clean memory after loading (old assets)
|
||||
time.sleep(5)
|
||||
|
||||
try:
|
||||
test_collision = CollisionScenarioTester(scene=ThreeCarsSlowSpeedCollision(self.client, self.world, True), output_path=output_path)
|
||||
|
@ -464,6 +470,8 @@ class TestCollisionDeterminism(SmokeTest):
|
|||
|
||||
# Loading Town03 for test
|
||||
self.client.load_world("Town03")
|
||||
# workaround: give time to UE4 to clean memory after loading (old assets)
|
||||
time.sleep(5)
|
||||
|
||||
try:
|
||||
test_collision = CollisionScenarioTester(scene=CarBikeCollision(self.client, self.world, True), output_path=output_path)
|
||||
|
@ -488,6 +496,8 @@ class TestCollisionDeterminism(SmokeTest):
|
|||
|
||||
# Loading Town03 for test
|
||||
self.client.load_world("Town03")
|
||||
# workaround: give time to UE4 to clean memory after loading (old assets)
|
||||
time.sleep(5)
|
||||
|
||||
try:
|
||||
test_collision = CollisionScenarioTester(scene=CarWalkerCollision(self.client, self.world, True), output_path=output_path)
|
||||
|
@ -500,4 +510,3 @@ class TestCollisionDeterminism(SmokeTest):
|
|||
|
||||
# Remove all the output files
|
||||
shutil.rmtree(output_path)
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
from numpy import random
|
||||
from . import SmokeTest
|
||||
import time
|
||||
|
||||
TM_PORT = 7056
|
||||
NUM_TICKS = 1000
|
||||
|
@ -68,6 +69,8 @@ class TestDeterminism(SmokeTest):
|
|||
tm_seed = 1
|
||||
|
||||
self.client.load_world("Town03")
|
||||
# workaround: give time to UE4 to clean memory after loading (old assets)
|
||||
time.sleep(5)
|
||||
|
||||
# set setting for round 1
|
||||
world = self.client.get_world()
|
||||
|
@ -110,6 +113,8 @@ class TestDeterminism(SmokeTest):
|
|||
|
||||
# reset for simulation 1
|
||||
self.client.reload_world(False)
|
||||
# workaround: give time to UE4 to clean memory after loading (old assets)
|
||||
time.sleep(5)
|
||||
world = self.client.get_world()
|
||||
traffic_manager = self.client.get_trafficmanager(TM_PORT)
|
||||
traffic_manager.set_synchronous_mode(True)
|
||||
|
@ -122,6 +127,8 @@ class TestDeterminism(SmokeTest):
|
|||
|
||||
# reset for simulation 2
|
||||
self.client.reload_world(False)
|
||||
# workaround: give time to UE4 to clean memory after loading (old assets)
|
||||
time.sleep(5)
|
||||
world = self.client.get_world()
|
||||
traffic_manager = self.client.get_trafficmanager(TM_PORT)
|
||||
traffic_manager.set_synchronous_mode(True)
|
||||
|
@ -134,6 +141,7 @@ class TestDeterminism(SmokeTest):
|
|||
|
||||
self.client.reload_world()
|
||||
world.apply_settings(old_settings)
|
||||
# workaround: give time to UE4 to clean memory after loading (old assets)
|
||||
time.sleep(5)
|
||||
|
||||
self.compare_records(record_run1, record_run2)
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import carla
|
|||
import random
|
||||
|
||||
from . import SmokeTest
|
||||
|
||||
import time
|
||||
|
||||
class TestMap(SmokeTest):
|
||||
def test_reload_world(self):
|
||||
|
@ -24,6 +24,8 @@ class TestMap(SmokeTest):
|
|||
for map_name in map_names:
|
||||
if map_name != '/Game/Carla/Maps/BaseMap/BaseMap':
|
||||
world = self.client.load_world(map_name)
|
||||
# workaround: give time to UE4 to clean memory after loading (old assets)
|
||||
time.sleep(5)
|
||||
m = world.get_map()
|
||||
self.assertEqual(map_name.split('/')[-1], m.name)
|
||||
self._check_map(m)
|
||||
|
|
|
@ -47,6 +47,8 @@ class Scenario(object):
|
|||
self.sensor_queue = Queue()
|
||||
|
||||
self.reload_world(settings, spectator_tr)
|
||||
# workaround: give time to UE4 to clean memory after loading (old assets)
|
||||
time.sleep(5)
|
||||
|
||||
# Init timestamp
|
||||
snapshot = self.world.get_snapshot()
|
||||
|
@ -85,6 +87,8 @@ class Scenario(object):
|
|||
self.reset_spectator(spectator_tr)
|
||||
|
||||
self.client.reload_world(False)
|
||||
# workaround: give time to UE4 to clean memory after loading (old assets)
|
||||
time.sleep(5)
|
||||
|
||||
def reset_spectator(self, spectator_tr):
|
||||
spectator = self.world.get_spectator()
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
import carla
|
||||
import random
|
||||
import time
|
||||
|
||||
from . import SyncSmokeTest
|
||||
|
||||
|
@ -14,6 +15,8 @@ class TestSnapshot(SyncSmokeTest):
|
|||
def test_spawn_points(self):
|
||||
print("TestSnapshot.test_spawn_points")
|
||||
self.world = self.client.reload_world()
|
||||
# workaround: give time to UE4 to clean memory after loading (old assets)
|
||||
time.sleep(5)
|
||||
|
||||
# Check why the world settings aren't applied after a reload
|
||||
self.settings = self.world.get_settings()
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
# For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
import carla
|
||||
import time
|
||||
|
||||
from . import SyncSmokeTest
|
||||
|
||||
|
@ -21,6 +22,9 @@ class TestSpawnpoints(SyncSmokeTest):
|
|||
|
||||
# load the map
|
||||
self.client.load_world(m)
|
||||
# workaround: give time to UE4 to clean memory after loading (old assets)
|
||||
time.sleep(5)
|
||||
|
||||
self.world = self.client.get_world()
|
||||
|
||||
# get all spawn points
|
||||
|
|
|
@ -29,6 +29,8 @@ class TestSynchronousMode(SyncSmokeTest):
|
|||
for _ in range(0, 4):
|
||||
self.world = self.client.reload_world()
|
||||
self.world.apply_settings(settings)
|
||||
# workaround: give time to UE4 to clean memory after loading (old assets)
|
||||
time.sleep(5)
|
||||
|
||||
def _test_camera_on_synchronous_mode(self):
|
||||
print("TestSynchronousMode.test_camera_on_synchronous_mode")
|
||||
|
|
|
@ -207,6 +207,8 @@ class TestVehicleFriction(SyncSmokeTest):
|
|||
print("TestVehicleFriction.test_vehicle_zero_friction")
|
||||
|
||||
self.client.load_world("Town05_Opt", False)
|
||||
# workaround: give time to UE4 to clean memory after loading (old assets)
|
||||
time.sleep(5)
|
||||
|
||||
bp_vehicles = self.world.get_blueprint_library().filter("vehicle.*")
|
||||
for bp_veh in bp_vehicles:
|
||||
|
@ -273,6 +275,8 @@ class TestVehicleFriction(SyncSmokeTest):
|
|||
print("TestVehicleFriction.test_vehicle_friction_volume")
|
||||
|
||||
self.client.load_world("Town05_Opt", False)
|
||||
# workaround: give time to UE4 to clean memory after loading (old assets)
|
||||
time.sleep(5)
|
||||
|
||||
bp_vehicles = self.world.get_blueprint_library().filter("vehicle.*")
|
||||
bp_vehicles = [x for x in bp_vehicles if int(x.get_attribute('number_of_wheels')) == 4]
|
||||
|
@ -386,6 +390,8 @@ class TestVehicleFriction(SyncSmokeTest):
|
|||
print("TestVehicleFriction.test_vehicle_friction_values")
|
||||
|
||||
self.client.load_world("Town05_Opt", False)
|
||||
# workaround: give time to UE4 to clean memory after loading (old assets)
|
||||
time.sleep(5)
|
||||
|
||||
bp_vehicles = self.world.get_blueprint_library().filter("vehicle.*")
|
||||
|
||||
|
@ -468,6 +474,8 @@ class TestVehicleTireConfig(SyncSmokeTest):
|
|||
print("TestVehicleTireConfig.test_vehicle_wheel_collision")
|
||||
|
||||
self.client.load_world("Town05_Opt", False)
|
||||
# workaround: give time to UE4 to clean memory after loading (old assets)
|
||||
time.sleep(5)
|
||||
|
||||
bp_vehicles = self.world.get_blueprint_library().filter("vehicle.*")
|
||||
bp_vehicles = [x for x in bp_vehicles if int(x.get_attribute('number_of_wheels')) == 4]
|
||||
|
@ -526,6 +534,8 @@ class TestVehicleTireConfig(SyncSmokeTest):
|
|||
print("TestVehicleTireConfig.test_vehicle_tire_long_stiff")
|
||||
|
||||
self.client.load_world("Town05_Opt", False)
|
||||
# workaround: give time to UE4 to clean memory after loading (old assets)
|
||||
time.sleep(5)
|
||||
|
||||
bp_vehicles = self.world.get_blueprint_library().filter("vehicle.*")
|
||||
bp_vehicles = [x for x in bp_vehicles if int(x.get_attribute('number_of_wheels')) == 4]
|
||||
|
|
Loading…
Reference in New Issue