# Tom Reads Papers: Locomotion Skills

Today’s paper is: Locomotion Skills for Simulated Quadrupeds. Let’s dive in.

This one is co-authored by none other than Andrej Karpathy, who is now head of AI at Tesla, and was done with people from Disney. Written six years ago. It comes with some great videos, and binaries for running the simulations, but unfortunately no source code. The dog part mesh models are provided as individual obj files though.

The paper has a neat way of expressing gaits. These nice four-row graphs show the dog’s rear legs outside the two front legs, with the bars showing when the legs are swinging. With this in mind, you can see the legs are diagonal pretty quickly in the trot graph, outside left and inside right:

Their simulator looks pretty nice. The paper doesn’t mention any implementation details, and the binary only hints at OpenGL and TCL. I would guess Bullet for physics. But it was six years ago, so who knows.

Control
The control loop provides torques to the simulator at every time step. Of course the torques are calculated using PD controllers. There are also “virtual internal forces” which add to the torques… not sure what they’re about. “These allow the skeletal structure to be largely abstracted away by specifying coordinated sets of internal torques.”

Each joint has a PD controller, except for the hips when in stance (does this exclude shoulder joints in stance as well?).

Inverse kinematics is used to provide target angles for leg joints using trajectories.

The spine torques are tricky ones… they interpolate the pose of the front and back of the body across the spine joints (using quaternions).

Gaits
They simulate walk, trot, pace (reverse trot), canter, transverse gallop, and rotary gallop. The timings for these all come from dog videos (other than canter).

Walking
Input to each frame is stride phase, and dt (time delta).

It’s optimised to minimise the sum of squared distance errors to reference motions.

As is tradition with legged robots, they tested its robustness by applying forces to it while it walks, i.e. kicking it.

They suggest watching YouTube dog training videos to get sit and stand sequences for dogs. They found, to stand up from a sit: Back legs step forward and slightly outward. Then hips are raised. To sit down, back legs step forward and slightly outward, and hips are lowered.

Other notes: The flexible spine seems key, as without it the dog had trouble walking comfortably. Their simulated dog can leap, but not land. That seems mean to the simulated dog.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.