Goal

Understand how to create and play new animations on Kuri.

Overview

Animation is at the core of Kuri’s personality. It’s how she expresses intent, communicates feedback to the user, and builds up the illusion of being a living creature with her own thoughts and personality quirks.

Playing an Animation

Every time you see Kuri nod her head in response to a voice command, you’re seeing an animation called gotit at work. Let’s try to play it on demand.

First, place Kuri in animation mode with the following command:

rostopic pub /command gizmo_msgs/Command '{ name: start_animation }' -1

In animation mode, all autonomous behavior will be suspended and Kuri will not react to touch or voice input.

Then tell Kuri to play the gotit animation:

rostopic pub /command gizmo_msgs/Command '{ name: play_stored_animation_command, params: [{ k: "name", v: "gotit" }] }' -1

Kuri should nod, play a sound and her chest light should pulse green.

If you’d like to experiment with other animations, take a look at the list of built-in animations at the end of this document and substitute the name gotit in the example above with the name of the animation you want to play.

What’s in an Animation

As you saw in the gotit example, Kuri’s animations have 3 basic components:

An animation is a combination of any of the 3 components. Now, let’s take a look at each one of the files that back these components.

Movement

Animation files that describe Kuri’s movement are stored in /opt/gizmo/share/assets/anims. Each file is in the .atom format, developed by Autodesk for Maya.

Note that while .atom files can include animations that move the body forwards or backwards, those movements will be ignored by the animation parser. For now, only rotation of the body is supported through animation defined in .atom files.

Sound

Kuri’s sounds are stored in /opt/gizmo/share/assets/sounds as .wav files. Each file has the following properties:

Light

Chest light animations are stored in /opt/gizmo/share/assets/movies as .mov files. Each frame of video is sampled in 15 locations - each corresponding to one of the 15 LEDs of the chest light. When building your own chest light animations, make sure the exported files have the following properties:

Animation Containers

The individual components are combined into a single performance through a simple JSON wrapper called an animation container. Animation containers are stored in /opt/gizmo/share/assets/anims/containers and have the following structure:

{
  "animation": "test.atom",
  "relative": true,
  "audio": [
    {
        "file": "test.wav",
        "time": 0.0
    },
    {
        "file": "test2.wav",
        "time": 2.2
    }
  ],
  "chest": "test.mov"
}

Here’s what the different fields in the container describe:

The name of the container becomes the name of the animation at runtime, so a container named gotit.json describes an animation called gotit.

Animation Sets

Animation sets provide additional flexibility when working with animations by letting you:

Animation sets are defined in /opt/gizmo/share/gizmo/configs/animation_sets.json. Here’s what an example set looks like:

{
  "test_set": {
    "neutral": [
      {
        "default_anim": "yes",
        "weight": 1.0,
        "dock_variant": "yes_docked"
      }
    ],
    "happy": [
      {
        "default_anim": "yes_happy",
        "weight": 0.8,
        "dock_variant": "yes_happy_docked"
      },
      {
        "default_anim": "no_happy",
        "weight": 0.2,
        "dock_variant": "no_happy_docked"
      }
    ],
    "sad": [
      {
        "default_anim": "yes_sad",
        "weight": 1.0,
        "dock_variant": "yes_sad_docked"
      }
    ]
  },
  ...
}

Each key: value pair in the JSON object represents a single animation set. In the example above, test_set is the name of the animation set. When the animation player is asked to play an animation with a specific name, it will check to see if a set by that name exists first. Each object representing a set has the following properties:

Each animation in the arrays above has the following properties:

Creating Your Own Animations

Animating Movement

You will need:

Follow the installation instructions in the plug-in package to enable the Kuri Animator menu in Maya’s menu bar. Once that’s done, start Kuri Bridge and connect to your robot. Kuri Bridge will enable animations that you’re working on in Maya to play directly on the robot. The Maya plug-in uses the bridge by default, so there’s no further configuration you need to do.

Open the Kuri_v1.ma template included in the plug-in package. You should see a 3D model of Kuri and controls for the different joints that can be animated (the eyelid and head controls are to Kuri’s right, while the body controls are around the base of the robot).

Maya Kuri Rig

If you want to test out your animation at any point, open the Kuri Animator menu and select Play Animation.

Once you’re done with your animation, select Kuri Animator > Export animation to file. This will save a .atom file with the animation you just created.

Copy the resulting .atom file to /opt/gizmo/share/assets/anims.

Animating the Chest Light

You will need:

Open the KuriChestLightRig.aep template. It looks like this:

After Effects Rig

The template includes a few different presets for chest light animations, such as a pulse, and a starburst, but you can create your own by animating each of the individual LED layers in the rig.

Once your animation is ready, export it as a .mov file (in AE’s export settings, choose QuickTime as format). Since the latest version of AE doesn’t export to h.264 by default, the resulting file will be quite large. It’s recommended that you transcode it to h.264 to reduce the file size.

Copy the resulting .mov file to /opt/gizmo/share/assets/movies.

Create an Animation Container

There are a few different ways to do this:

Copy the .json container file to /opt/gizmo/share/assets/anims/containers. Then, restart gizmo:

sudo service gizmo restart

If you replaced one of the built-in animations, you will also need to clear the asset cache:

sudo rm -rf /tmp/cache
sudo service gizmo restart

Then, play your animation:

rostopic pub /command gizmo_msgs/Command '{ name: start_animation }' -1
rostopic pub /command gizmo_msgs/Command '{ name: play_stored_animation_command, params: [{ k: "name", v: "name_of_your_animation" }] }' -1

You can wire up your new animation to various triggers using the rules engine (see managing-rules).

List of Built-In Animations

Programmatic Animations

Programmatic animations are written in Python and are part of Kuri’s codebase. They can’t be modified, and will take precedence over an animation from an animation container with the same name.

Animations from Animation Containers

Animations from animation containers live under the /opt/gizmo/share/assets directory. The files are editable and can be easily inspected.