def __init__(self, input_method, lcm_tag, joy_name):
     print 'Initializing...'
     pygame.init()
     self.screen = pygame.display.set_mode((300, 70))
     pygame.display.set_caption('Steering Command Driver')
     self.font = pygame.font.SysFont('Courier', 20)
     if input_method == 'keyboard':
         self.event_processor = KeyboardEventProcessor()
     else:
         self.event_processor = JoystickEventProcessor(joy_name)
     self.last_msg = lcm_msg()
     self.lc = lcm.LCM()
     self.lcm_tag = lcm_tag
     print 'Ready'
Exemple #2
0
 def __init__(self, input_method, lcm_tag, joy_name):
     print 'Initializing...'
     pygame.init()
     self.screen = pygame.display.set_mode((300, 70))
     pygame.display.set_caption('Steering Command Driver')
     self.font = pygame.font.SysFont('Courier', 20)
     if input_method == 'keyboard':
         self.event_processor = KeyboardEventProcessor()
     else:
         self.event_processor = JoystickEventProcessor(joy_name)
     self.last_msg = lcm_msg()
     self.lc = lcm.LCM()
     self.lcm_tag = lcm_tag
     print 'Ready'
Exemple #3
0
 def start(self):
     self.printLCMValues()
     while True:
         event = pygame.event.wait()
         if event.type == pygame.QUIT:
             pygame.quit()
             sys.exit()
         else:
             self.last_value = self.event_processor.processEvent(
                 event, self.last_value)
             msg = lcm_msg()
             msg.steering_angle = self.last_value.steering_angle
             msg.acceleration = (self.last_value.throttle -
                                 self.last_value.brake)
             self.lc.publish(self.lcm_tag, msg.encode())
             self.printLCMValues()
 def start(self):
     self.printLCMValues()
     while True:
         event = pygame.event.wait()
         if event.type == pygame.QUIT:
             pygame.quit()
             sys.exit()
         else:
             self.last_value = self.event_processor.processEvent(
                 event, self.last_value)
             msg = lcm_msg()
             msg.steering_angle = self.last_value.steering_angle
             msg.acceleration = (self.last_value.throttle -
                                 self.last_value.brake)
             self.lc.publish(self.lcm_tag, msg.encode())
             self.printLCMValues()
 def __init__(self, input_method, lcm_tag, joy_name):
     print 'Initializing...'
     pygame.init()
     self.screen = pygame.display.set_mode((300, 70))
     pygame.display.set_caption('Steering Command Driver')
     self.font = pygame.font.SysFont('Courier', 20)
     if input_method == 'keyboard':
         self.event_processor = KeyboardEventProcessor()
         print bcolors.OKBLUE + '--- Keyboard Control Instruction --- '\
                 + bcolors.ENDC
         print 'To increase the throttle/brake: press and hold the Up/Down'\
                 + ' Arrow'
         print 'To decrease the throttle/brake: release the Up/Down Arrow'
         print 'To keep the the current throttle/brake: press the Space Bar'
         print 'To increase left/right steering: press the Left/Right Arrow'
         print bcolors.OKBLUE + '------------------------------------ ' \
                 + bcolors.ENDC
     else:
         self.event_processor = JoystickEventProcessor(joy_name)
     self.last_msg = lcm_msg()
     self.lc = lcm.LCM()
     self.lcm_tag = lcm_tag
     print 'Ready'
 def __init__(self, input_method, lcm_tag, joy_name):
     print 'Initializing...'
     pygame.init()
     self.screen = pygame.display.set_mode((300, 70))
     pygame.display.set_caption('Steering Command Driver')
     self.font = pygame.font.SysFont('Courier', 20)
     if input_method == 'keyboard':
         self.event_processor = KeyboardEventProcessor()
         print bcolors.OKBLUE + '--- Keyboard Control Instruction --- '\
             + bcolors.ENDC
         print 'To increase the throttle/brake: press and hold the Up/Down'\
             + ' Arrow'
         print 'To decrease the throttle/brake: release the Up/Down Arrow'
         print 'To keep the the current throttle/brake: press the Space Bar'
         print 'To increase left/right steering: press the Left/Right Arrow'
         print bcolors.OKBLUE + '------------------------------------ ' \
             + bcolors.ENDC
     else:
         self.event_processor = JoystickEventProcessor(joy_name)
     self.last_msg = lcm_msg()
     self.lc = lcm.LCM()
     self.lcm_tag = lcm_tag
     print 'Ready'
def make_driving_command(throttle, steering_angle):
    msg = lcm_msg()
    msg.acceleration = throttle
    msg.steering_angle = steering_angle
    return msg
Exemple #8
0
def publish_driving_command(lcm_tag, throttle, steering_angle):
    lc = lcm.LCM()
    last_msg = lcm_msg()
    last_msg.throttle = throttle
    last_msg.steering_angle = steering_angle
    lc.publish(lcm_tag, last_msg.encode())
def publish_driving_command(lcm_tag, throttle, steering_angle):
    lc = lcm.LCM()
    last_msg = lcm_msg()
    last_msg.throttle = throttle
    last_msg.steering_angle = steering_angle
    lc.publish(lcm_tag, last_msg.encode())