wirepod-vector-sdk-audio 0.9.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- anki_vector/__init__.py +43 -0
- anki_vector/animation.py +272 -0
- anki_vector/annotate.py +590 -0
- anki_vector/audio.py +212 -0
- anki_vector/audio_stream.py +335 -0
- anki_vector/behavior.py +1135 -0
- anki_vector/camera.py +670 -0
- anki_vector/camera_viewer/__init__.py +121 -0
- anki_vector/color.py +88 -0
- anki_vector/configure/__main__.py +331 -0
- anki_vector/connection.py +838 -0
- anki_vector/events.py +420 -0
- anki_vector/exceptions.py +185 -0
- anki_vector/faces.py +819 -0
- anki_vector/lights.py +210 -0
- anki_vector/mdns.py +131 -0
- anki_vector/messaging/__init__.py +45 -0
- anki_vector/messaging/alexa_pb2.py +36 -0
- anki_vector/messaging/alexa_pb2_grpc.py +3 -0
- anki_vector/messaging/behavior_pb2.py +40 -0
- anki_vector/messaging/behavior_pb2_grpc.py +3 -0
- anki_vector/messaging/client.py +33 -0
- anki_vector/messaging/cube_pb2.py +113 -0
- anki_vector/messaging/cube_pb2_grpc.py +3 -0
- anki_vector/messaging/extensions_pb2.py +25 -0
- anki_vector/messaging/extensions_pb2_grpc.py +3 -0
- anki_vector/messaging/external_interface_pb2.py +169 -0
- anki_vector/messaging/external_interface_pb2_grpc.py +1267 -0
- anki_vector/messaging/messages_pb2.py +431 -0
- anki_vector/messaging/messages_pb2_grpc.py +3 -0
- anki_vector/messaging/nav_map_pb2.py +33 -0
- anki_vector/messaging/nav_map_pb2_grpc.py +3 -0
- anki_vector/messaging/protocol.py +33 -0
- anki_vector/messaging/response_status_pb2.py +27 -0
- anki_vector/messaging/response_status_pb2_grpc.py +3 -0
- anki_vector/messaging/settings_pb2.py +72 -0
- anki_vector/messaging/settings_pb2_grpc.py +3 -0
- anki_vector/messaging/shared_pb2.py +54 -0
- anki_vector/messaging/shared_pb2_grpc.py +3 -0
- anki_vector/motors.py +127 -0
- anki_vector/nav_map.py +409 -0
- anki_vector/objects.py +1782 -0
- anki_vector/opengl/__init__.py +103 -0
- anki_vector/opengl/assets/LICENSE.txt +21 -0
- anki_vector/opengl/assets/cube.jpg +0 -0
- anki_vector/opengl/assets/cube.mtl +9 -0
- anki_vector/opengl/assets/cube.obj +1000 -0
- anki_vector/opengl/assets/vector.mtl +67 -0
- anki_vector/opengl/assets/vector.obj +13220 -0
- anki_vector/opengl/opengl.py +864 -0
- anki_vector/opengl/opengl_vector.py +620 -0
- anki_vector/opengl/opengl_viewer.py +689 -0
- anki_vector/photos.py +145 -0
- anki_vector/proximity.py +176 -0
- anki_vector/reserve_control/__main__.py +36 -0
- anki_vector/robot.py +930 -0
- anki_vector/screen.py +201 -0
- anki_vector/status.py +322 -0
- anki_vector/touch.py +119 -0
- anki_vector/user_intent.py +186 -0
- anki_vector/util.py +1132 -0
- anki_vector/version.py +15 -0
- anki_vector/viewer.py +403 -0
- anki_vector/vision.py +202 -0
- anki_vector/world.py +899 -0
- wirepod_vector_sdk_audio-0.9.0.dist-info/METADATA +80 -0
- wirepod_vector_sdk_audio-0.9.0.dist-info/RECORD +71 -0
- wirepod_vector_sdk_audio-0.9.0.dist-info/WHEEL +5 -0
- wirepod_vector_sdk_audio-0.9.0.dist-info/licenses/LICENSE.txt +180 -0
- wirepod_vector_sdk_audio-0.9.0.dist-info/top_level.txt +1 -0
- wirepod_vector_sdk_audio-0.9.0.dist-info/zip-safe +1 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# Copyright (c) 2019 Anki, Inc.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License in the file LICENSE.txt or at
|
|
6
|
+
#
|
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
"""
|
|
16
|
+
Class and enumeration related to voice commands received by Vector.
|
|
17
|
+
|
|
18
|
+
When under SDK behavior control, recognized voice commands will be sent as
|
|
19
|
+
events. SDK users can respond with their own scripted actions.
|
|
20
|
+
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
# __all__ should order by constants, event classes, other classes, functions.
|
|
24
|
+
__all__ = ['UserIntentEvent', 'UserIntent']
|
|
25
|
+
|
|
26
|
+
from enum import Enum
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class UserIntentEvent(Enum):
|
|
30
|
+
"""List of UserIntent events available to the SDK.
|
|
31
|
+
|
|
32
|
+
Vector's voice recognition allows for variation in
|
|
33
|
+
grammar and word selection, so the examples are not
|
|
34
|
+
the only way to invoke the voice commands.
|
|
35
|
+
|
|
36
|
+
This list reflect only the voice commands available
|
|
37
|
+
to the SDK, as some are not available for development
|
|
38
|
+
use."""
|
|
39
|
+
#: example "How old are you?"
|
|
40
|
+
character_age = 0
|
|
41
|
+
#: example "Check the timer."
|
|
42
|
+
check_timer = 1
|
|
43
|
+
#: example "Go explore."
|
|
44
|
+
explore_start = 2
|
|
45
|
+
#: example "Stop the timer."
|
|
46
|
+
global_stop = 3
|
|
47
|
+
#: example "Goodbye!"
|
|
48
|
+
greeting_goodbye = 4
|
|
49
|
+
#: example "Good morning!"
|
|
50
|
+
greeting_goodmorning = 5
|
|
51
|
+
#: example "Hello!"
|
|
52
|
+
greeting_hello = 6
|
|
53
|
+
#: example "I hate you."
|
|
54
|
+
imperative_abuse = 7
|
|
55
|
+
#: example "Yes."
|
|
56
|
+
imperative_affirmative = 8
|
|
57
|
+
#: example "I'm sorry."
|
|
58
|
+
imperative_apology = 9
|
|
59
|
+
#: example "Come here."
|
|
60
|
+
imperative_come = 10
|
|
61
|
+
#: example "Dance."
|
|
62
|
+
imperative_dance = 11
|
|
63
|
+
#: example "Fetch your cube."
|
|
64
|
+
imperative_fetchcube = 12
|
|
65
|
+
#: example "Find your cube."
|
|
66
|
+
imperative_findcube = 13
|
|
67
|
+
#: example "Look at me."
|
|
68
|
+
imperative_lookatme = 14
|
|
69
|
+
#: example "I love you."
|
|
70
|
+
imperative_love = 15
|
|
71
|
+
#: example "Good Robot."
|
|
72
|
+
imperative_praise = 16
|
|
73
|
+
#: example "No."
|
|
74
|
+
imperative_negative = 17
|
|
75
|
+
#: example "Bad Robot."
|
|
76
|
+
imperative_scold = 18
|
|
77
|
+
#: example "Volume 2."
|
|
78
|
+
imperative_volumelevel = 19
|
|
79
|
+
#: example "Volume up."
|
|
80
|
+
imperative_volumeup = 20
|
|
81
|
+
#: example "Volume down."
|
|
82
|
+
imperative_volumedown = 21
|
|
83
|
+
#: example "Go forward."
|
|
84
|
+
movement_forward = 22
|
|
85
|
+
#: example "Go backward."
|
|
86
|
+
movement_backward = 23
|
|
87
|
+
#: example "Turn left."
|
|
88
|
+
movement_turnleft = 24
|
|
89
|
+
#: example "Turn right."
|
|
90
|
+
movement_turnright = 25
|
|
91
|
+
#: example "Turn around."
|
|
92
|
+
movement_turnaround = 26
|
|
93
|
+
#: example "I have a question."
|
|
94
|
+
knowledge_question = 27
|
|
95
|
+
#: example "What's my name?"
|
|
96
|
+
names_ask = 28
|
|
97
|
+
#: example "Play a game."
|
|
98
|
+
play_anygame = 29
|
|
99
|
+
#: example "Play a trick."
|
|
100
|
+
play_anytrick = 30
|
|
101
|
+
#: example "Let's play Blackjack."
|
|
102
|
+
play_blackjack = 31
|
|
103
|
+
#: example "Fist bump."
|
|
104
|
+
play_fistbump = 32
|
|
105
|
+
#: example "Pick up your cube."
|
|
106
|
+
play_pickupcube = 33
|
|
107
|
+
#: example "Pop a wheelie."
|
|
108
|
+
play_popawheelie = 34
|
|
109
|
+
#: example "Roll your cube."
|
|
110
|
+
play_rollcube = 35
|
|
111
|
+
#: example "Happy holidays!"
|
|
112
|
+
seasonal_happyholidays = 36
|
|
113
|
+
#: example "Happy new year!"
|
|
114
|
+
seasonal_happynewyear = 37
|
|
115
|
+
#: example "Set timer for 10 minutes"
|
|
116
|
+
set_timer = 38
|
|
117
|
+
#: example "What time is it?"
|
|
118
|
+
show_clock = 39
|
|
119
|
+
#: example "Take a selfie."
|
|
120
|
+
take_a_photo = 40
|
|
121
|
+
#: example "What is the weather report?"
|
|
122
|
+
weather_response = 41
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class UserIntent:
|
|
126
|
+
"""Class for containing voice command information from the event stream.
|
|
127
|
+
This class, and the contained :class:`UserIntentEvent` include all of the
|
|
128
|
+
voice commands that the SDK can intercept.
|
|
129
|
+
|
|
130
|
+
Some UserIntents include information returned from the cloud and used
|
|
131
|
+
when evaluating the voice commands. This information can be parsed as
|
|
132
|
+
a JSON formatted string.
|
|
133
|
+
|
|
134
|
+
.. testcode::
|
|
135
|
+
|
|
136
|
+
import json
|
|
137
|
+
import threading
|
|
138
|
+
|
|
139
|
+
import anki_vector
|
|
140
|
+
from anki_vector.events import Events
|
|
141
|
+
from anki_vector.user_intent import UserIntent, UserIntentEvent
|
|
142
|
+
|
|
143
|
+
def on_user_intent(robot, event_type, event, done):
|
|
144
|
+
user_intent = UserIntent(event)
|
|
145
|
+
if user_intent.intent_event is UserIntentEvent.weather_response:
|
|
146
|
+
data = json.loads(user_intent.intent_data)
|
|
147
|
+
print(f"Weather report for {data['speakableLocationString']}: "
|
|
148
|
+
f"{data['condition']}, temperature {data['temperature']} degrees")
|
|
149
|
+
done.set()
|
|
150
|
+
|
|
151
|
+
with anki_vector.Robot() as robot:
|
|
152
|
+
done = threading.Event()
|
|
153
|
+
robot.events.subscribe(on_user_intent, Events.user_intent, done)
|
|
154
|
+
|
|
155
|
+
print('------ Vector is waiting to be asked "Hey Vector! What is the weather report?" Press ctrl+c to exit early ------')
|
|
156
|
+
|
|
157
|
+
try:
|
|
158
|
+
if not done.wait(timeout=10):
|
|
159
|
+
print('------ Vector never heard a request for the weather report ------')
|
|
160
|
+
except KeyboardInterrupt:
|
|
161
|
+
pass
|
|
162
|
+
|
|
163
|
+
:param event: an event containing UserIntent data
|
|
164
|
+
"""
|
|
165
|
+
|
|
166
|
+
def __init__(self, event):
|
|
167
|
+
self._intent_event = UserIntentEvent(event.intent_id)
|
|
168
|
+
self._intent_data = event.json_data
|
|
169
|
+
|
|
170
|
+
@property
|
|
171
|
+
def intent_event(self) -> UserIntentEvent:
|
|
172
|
+
""" This returns the voice command event as a UserIntentEvent"""
|
|
173
|
+
return self._intent_event
|
|
174
|
+
|
|
175
|
+
@property
|
|
176
|
+
def intent_data(self) -> str:
|
|
177
|
+
"""
|
|
178
|
+
This gives access to any voice command specific data in JSON format.
|
|
179
|
+
|
|
180
|
+
Some voice commands contain information from processing. For example, asking Vector
|
|
181
|
+
"Hey Vector, what is the weather?" will return the current location and the weather
|
|
182
|
+
forecast.
|
|
183
|
+
|
|
184
|
+
Voice commands without additional information will have an empty intent_data.
|
|
185
|
+
"""
|
|
186
|
+
return self._intent_data
|