-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcontrols.py
58 lines (38 loc) · 961 Bytes
/
controls.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from pynput.keyboard import Key, Controller
keyboard = Controller()
global key
key = None
def donothing():
global key
if key == 'a' or key == 's' or key == 'w' or key == 'd':
keyboard.release(key)
def left(angle):
global key
if key == 's' or key == 'w' or key == 'd':
keyboard.release(key)
bearing=16834-int((angle/90)*16384)
'''key = 'w'
keyboard.press(key)'''
key = 'a'
keyboard.press(key)
def reCentre():
global key
if key == 'a' or key == 's' or key == 'd':
keyboard.release(key)
key = 'w'
keyboard.press(key)
def right(angle):
bearing=16834-int((angle/90)*16384)
'''key = 'w'
keyboard.press(key)'''
global key
if key == 'a' or key == 's' or key == 'w':
keyboard.release(key)
key ='d'
keyboard.press(key)
def Brake():
global key
if key == 'a' or key == 'w' or key == 'd':
keyboard.release(key)
key = 's'
keyboard.press(key)