MCPcopy Create free account
hub / github.com/OpenDriveLab/DriveAdapter / _cleanup

Method _cleanup

scenario_runner/scenario_runner.py:166–193  ·  view source on GitHub ↗

Remove and destroy all actors

(self)

Source from the content-addressed store, hash-verified

164 sys.exit(-1)
165
166 def _cleanup(self):
167 """
168 Remove and destroy all actors
169 """
170 # Simulation still running and in synchronous mode?
171 if self.manager is not None and self.manager.get_running_status() \
172 and self.world is not None and self._args.sync:
173 # Reset to asynchronous mode
174 settings = self.world.get_settings()
175 settings.synchronous_mode = False
176 settings.fixed_delta_seconds = None
177 self.world.apply_settings(settings)
178
179 self.manager.cleanup()
180
181 CarlaDataProvider.cleanup()
182
183 for i, _ in enumerate(self.ego_vehicles):
184 if self.ego_vehicles[i]:
185 if not self._args.waitForEgo:
186 print("Destroying ego vehicle {}".format(self.ego_vehicles[i].id))
187 self.ego_vehicles[i].destroy()
188 self.ego_vehicles[i] = None
189 self.ego_vehicles = []
190
191 if self.agent_instance:
192 self.agent_instance.destroy()
193 self.agent_instance = None
194
195 def _prepare_ego_vehicles(self, ego_vehicles):
196 """

Callers 6

destroyMethod · 0.95
_signal_handlerMethod · 0.95
_run_scenariosMethod · 0.95
_run_routeMethod · 0.95
_run_openscenarioMethod · 0.95

Calls 3

get_running_statusMethod · 0.45
cleanupMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected