Last active
August 25, 2019 08:37
-
-
Save acidzebra/5e23b6dd46e3bee93e12b561e431ce68 to your computer and use it in GitHub Desktop.
Converts text to Vector's beeps, whistles, and warbles.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Copyright (c) 2019 acidzebra | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# https://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# | |
# for use with Anki's awesome Vector robot: https://www.anki.com/en-us/vector | |
# | |
import anki_vector | |
with anki_vector.Robot(requires_behavior_control=True) as robot: | |
text = "hello" | |
convert = str.lower(text) | |
translations = { | |
("a","anim_blackjack_getin_01"), | |
("b","anim_blackjack_deal_01"), | |
("c","anim_feedback_bequiet_01"), | |
("d","anim_lookatphone_getin_01"), | |
("e","anim_hiking_react_05"), | |
("f","anim_inspectheldcube_cubemissing_01"), | |
("g","anim_message_getin_01"), | |
("h","anim_keepaway_hit_reaction_01"), | |
("i","anim_eyecontact_squint_01"), | |
("j","anim_reacttoblock_ask_01_0"), | |
("k","anim_movement_comehere_reaction_01"), | |
("l","anim_reacttocliff_edge_04"), | |
("m","anim_eyecontact_giggle_01"), | |
("n","anim_reacttoblock_happydetermined_02"), | |
("o","anim_blackjack_spread_01"), | |
("p","anim_petting_bliss_getout_01"), | |
("q","anim_photo_shutter_01"), | |
("r","anim_petting_lvl2_01"), | |
("s","anim_hiking_react_06"), | |
("t","anim_reacttoblock_react_short_01"), | |
("u","anim_knowledgegraph_success_01"), | |
("v","anim_blackjack_victorbjackwin_01"), | |
("w","anim_handdetection_reaction_01"), | |
("x","anim_knowledgegraph_fail_01"), | |
("y","anim_greeting_imhome_01"), | |
("z","anim_explorer_huh_far_01") | |
} | |
print ("translating ", convert, " to Vectorian") | |
for i, c in enumerate(convert): | |
for k,v in translations: | |
if k == c: | |
print ("letter ", c, " translates to ", v) | |
robot.anim.play_animation(v, ignore_body_track=True, ignore_head_track=False, ignore_lift_track=True) | |
print ("translation complete!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment