@@ -120,17 +120,38 @@ def run_scenario(
120120 self .carla_world = self .carla_client .get_world ()
121121 self .carla_client .load_world (env_config .town )
122122
123+ logger .info ("Updating world settings:" )
124+ # tick asynchronously until then
125+ settings = self .carla_world .get_settings ()
126+ settings .synchronous_mode = True
127+ settings .fixed_delta_seconds = self ._carla_config ["fixed_delta_seconds" ]
128+ self .carla_world .apply_settings (settings )
129+
130+ logger .info (f"{ settings .__str__ ()} " )
131+
132+ if self ._tm_config ["active" ]:
133+ logger .info ("Loading Traffic Manager..." )
134+ tm_port = int (self ._tm_config ["port" ]) # type: ignore
135+ CarlaDataProvider .set_traffic_manager_port (tm_port )
136+ tm = self .carla_client .get_trafficmanager (tm_port )
137+
138+ tm .set_random_device_seed (int (self ._tm_config ["seed" ])) # ADD TO CONFIG
139+ tm .set_synchronous_mode (self ._tm_config ["sync" ])
140+
141+ # update the world
142+ CarlaDataProvider .set_world (self .carla_world )
143+
123144 logger .info ("Spawning ego..." )
124145 ego = EgoVehicle (env_config )
125146 self .ego_vehicles .append (ego .spawn ())
126147 logger .info ("Spawned ego..." )
127148
128- self .carla_world .wait_for_tick ()
149+ self .carla_world .tick ()
129150
130151 logger .info ("Setting up sensor configuration..." )
131152 ego .setup_sensors ()
132153
133- self .carla_world .wait_for_tick ()
154+ self .carla_world .tick ()
134155
135156 if not self .DEV_MODE :
136157 logger .info ("Loading Autoware agent" )
@@ -149,27 +170,6 @@ def run_scenario(
149170 ego .prepare_ego ()
150171
151172 logger .info ("Loading route..." )
152- logger .info ("Updating world settings:" )
153-
154- # tick asynchronously until then
155- settings = self .carla_world .get_settings ()
156- settings .synchronous_mode = True
157- settings .fixed_delta_seconds = self ._carla_config ["fixed_delta_seconds" ]
158- self .carla_world .apply_settings (settings )
159-
160- logger .info (f"{ settings .__str__ ()} " )
161-
162- if self ._tm_config ["active" ]:
163- logger .info ("Loading Traffic Manager..." )
164- tm_port = int (self ._tm_config ["port" ]) # type: ignore
165- CarlaDataProvider .set_traffic_manager_port (tm_port )
166- tm = self .carla_client .get_trafficmanager (tm_port )
167-
168- tm .set_random_device_seed (int (self ._tm_config ["seed" ])) # ADD TO CONFIG
169- tm .set_synchronous_mode (self ._tm_config ["sync" ])
170-
171- # update the world
172- CarlaDataProvider .set_world (self .carla_world )
173173
174174 try :
175175 scenario = RouteScenario (
0 commit comments