(self, world, start_in_autopilot)
| 281 | class KeyboardControl(object): |
| 282 | """Class that handles keyboard input.""" |
| 283 | def __init__(self, world, start_in_autopilot): |
| 284 | self._autopilot_enabled = start_in_autopilot |
| 285 | if isinstance(world.player, carla.Vehicle): |
| 286 | self._control = carla.VehicleControl() |
| 287 | self._lights = carla.VehicleLightState.NONE |
| 288 | world.player.set_autopilot(self._autopilot_enabled) |
| 289 | world.player.set_light_state(self._lights) |
| 290 | elif isinstance(world.player, carla.Walker): |
| 291 | self._control = carla.WalkerControl() |
| 292 | self._autopilot_enabled = False |
| 293 | self._rotation = world.player.get_transform().rotation |
| 294 | else: |
| 295 | raise NotImplementedError("Actor type not supported") |
| 296 | self._steer_cache = 0.0 |
| 297 | world.hud.notification("Press 'H' or '?' for help.", seconds=4.0) |
| 298 | |
| 299 | def parse_events(self, client, world, clock): |
| 300 | if isinstance(self._control, carla.VehicleControl): |
nothing calls this directly
no test coverage detected