コード例 #1
0
def point_keyboard(chassis_command_output, command_lock):
    delta = .5
    x, y, z = 0.0, 0.5, 0
    bezier = True

    getch = _Getch()
    while True:
        print 'Press WASD-OL-I or q'
        next_char = _Getch()
        while True:
            k = next_char()
            command_lock.acquire()
            if k == 'q':
                chassis_command_output.send('KILL')
                return
            elif k == 'w':
                chassis_command_output.send(
                    ('POSE', 0, 0, 0, 0, 0, -delta / 4, .25))
            elif k == 'd':
                chassis_command_output.send(
                    ('POSE', 0, 0, 0, 0, delta / 4, 0, .25))
            elif k == 's':
                chassis_command_output.send(
                    ('POSE', 0, 0, 0, 0, 0, delta / 4, .25))
            elif k == 'a':
                chassis_command_output.send(
                    ('POSE', 0, 0, 0, 0, -delta / 4, 0, .25))
            elif k == 'o':
                chassis_command_output.send(
                    ('POSE', 0, 0, delta, 0, 0, 0, .25))
            elif k == 'l':
                chassis_command_output.send(
                    ('POSE', 0, 0, -delta, 0, 0, 0, .25))
            command_lock.release()
コード例 #2
0
def move_keyboard(chassis_command_output, command_lock):
    delta = .5
    x_vel, y_vel, r_vel = 0.0, 0.0, 0.0

    getch = _Getch()
    while True:
        print 'Press WASD-OL-I or q'
        next_char = _Getch()
        while True:
            k = next_char()
            command_lock.acquire()
            if k == 'q':
                chassis_command_output.send('KILL')
                return
            elif k == 'w':
                y_vel += delta
                chassis_command_output.send(('MOVE', x_vel, y_vel, r_vel))
            elif k == 'd':
                x_vel += delta
                chassis_command_output.send(('MOVE', x_vel, y_vel, r_vel))
            elif k == 's':
                y_vel -= delta
                chassis_command_output.send(('MOVE', x_vel, y_vel, r_vel))
            elif k == 'a':
                x_vel -= delta
                chassis_command_output.send(('MOVE', x_vel, y_vel, r_vel))
            elif k == 'o':
                chassis_command_output.send(
                    ('POSE', 0, 0, delta, 0, 0, 0, .25))
            elif k == 'l':
                chassis_command_output.send(
                    ('POSE', 0, 0, -delta, 0, 0, 0, .25))
            command_lock.release()
コード例 #3
0
def point_keyboard(chassis_command_output, command_lock):
  delta = .5
  x, y, z = 0.0, 0.5, 0
  bezier = True

  getch = _Getch()
  while True:
    print 'Press WASD-OL-I or q'
    next_char = _Getch()
    while True:
      k = next_char()
      command_lock.acquire()
      if k == 'q':
        chassis_command_output.send('KILL')
        return
      elif k == 'w':
        chassis_command_output.send(('POSE', 0, 0, 0, 0,0,-delta/4,.25))
      elif k == 'd':
        chassis_command_output.send(('POSE', 0, 0, 0, 0,delta/4,0,.25))
      elif k == 's':
        chassis_command_output.send(('POSE', 0, 0, 0, 0,0,delta/4,.25))
      elif k == 'a':
        chassis_command_output.send(('POSE', 0, 0, 0, 0,-delta/4,0,.25))
      elif k == 'o':
        chassis_command_output.send(('POSE', 0, 0, delta, 0,0,0,.25))
      elif k == 'l':
        chassis_command_output.send(('POSE', 0, 0, -delta, 0,0,0,.25))
      command_lock.release()
コード例 #4
0
def move_keyboard(chassis_command_output, command_lock):
  delta = .5
  x_vel, y_vel, r_vel = 0.0, 0.0, 0.0

  getch = _Getch()
  while True:
    print 'Press WASD-OL-I or q'
    next_char = _Getch()
    while True:
      k = next_char()
      command_lock.acquire()
      if k == 'q':
        chassis_command_output.send('KILL')
        return
      elif k == 'w':
        y_vel += delta
        chassis_command_output.send(('MOVE', x_vel, y_vel, r_vel))
      elif k == 'd':
        x_vel += delta
        chassis_command_output.send(('MOVE', x_vel, y_vel, r_vel))
      elif k == 's':
        y_vel -= delta
        chassis_command_output.send(('MOVE', x_vel, y_vel, r_vel))
      elif k == 'a':
        x_vel -= delta
        chassis_command_output.send(('MOVE', x_vel, y_vel, r_vel))
      elif k == 'o':
        chassis_command_output.send(('POSE', 0, 0, delta, 0,0,0,.25))
      elif k == 'l':
        chassis_command_output.send(('POSE', 0, 0, -delta, 0,0,0,.25))
      command_lock.release()
コード例 #5
0
def controller(control_queue):
    getch = _Getch()
    while True:
        print 'Press WASD or q'
        next_char = _Getch()
        while True:
            k = next_char()
            if k == 'q':
                control_queue.put(k)
                return
            elif k in 'wasdop': control_queue.put(k)
コード例 #6
0
def controller(control_queue):
    getch = _Getch()
    while True:
        print 'Press WASD or q'
        next_char = _Getch()
        while True:
            k = next_char()
            if k == 'q':
                control_queue.put(k)
                return
            elif k in 'wasdop':
                control_queue.put(k)
コード例 #7
0
ファイル: keyboard.py プロジェクト: jefesaurus/hexapod-engine
 def _get_control_signal(self):
     print 'Press WASD or q'
     next_char = _Getch()
     while True:
         k = next_char()
         if k in 'qwasdop':
             return k
コード例 #8
0
 def _get_control_signal(self):
     print 'Press WASD or q'
     next_char = _Getch()
     while True:
         k = next_char()
         if k in 'qwasdop':
             return k