Awesome Anki Vector Save

Anki Vector AI++

Project README

Table of contents

Anki Vector AI++

Anki Vector - The Home Robot With Interactive AI Technology.

Well, I bought this little guy at 10 Feb 2019, if you want a robot pet, and you want to do some AI programming on it, then I highly recommend you to get Anki Vector.

I build this project to share my codes and docs.

Object detection

This program is to enable Vector to detect objects with its camera, and tell us what it found.

We take a photo from Vector's camera, then post to Google Vision Service, then Google Vision Service returns the object detection result, finally, we turn all the label text into a sentence and send to Vector so that Vector can say it out loud.

Here are some demo videos:

  1. Vector detected a watch on my desk.


  1. Vector detected a bear on my phone’s album.


  1. Vector detected a game controller on my desk.


  1. Vector was exploring on my desk as usual and randomly tell me what it found.


Well, let's see how to do it.

Run the code yourself

  1. Install Vector Python SDK. You can test the SDK by running any of the example from anki/vector-python-sdk/examples/tutorials/
  2. Set up your Google Vision account. Then follow the Quickstart to test the API.
  3. Clone this project to local. It requires Python 3.6+.
  4. Don forget to set Google Vision environment variable GOOGLE_APPLICATION_CREDENTIALS to the file path of the JSON file that contains your service account key. e.g. export GOOGLE_APPLICATION_CREDENTIALS="/Workspace/Vector-vision-62d48ad8da6e.json"
  5. Make sure your computer and Vector in the same WiFi network. Then run python3
  6. If you are lucky, Vector will start the first object detection, it will say "My lord, I found something interesting. Give me 5 seconds."

How it works

  1. Connect to Vector with enable_camera_feed=True, because we need the API.
robot = anki_vector.Robot(anki_vector.util.parse_command_args().serial, enable_camera_feed=True)
  1. We'll need to show what Vector see on its screen.
def show_camera():
    print('Show camera')

and close the camera after the detection.

def close_camera():
    print('Close camera')
  1. We'll save take a photo from Vector's camera and save it later to send to Google Vision.
def save_image(file_name):
    print('Save image'), 'JPEG')
  1. We post the image to Google Vision and parse the result as a text for Vector.
def detect_labels(path):
    print('Detect labels, image = {}'.format(path))
    # Instantiates a client
    # [START vision_python_migration_client]
    client = vision.ImageAnnotatorClient()
    # [END vision_python_migration_client]

    # Loads the image into memory
    with, 'rb') as image_file:
        content =

    image = types.Image(content=content)

    # Performs label detection on the image file
    response = client.label_detection(image=image)
    labels = response.label_annotations

    res_list = []
    for label in labels:
        if label.score > 0.5:

    print('Labels: {}'.format(labels))
    return ', or '.join(res_list)
  1. Then we send the text to Vector and make it say the result.
def robot_say(text):
    print('Say {}'.format(text))
  1. Finally, we put all the steps together.
def analyze():
    robot_say('My lord, I found something interesting. Give me 5 seconds.')

    robot_say('Prepare to take a photo')


    robot_say('Start to analyze the object')
    text = detect_labels(image_file)
    robot_say('Might be {}'.format(text))

    robot_say('Over, goodbye!')

  1. We want Vector randomly active the detection action, so we wait for a random time (about 30 seconds to 5 minutes) for the next detection.
def main():
    while True:
        except Exception as e:
            print('Analyze Exception: {}', e)

        time.sleep(random.randint(30, 60 * 5))
  1. When Vector success to active the detection action, you should see logs:
2019-02-17 21:55:42,113 anki_vector.robot.Robot WARNING  No serial number provided. Automatically selecting 009050ae
Connect to Vector...
2019-02-17 21:55:42,116 anki_vector.connection.Connection INFO     Connecting to for Vector-M2K2 using /Users/
2019-02-17 21:55:42,706 anki_vector.connection.Connection INFO     control_granted_response {

Show camera
Say My lord, I found something interesting. Give me 5 seconds.
Say Prepare to take a photo
Say 3
Say 2
Say 1
Say Cheers
Save image
Show image = /Workspace/labs/Anki-Vector-AI/resources/latest.jpg
Display image on Vector's face...
Say Start to analyze the object
Detect labels, image = /Workspace/labs/Anki-Vector-AI/resources/latest.jpg
Labels: [mid: "/m/08dz3q"
description: "Auto part"
score: 0.6821197867393494
topicality: 0.6821197867393494
Show image = /Workspace/labs/Anki-Vector-AI/resources/latest.jpg
Display image on Vector's face...
Say Might be Auto part
Close camera
Say Over, goodbye!
2019-02-17 21:56:12,460 anki_vector.connection.Connection INFO     control_lost_event {

2019-02-17 21:56:12,460 anki_vector.robot.Robot WARNING  say_text cancelled because behavior control was lost
2019-02-17 21:56:12,461 anki_vector.util.VisionComponent INFO     Delaying disable_all_vision_modes until behavior control is granted
2019-02-17 21:56:12,707 anki_vector.connection.Connection INFO     control_granted_response {

Vector disconnected

You can find the latest photo that Vector uses to detention in resources/latest.jpg.

Shoes placed

This program is to enable Vector to place shoes for us. Vector will place our shoes when we're not at home, so we can leave home without worry about the shoes, especially when we're in a hurry.

This program is in research. I'll share the plan, the design, the docs, the codes here. I highly recommend you make an issue on GitHub so we can talk about it further if you're interesting, any help is welcome!

The design proposal is in this Google doc.


Here is a draft demo video I made to give you guys a sense of the program:


Open Source Agenda is not affiliated with "Awesome Anki Vector" Project. README Source: open-ai-robot/awesome-anki-vector
Open Issues
Last Commit
3 years ago

Open Source Agenda Badge

Open Source Agenda Rating