forked from dora-rs/gosim-2024
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkey_interpolation.py
42 lines (39 loc) · 1.67 KB
/
key_interpolation.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
from dora import Node
import pyarrow as pa
node = Node()
for event in node:
if event["type"] == "INPUT":
if event["id"] == "keyboard":
char = event["value"][0].as_py()
if char == "w":
print(" w ", event["value"])
node.send_output("text", pa.array(["forward"]))
elif char == "s":
node.send_output("text", pa.array(["backward"]))
# node.send_output("text", pa.array(["stop"]))
elif char == "d":
node.send_output("text", pa.array(["right"]))
elif char == "a":
node.send_output("text", pa.array(["left"]))
elif char == "q":
node.send_output("text", pa.array(["stop"]))
elif char == "r":
node.send_output("text", pa.array(["open"]))
elif char == "t":
node.send_output("text", pa.array(["close"]))
elif char == "u":
node.send_output("text", pa.array(["arm forward"]))
elif char == "j":
node.send_output("text", pa.array(["arm backward"]))
elif char == "h":
node.send_output("text", pa.array(["arm left"]))
elif char == "k":
node.send_output("text", pa.array(["arm right"]))
elif char == "y":
node.send_output("text", pa.array(["arm down"]))
elif char == "i":
node.send_output("text", pa.array(["arm up"]))
elif char == "v":
node.send_output("text", pa.array(["go home"]))
elif char == "b":
node.send_output("text", pa.array(["save home"]))