Remove and destroy all actors
(self)
| 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 | """ |
no test coverage detected