class_docstr: Basic implementation of a synchronous client.
class_docstr_tok: ["Basic","implementation","of","a","synchronous","client","."]
docstr: Applies control to main car based on pygame pressed keys.
  Will return True If ESCAPE is hit, otherwise False to end main loop.
docstr_tok: ["Applies","control","to","main","car","based","on","pygame","pressed","keys",".","Will","return","True","If","ESCAPE","is","hit",",","otherwise","False","to","end","main","loop","."]
code: def control(self, car):
      """
      Applies control to main car based on pygame pressed keys.
      Will return True If ESCAPE is hit, otherwise False to end main loop.
      """
  
      keys = pygame.key.get_pressed()
      if keys[K_ESCAPE]:
          return True
  
      control = car.get_control()
      control.throttle = 0
      if keys[K_w]:
          control.throttle = 1
          control.reverse = False
      elif keys[K_s]:
          control.throttle = 1
          control.reverse = True
      if keys[K_a]:
          control.steer = max(-1.0, min(control.steer - 0.05, 0))
      elif keys[K_d]:
          control.steer = min(1.0, max(control.steer + 0.05, 0))
      else:
          control.steer = 0
      control.hand_brake = keys[K_SPACE]
  
      car.apply_control(control)
      return False
  
imports: import glob
  import os
  import sys
  import carla
  import weakref
  import random
label_desc: Use image node_id 6 for calling the BasicSynchronousClient obj's underlying member method code with example usage: obj.control(car) and returns: False, True