anki_vector.animation

Animation related classes, functions, events and values.

Animations represent a sequence of highly coordinated movements, faces, lights, and sounds used to demonstrate an emotion or reaction.

Animations can control the following tracks: head, lift, treads, face, audio and backpack lights.

There are two ways to play an animation on Vector: play_animation and play_animation_trigger (not yet implemented). When calling play_animation, you select the specific animation you want the robot to run. For play_animation_trigger, you select a group of animations, and the robot will choose which animation from the group to run when you execute the method.

By default, when an SDK program starts, the SDK will request a list of known animations from the robot, which will be loaded into anim_list in the AnimationComponent.

Classes

AnimationComponent(robot) Play animations on the robot
class anki_vector.animation.AnimationComponent(robot)

Play animations on the robot

anim_list

Holds the set of animation names (strings) returned from the robot.

Animation names are dynamically retrieved from the robot when the Python script connects to it.

import anki_vector

with anki_vector.Robot() as robot:
    print("List all animation names:")
    anim_names = robot.anim.anim_list
    for anim_name in anim_names:
        print(anim_name)
load_animation_list()

Request the list of animations from the robot

When the request has completed, anim_list will be populated with the list of animations the robot knows how to run.

import anki_vector

with anki_vector.AsyncRobot() as robot:
    anim_request = robot.anim.load_animation_list()
    anim_request.result()
    anim_names = robot.anim.anim_list
    for anim_name in anim_names:
        print(anim_name)
play_animation(anim, loop_count=1, ignore_body_track=False, ignore_head_track=False, ignore_lift_track=False)

Starts an animation playing on a robot.

Vector must be off of the charger to play an animation.

Warning: Specific animations may be renamed or removed in future updates of the app.
If you want your program to work more reliably across all versions we recommend using play_animation_trigger() instead. (play_animation_trigger() is still in development.)
import anki_vector

with anki_vector.Robot() as robot:
    robot.anim.play_animation('anim_turn_left_01')
Parameters:
  • anim (str) – The animation to play. Can be of type str or anki_vector.protocol.Animation.
  • loop_count (int) – Number of times to play the animation.
  • ignore_body_track (bool) – True to ignore the animation track for Vector’s body (i.e. the wheels / treads).
  • ignore_head_track (bool) – True to ignore the animation track for Vector’s head.
  • ignore_lift_track (bool) – True to ignore the animation track for Vector’s lift.