Skip to content

Commit dc4cb27

Browse files
committed
Improvements to gamepad controller modules. Temperature alert in display.
1 parent 4803d58 commit dc4cb27

File tree

14 files changed

+691
-143
lines changed

14 files changed

+691
-143
lines changed

config/controller.yml

Lines changed: 3 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
controller:
22
enabled: true
3-
path: 'modules.controller.Controller'
3+
path: 'modules.xbox_controller.XboxController'
44
config:
5+
normalised: true
56
debug: false
67
device: '/dev/input/js0' # Add this
78
deadzone: 4000 # thumbsticks deadzone (seems to be needed for xbox controllers)
@@ -29,118 +30,4 @@ controller:
2930
7: 'ABS_HAT0Y'
3031
axis_max: 32767.0
3132
axis_min: -32767.0
32-
modifier_buttons:
33-
- BTN_TL
34-
- BTN_TR
35-
button_action_map:
36-
default:
37-
BTN_TL:
38-
- topic: ''
39-
args: {}
40-
BTN_TR:
41-
- topic: ''
42-
args: {}
43-
BTN_SELECT:
44-
- topic: 'record/stop'
45-
args: {}
46-
BTN_START:
47-
- topic: 'record/start'
48-
args: {}
49-
KEY_RECORD: # Only on Xbox S/X remotes
50-
- topic: ''
51-
args: {}
52-
BTN_MODE: # Xbox Logo
53-
- topic: ''
54-
args: {}
55-
ABS_HAT0X: # DPAD X
56-
- topic: ''
57-
args: {}
58-
ABS_HAT0Y: # DPAD Y
59-
- topic: ''
60-
args: {}
61-
BTN_A:
62-
- topic: 'tts'
63-
args: {
64-
msg: 'Test Default'
65-
}
66-
BTN_X:
67-
- topic: 'eye/blink'
68-
args: {}
69-
BTN_Y:
70-
- topic: 'gpio/laser/toggle'
71-
args: {}
72-
BTN_B:
73-
- topic: ''
74-
args: {}
75-
ABS_RX:
76-
- topic: 'servo:neck_pan:mv'
77-
args: {}
78-
modifier:
79-
scale: 0.1 # max speed per event
80-
max_delta: 200 # max position change per event
81-
ABS_RZ:
82-
- topic: 'servo:neck_tilt:mv'
83-
args: {}
84-
modifier:
85-
scale: -0.2
86-
max_delta: 200
87-
ABS_RY: # Right trigger
88-
- topic: 'servo:leg_r_ankle:mv'
89-
args: {}
90-
start: -32767
91-
ABS_Z: # Left trigger
92-
- topic: 'servo:leg_l_ankle:mv'
93-
args: {}
94-
modifier:
95-
scale: -1.0
96-
start: -32767
97-
ABS_X:
98-
- topic: 'eye/move'
99-
args: {axis: 'y'}
100-
modifier:
101-
scale: -1.0
102-
max_delta: 50
103-
ABS_Y:
104-
- topic: 'eye/move'
105-
args: {axis: 'x'}
106-
modifier:
107-
scale: -1.0
108-
max_delta: 50
109-
BTN_TL:
110-
BTN_X:
111-
- topic: 'servo:neck_pan:mv'
112-
args: {delta: 50}
113-
BTN_Y:
114-
- topic: 'servo:neck_tilt:mv'
115-
args: {delta: 50}
116-
BTN_B:
117-
- topic: 'servo:neck_pan:mv'
118-
args: {delta: -50}
119-
BTN_A:
120-
- topic: 'servo:neck_tilt:mv'
121-
args: {delta: -50}
122-
BTN_TR:
123-
BTN_A:
124-
- topic: 'tts'
125-
args: {
126-
msg: 'Left Shoulder Held'
127-
}
128-
ABS_X:
129-
- topic: 'servo:leg_l_ankle:mv'
130-
modifier:
131-
scale: 0.1
132-
- topic: 'servo:leg_r_ankle:mv'
133-
modifier:
134-
scale: -0.1
135-
- topic: 'servo:leg_l_knee:mv'
136-
modifier:
137-
scale: 0.1
138-
- topic: 'servo:leg_r_knee:mv'
139-
modifier:
140-
scale: -0.1
141-
- topic: 'servo:leg_l_hip:mv'
142-
modifier:
143-
scale: 0.1
144-
- topic: 'servo:leg_r_hip:mv'
145-
modifier:
146-
scale: -0.1
33+

config/controller_handler.yml

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
controller:
2+
enabled: true
3+
path: 'modules.controller_handler.ControllerHandler'
4+
config:
5+
debug: false
6+
modifier_buttons:
7+
- BTN_TL
8+
- BTN_TR
9+
mapping:
10+
default:
11+
BTN_TL:
12+
actions:
13+
- topic: ''
14+
args: {}
15+
BTN_TR:
16+
actions:
17+
- topic: ''
18+
args: {}
19+
BTN_SELECT:
20+
actions:
21+
- topic: 'record/stop'
22+
args: {}
23+
BTN_START:
24+
actions:
25+
- topic: 'record/start'
26+
args: {}
27+
KEY_RECORD: # Only on Xbox S/X remotes
28+
actions:
29+
- topic: ''
30+
args: {}
31+
BTN_MODE: # Xbox Logo
32+
actions:
33+
- topic: ''
34+
args: {}
35+
ABS_HAT0X: # DPAD X
36+
actions:
37+
- topic: ''
38+
args: {}
39+
ABS_HAT0Y: # DPAD Y
40+
actions:
41+
- topic: ''
42+
args: {}
43+
BTN_A:
44+
actions:
45+
- topic: 'tts'
46+
args: {msg: 'Test Default'}
47+
BTN_X:
48+
actions:
49+
- topic: 'eye/blink'
50+
args: {}
51+
BTN_Y:
52+
actions:
53+
- topic: 'gpio/laser/toggle'
54+
args: {}
55+
BTN_B:
56+
actions:
57+
- topic: 'vision/toggle'
58+
args: {}
59+
ABS_RX:
60+
actions:
61+
- topic: 'servo:neck_pan:mv'
62+
args: {}
63+
modifier:
64+
scale: 50 # max speed per event
65+
ABS_RZ:
66+
actions:
67+
- topic: 'servo:neck_tilt:mv'
68+
args: {}
69+
modifier:
70+
scale: -50
71+
ABS_RY: # Right trigger
72+
start: -1.0
73+
actions:
74+
- topic: 'servo:leg_r_ankle:mv'
75+
args: {}
76+
ABS_Z: # Left trigger
77+
start: -1.0
78+
actions:
79+
- topic: 'servo:leg_l_ankle:mv'
80+
args: {}
81+
modifier:
82+
scale: -50
83+
ABS_X:
84+
actions:
85+
- topic: 'eye/move'
86+
args: {axis: 'y'}
87+
modifier:
88+
mapping: [0, 240]
89+
ABS_Y:
90+
actions:
91+
- topic: 'eye/move'
92+
args: {axis: 'x'}
93+
modifier:
94+
mapping: [240, 0]
95+
BTN_TL:
96+
BTN_X:
97+
actions:
98+
- topic: 'servo:neck_pan:mv'
99+
args: {delta: 50}
100+
BTN_Y:
101+
actions:
102+
- topic: 'servo:neck_tilt:mv'
103+
args: {delta: 50}
104+
BTN_B:
105+
actions:
106+
- topic: 'servo:neck_pan:mv'
107+
args: {delta: -50}
108+
BTN_A:
109+
actions:
110+
- topic: 'servo:neck_tilt:mv'
111+
args: {delta: -50}
112+
BTN_TR:
113+
BTN_A:
114+
actions:
115+
- topic: 'tts'
116+
args: {msg: 'Right Shoulder Held'}
117+
ABS_X:
118+
actions:
119+
- topic: 'servo:leg_l_ankle:mv'
120+
modifier:
121+
scale: 50
122+
- topic: 'servo:leg_r_ankle:mv'
123+
modifier:
124+
scale: -50
125+
- topic: 'servo:leg_l_knee:mv'
126+
modifier:
127+
scale: 50
128+
- topic: 'servo:leg_r_knee:mv'
129+
modifier:
130+
scale: -50
131+
- topic: 'servo:leg_l_hip:mv'
132+
modifier:
133+
scale: 50
134+
- topic: 'servo:leg_r_hip:mv'
135+
modifier:
136+
scale: -50

config/ttsmodule.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
ttsmodule:
2-
enabled: false
2+
enabled: true
3+
environment: robot
34
path: "modules.audio.ttsmodule.TTSModule"
45
config:
56
service: "elevenlabs" # or pyttsx3

0 commit comments

Comments
 (0)