-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsubsys_gamepad.py
More file actions
63 lines (59 loc) · 3.62 KB
/
subsys_gamepad.py
File metadata and controls
63 lines (59 loc) · 3.62 KB
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
59
60
61
62
63
import pygame
from typing import List
class Gamepad:
keyboard_map: dict = dict(name='Keyboard',
axes={},
buttons={pygame.K_ESCAPE: 'Stop',
pygame.K_SPACE: 'Emergency',
pygame.K_t: 'Takeoff',
pygame.K_l: 'Land',
pygame.K_LEFT: 'Left',
pygame.K_RIGHT: 'Right',
pygame.K_UP: 'Forward',
pygame.K_DOWN: 'Backward',
pygame.K_z: 'Up',
pygame.K_s: 'Down',
pygame.K_d: 'Yaw+',
pygame.K_q: 'Yaw-',
pygame.K_a: 'Automatic flight'}
)
map_list: List[dict] = [dict(name='Logitech Extreme 3D',
axes={0: 'Roll',
1: 'Pitch',
2: 'Yaw',
3: 'Height'},
buttons={0: 'Stop', # Button 1
1: 'Takeoff', # Button 2
2: 'Land', # Button 3
3: 'Emergency', # Button 4
10: 'Automatic flight' # Button 11
}),
dict(name='Controller (Xbox One For Windows)',
axes={0: 'Yaw', # Left stick left/right
1: 'Height', # Left stick up/down
2: 'Roll', # Right stick left/right
3: 'Pitch', # Right stick up/down
4: 'Yaw-', # Left trigger
5: 'Yaw+' # Right trigger
},
buttons={0: 'Takeoff', # A
1: 'Land', # B
2: 'Emergency', # X
3: 'Stop', # Y
4: 'Automatic flight' # RX
}),
dict(name='Default',
axes={0: 'Roll', # Left stick left/right
1: 'Pitch', # Left stick up/down
2: 'Yaw', # Right stick left/right
3: 'Height', # Right stick up/down
4: 'Yaw-', # Left trigger
5: 'Yaw+' # Right trigger
},
buttons={0: 'Takeoff', # A
1: 'Land', # B
2: 'Emergency', # X
3: 'Stop', # Y
4: 'Automatic flight' # RX
})
]