-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimWorld.py
More file actions
30 lines (24 loc) · 1.02 KB
/
simWorld.py
File metadata and controls
30 lines (24 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class SimWorld(object):
def __init__(self,carla_world,traffic_manager,fps):
self.world = carla_world
# sim_world = client.get_world()
settings = self.world.get_settings()
settings.synchronous_mode = True
settings.fixed_delta_seconds = 1 / fps
self.world.apply_settings(settings)
# self.world.recording_enabled = False
self.traffic_manager = traffic_manager
self.traffic_manager.set_synchronous_mode(True)
self.blueprint_library = self.world.get_blueprint_library()
self.objects = []
def addObject(self,actor):
self.objects.append(actor)
def destroy(self):
if self.world is not None:
settings = self.world.get_settings()
settings.synchronous_mode = False
settings.fixed_delta_seconds = None
self.world.apply_settings(settings)
self.traffic_manager.set_synchronous_mode(True)
for obj in self.objects:
obj.dispose()