(self, world, args)
| 243 | |
| 244 | class KeyboardControl(object): |
| 245 | def __init__(self, world, args): |
| 246 | self._autopilot_enabled = args.autopilot |
| 247 | self._world = world |
| 248 | self._restrictor = None |
| 249 | self._restrictorEnabled = True |
| 250 | if isinstance(world.player, carla.Vehicle): |
| 251 | self._control = carla.VehicleControl() |
| 252 | world.player.set_autopilot(self._autopilot_enabled) |
| 253 | self._restrictor = carla.RssRestrictor() |
| 254 | elif isinstance(world.player, carla.Walker): |
| 255 | self._control = carla.WalkerControl() |
| 256 | self._autopilot_enabled = False |
| 257 | self._rotation = world.player.get_transform().rotation |
| 258 | else: |
| 259 | raise NotImplementedError("Actor type not supported") |
| 260 | self._steer_cache = 0.0 |
| 261 | world.hud.notification("Press 'H' or '?' for help.", seconds=4.0) |
| 262 | |
| 263 | def parse_events(self, client, world, clock): |
| 264 | for event in pygame.event.get(): |
nothing calls this directly
no test coverage detected