Want to play some Anki Vector Animations? Kinvert will show you how by using play_animation. Do something new with your robot and learn Coding here.
Anki Vector Animations Intro
You’ve gotta love the animations that help bring Vector to life. This was a big part of what made Cozmo so lovable. In this article we will be showing you how to play Anki Vector animations using the SDK.
If you are interested in the differences between Cozmo and Vector go check out our Anki Cozmo vs Vector Comparison.
We will be using the Anki Vector SDK in this article. This is one of many of Kinvert’s Anki Vector Examples in Python. If you want to see more examples of programming Vector, be sure to head over to that article.
Have a Cozmo but not a Vector? You can do the same thing with Cozmo with the Cozmo SDK.
The program we’ll be using for this first Anki Vector Animations Example will be pretty simple. In the future we’ll be releasing some articles that go a bit more in depth.
We will look at the commands first before diving in to the code.
Anki Vector Animation Commands
What commands will we be using? Here they are:
This program basically just makes sure Vector is driven off the charger, then we play the Anki Vector Animation. Pretty simple.
When the online documentation is available we’ll link to it. In the meantime check out this article Anki wrote about us here: https://developer.anki.com/blog/features/interview/from-stem-to-learn/
The Code for Anki Vector Animations
The code here is pretty simple. We’re literally just driving off the charger and then playing the animation.
We hse anki_vector.Robot.behavior.drive_off_charger() to drive off the charger. Then we use anki_vector.Robot.anim.play_animation() to play the animation. Note that we give the name of the Anki Vector Animation as a string to the function as an argument.
""" Copyright Kinvert All Rights Reserved If you would like to use this code for business or education please contact us for permission at: www.kinvert.com/ """ import anki_vector def main(): args = anki_vector.util.parse_command_args() with anki_vector.Robot(args.serial) as robot: robot.behavior.drive_off_charger() robot.anim.play_animation('anim_greeting_hello_01') if __name__ == "__main__": main()
How would you get Vector to play a different animation?
I hope this Anki Vector Example Using the SDK article helped you play Anki Vector animations. We’re writing a lot more examples and a ton more are available at the previous link.
Did this article help you? Did you make a modification? Please let us know in the comments below.
Cozmo Examples, Tutorials, and Projects for STEM Education Curriculum is the place for Cozmo examples, in case you don’t have Vector yet.