.NET SDK Documentation

    Show / Hide Table of Contents

    Class AnimationComponent

    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: PlayAnimation(Animation, UInt32, Boolean, Boolean, Boolean) and PlayAnimationTrigger(AnimationTrigger, UInt32, Boolean, Boolean, Boolean, Boolean). For PlayAnimationTrigger, you select a pre-defined group of animations, and the robot will choose which animation from the group to run when you execute the method. When calling PlayAnimation, you select the specific animation you want the robot to run. We advise you to use PlayAnimationTrigger instead of PlayAnimation, since individual animations can be deleted between Vector OS versions.

    By default, when an SDK program starts, the SDK will request a list of known animation triggers and animations from the robot, which will be loaded and available from GetAnimationTriggers() and GetAnimations(), respectively.
    Inheritance
    Object
    RobotObject
    Component
    AnimationComponent
    Implements
    INotifyPropertyChanged
    Inherited Members
    RobotObject.PropertyChanged
    Namespace: Anki.Vector
    Assembly: Anki.Vector.dll
    Syntax
    public class AnimationComponent : Component, INotifyPropertyChanged

    Properties

    | Improve this Doc View Source

    IsAnimating

    Gets a value indicating whether the SDK is running an animation

    public bool IsAnimating { get; }
    Property Type
    Boolean

    Methods

    | Improve this Doc View Source

    GetAnimations()

    Gets the list of animations returned from the robot.

    Animations are dynamically retrieved from the robot the first time this method is called and cached for subsequent requests.

    public Task<IReadOnlyDictionary<string, Animation>> GetAnimations()
    Returns
    Type Description
    Task<IReadOnlyDictionary<String, Animation>>

    A task that represents the asynchronous operation; the task result contains a dictionary of animations by name.

    | Improve this Doc View Source

    GetAnimationTriggers()

    Gets the the set of animation triggers returned from the robot.

    Animation triggers are dynamically retrieved from the robot the first time this method is called and cached for subsequent requests.

    Playing an animation trigger causes the robot to play an animation of a particular type.

    The robot may pick one of a number of actual animations to play based on Vector’s mood or emotion, or with random weighting. Thus playing the same trigger twice may not result in the exact same underlying animation playing twice.

    To play an exact animation, use PlayAnimation(Animation, UInt32, Boolean, Boolean, Boolean).

    public Task<IReadOnlyDictionary<string, AnimationTrigger>> GetAnimationTriggers()
    Returns
    Type Description
    Task<IReadOnlyDictionary<String, AnimationTrigger>>

    A task that represents the asynchronous operation; the task result contains a dictionary of animations triggers by name.

    | Improve this Doc View Source

    Play(IAnimation, UInt32, Boolean, Boolean, Boolean, Boolean)

    Starts an animation or animation trigger playing on robot.

    public Task<StatusCode> Play(IAnimation animationOrTrigger, uint loopCount = 1U, bool useLiftSafe = false, bool ignoreBodyTrack = false, bool ignoreHeadTrack = false, bool ignoreLiftTrack = false)
    Parameters
    Type Name Description
    IAnimation animationOrTrigger

    The animation or animation trigger to play.

    UInt32 loopCount

    The loop count.

    Boolean useLiftSafe

    if set to true automatically ignore the lift track if Vector is currently carrying an object.

    Boolean ignoreBodyTrack

    if set to true ignore the animation track for Vector’s body (i.e. the wheels / treads).

    Boolean ignoreHeadTrack

    if set to true ignore the animation track for Vector’s head.

    Boolean ignoreLiftTrack

    if set to true ignore the animation track for Vector’s lift.

    Returns
    Type Description
    Task<StatusCode>

    A task that represents the asynchronous operation; the task result contains the result from the robot.

    Remarks

    Requires behavior control; see RequestControl(Int32).

    Exceptions
    Type Condition
    ArgumentException

    Parameter is not an Animation or AnimationTrigger

    | Improve this Doc View Source

    PlayAnimation(Animation, UInt32, Boolean, Boolean, Boolean)

    Starts an animation playing on a robot.

    public Task<StatusCode> PlayAnimation(Animation animation, uint loopCount = 1U, bool ignoreBodyTrack = false, bool ignoreHeadTrack = false, bool ignoreLiftTrack = false)
    Parameters
    Type Name Description
    Animation animation

    The animation to play.

    UInt32 loopCount

    Number of times to play the animation.

    Boolean ignoreBodyTrack

    if set to true ignore the animation track for Vector’s body (i.e. the wheels / treads).

    Boolean ignoreHeadTrack

    if set to true ignore the animation track for Vector’s head.

    Boolean ignoreLiftTrack

    if set to true ignore the animation track for Vector’s lift.

    Returns
    Type Description
    Task<StatusCode>

    A task that represents the asynchronous operation; the task result contains the result from the robot.

    Remarks

    Requires behavior control; see RequestControl(Int32).

    | Improve this Doc View Source

    PlayAnimation(String, UInt32, Boolean, Boolean, Boolean)

    Starts an animation playing on a robot.

    public Task<StatusCode> PlayAnimation(string animationName, uint loopCount = 1U, bool ignoreBodyTrack = false, bool ignoreHeadTrack = false, bool ignoreLiftTrack = false)
    Parameters
    Type Name Description
    String animationName

    Name of the animation to play.

    UInt32 loopCount

    Number of times to play the animation.

    Boolean ignoreBodyTrack

    if set to true ignore the animation track for Vector’s body (i.e. the wheels / treads).

    Boolean ignoreHeadTrack

    if set to true ignore the animation track for Vector’s head.

    Boolean ignoreLiftTrack

    if set to true ignore the animation track for Vector’s lift.

    Returns
    Type Description
    Task<StatusCode>

    A task that represents the asynchronous operation; the task result contains the result from the robot.

    Remarks

    Requires behavior control; see RequestControl(Int32).

    Exceptions
    Type Condition
    KeyNotFoundException

    Unknown animation '{animationName}'

    | Improve this Doc View Source

    PlayAnimationTrigger(AnimationTrigger, UInt32, Boolean, Boolean, Boolean, Boolean)

    Starts an animation trigger playing on a robot.

    Playing a trigger requests that an animation of a certain class starts playing, rather than an exact animation name.

    public Task<StatusCode> PlayAnimationTrigger(AnimationTrigger animationTrigger, uint loopCount = 1U, bool useLiftSafe = false, bool ignoreBodyTrack = false, bool ignoreHeadTrack = false, bool ignoreLiftTrack = false)
    Parameters
    Type Name Description
    AnimationTrigger animationTrigger

    The animation trigger to play.

    UInt32 loopCount

    The loop count.

    Boolean useLiftSafe

    if set to true automatically ignore the lift track if Vector is currently carrying an object.

    Boolean ignoreBodyTrack

    if set to true ignore the animation track for Vector’s body (i.e. the wheels / treads).

    Boolean ignoreHeadTrack

    if set to true ignore the animation track for Vector’s head.

    Boolean ignoreLiftTrack

    if set to true ignore the animation track for Vector’s lift.

    Returns
    Type Description
    Task<StatusCode>

    A task that represents the asynchronous operation; the task result contains the result from the robot.

    Remarks

    Requires behavior control; see RequestControl(Int32).

    | Improve this Doc View Source

    PlayAnimationTrigger(String, UInt32, Boolean, Boolean, Boolean, Boolean)

    Starts an animation trigger playing on a robot.

    Playing a trigger requests that an animation of a certain class starts playing, rather than an exact animation name.

    public Task<StatusCode> PlayAnimationTrigger(string animationTriggerName, uint loopCount = 1U, bool useLiftSafe = false, bool ignoreBodyTrack = false, bool ignoreHeadTrack = false, bool ignoreLiftTrack = false)
    Parameters
    Type Name Description
    String animationTriggerName

    Name of the animation trigger to play.

    UInt32 loopCount

    The loop count.

    Boolean useLiftSafe

    if set to true automatically ignore the lift track if Vector is currently carrying an object.

    Boolean ignoreBodyTrack

    if set to true ignore the animation track for Vector’s body (i.e. the wheels / treads).

    Boolean ignoreHeadTrack

    if set to true ignore the animation track for Vector’s head.

    Boolean ignoreLiftTrack

    if set to true ignore the animation track for Vector’s lift.

    Returns
    Type Description
    Task<StatusCode>

    A task that represents the asynchronous operation; the task result contains the result from the robot.

    Remarks

    Requires behavior control; see RequestControl(Int32).

    | Improve this Doc View Source

    WaitForAnimationCompletion()

    Waits for the current animation to complete.

    The task will complete when animation is finished. If no animation is running, this method will return immediately.

    public Task<bool> WaitForAnimationCompletion()
    Returns
    Type Description
    Task<Boolean>

    A task that represents the asynchronous operation. The task result is false if no task was running.

    Implements

    System.ComponentModel.INotifyPropertyChanged

    See Also

    Component
    • Improve this Doc
    • View Source
    Back to top Copyright (c) 2019 by Wayne Venables