anki_vector.user_intent¶
Class and enumeration related to voice commands received by Vector.
When under SDK behavior control, recognized voice commands will be sent as events. SDK users can respond with their own scripted actions.
Classes
|
Class for containing voice command information from the event stream. |
List of UserIntent events available to the SDK. |
-
class
anki_vector.user_intent.
UserIntentEvent
¶ List of UserIntent events available to the SDK.
Vector’s voice recognition allows for variation in grammar and word selection, so the examples are not the only way to invoke the voice commands.
This list reflect only the voice commands available to the SDK, as some are not available for development use.
-
character_age
= 0¶ example “How old are you?”
-
check_timer
= 1¶ example “Check the timer.”
-
explore_start
= 2¶ example “Go explore.”
-
global_stop
= 3¶ example “Stop the timer.”
-
greeting_goodbye
= 4¶ example “Goodbye!”
-
greeting_goodmorning
= 5¶ example “Good morning!”
-
greeting_hello
= 6¶ example “Hello!”
-
imperative_abuse
= 7¶ example “I hate you.”
-
imperative_affirmative
= 8¶ example “Yes.”
-
imperative_apology
= 9¶ example “I’m sorry.”
-
imperative_come
= 10¶ example “Come here.”
-
imperative_dance
= 11¶ example “Dance.”
-
imperative_fetchcube
= 12¶ example “Fetch your cube.”
-
imperative_findcube
= 13¶ example “Find your cube.”
-
imperative_lookatme
= 14¶ example “Look at me.”
-
imperative_love
= 15¶ example “I love you.”
-
imperative_negative
= 17¶ example “No.”
-
imperative_praise
= 16¶ example “Good Robot.”
-
imperative_scold
= 18¶ example “Bad Robot.”
-
imperative_volumedown
= 21¶ example “Volume down.”
-
imperative_volumelevel
= 19¶ example “Volume 2.”
-
imperative_volumeup
= 20¶ example “Volume up.”
-
knowledge_question
= 27¶ example “I have a question.”
-
movement_backward
= 23¶ example “Go backward.”
-
movement_forward
= 22¶ example “Go forward.”
-
movement_turnaround
= 26¶ example “Turn around.”
-
movement_turnleft
= 24¶ example “Turn left.”
-
movement_turnright
= 25¶ example “Turn right.”
-
names_ask
= 28¶ example “What’s my name?”
-
play_anygame
= 29¶ example “Play a game.”
-
play_anytrick
= 30¶ example “Play a trick.”
-
play_blackjack
= 31¶ example “Let’s play Blackjack.”
-
play_fistbump
= 32¶ example “Fist bump.”
-
play_pickupcube
= 33¶ example “Pick up your cube.”
-
play_popawheelie
= 34¶ example “Pop a wheelie.”
-
play_rollcube
= 35¶ example “Roll your cube.”
-
seasonal_happyholidays
= 36¶ example “Happy holidays!”
-
seasonal_happynewyear
= 37¶ example “Happy new year!”
-
set_timer
= 38¶ example “Set timer for 10 minutes”
-
show_clock
= 39¶ example “What time is it?”
-
take_a_photo
= 40¶ example “Take a selfie.”
-
weather_response
= 41¶ example “What is the weather report?”
-
-
class
anki_vector.user_intent.
UserIntent
(event)¶ Class for containing voice command information from the event stream. This class, and the contained
UserIntentEvent
include all of the voice commands that the SDK can intercept.Some UserIntents include information returned from the cloud and used when evaluating the voice commands. This information can be parsed as a JSON formatted string.
import json import threading import anki_vector from anki_vector.events import Events from anki_vector.user_intent import UserIntent, UserIntentEvent def on_user_intent(robot, event_type, event, done): user_intent = UserIntent(event) if user_intent.intent_event is UserIntentEvent.weather_response: data = json.loads(user_intent.intent_data) print(f"Weather report for {data['speakableLocationString']}: " f"{data['condition']}, temperature {data['temperature']} degrees") done.set() with anki_vector.Robot() as robot: done = threading.Event() robot.events.subscribe(on_user_intent, Events.user_intent, done) print('------ Vector is waiting to be asked "Hey Vector! What is the weather report?" Press ctrl+c to exit early ------') try: if not done.wait(timeout=10): print('------ Vector never heard a request for the weather report ------') except KeyboardInterrupt: pass
- Parameters
event – an event containing UserIntent data
-
property
intent_data
¶ This gives access to any voice command specific data in JSON format.
Some voice commands contain information from processing. For example, asking Vector “Hey Vector, what is the weather?” will return the current location and the weather forecast.
Voice commands without additional information will have an empty intent_data.
- Return type
-
property
intent_event
¶ This returns the voice command event as a UserIntentEvent
- Return type