-
Notifications
You must be signed in to change notification settings - Fork 136
/
Copy pathInMoov.py
51 lines (41 loc) · 1.89 KB
/
InMoov.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
#########################################
# InMoov.py
# more info @: http://myrobotlab.org/service/InMoov
#########################################
# a very minimal script for InMoov
# this script is provided as a basic guide for InMoov service
# InMoov now can be started in modular pieces through the skeleton.config from full script
# although this script is very short you can still
# do voice control of a FingerStarter or hand
# It uses WebkitSpeechRecognition, so you need to use Chrome as your default browser for this script to work
# virtual = True
rightPort = "COM8"
leftPort = "COM10"
i01 = Runtime.start("i01", "InMoov")
if ('virtual' in globals() and virtual):
leftPortvirtualArduino = Runtime.start("leftPortvirtualArduino", "VirtualArduino")
leftPortvirtualArduino.connect(leftPort)
rightPortvirtualArduino = Runtime.start("rightPortvirtualArduino", "VirtualArduino")
rightPortvirtualArduino.connect(rightPort)
# starting parts
i01.startAll(leftPort,rightPort)
if ('virtual' in globals() and virtual):i01.startVinMoov()
# verbal commands
ear = i01.ear
ear.addCommand("attach right hand", "i01.rightHand", "attach")
ear.addCommand("disconnect right hand", "i01.rightHand", "detach")
ear.addCommand("rest", i01.getName(), "rest")
ear.addCommand("open hand", "python", "handopen")
ear.addCommand("close hand", "python", "handclose")
ear.addCommand("capture gesture", ear.getName(), "captureGesture")
ear.addCommand("manual", ear.getName(), "lockOutAllGrammarExcept", "voice control")
ear.addCommand("voice control", ear.getName(), "clearLock")
ear.addComfirmations("yes","correct","yeah","ya")
ear.addNegations("no","wrong","nope","nah")
ear.startListening()
def handopen():
i01.moveHand("left",0,0,0,0,0)
i01.moveHand("right",0,0,0,0,0)
def handclose():
i01.moveHand("left",180,180,180,180,180)
i01.moveHand("right",180,180,180,180,180)