Skip to content

Lab.

Three small experiments that run in your browser. They use the same maths I use on the real arms, cut down to two dimensions.

Teach the arm

Show the arm a motion once and it learns it. Move the goal and it adapts, keeping the shape. The simplest version of learning from demonstration I know.

Exp. 1 · Teach the arm

  1. Press and drag anywhere on the canvas. The arm follows and draws.
  2. Drag the blue goal marker. The dashed line is the new plan.
  3. Press Run.
startgoal, drag meDrag to move the goal

This is a sample demonstration. Press and drag anywhere on the canvas to draw your own.

What is going on

The learned motion is a Dynamic Movement Primitive: a damped spring that pulls the pen straight to the goal, plus a learned force that bends the path into the shape you drew.

That force is a row of bell-shaped bumps, and learning picks a height for each in well under a millisecond. The force fades out as a clock runs down to zero, so the spring always wins at the end and the motion arrives at whatever goal you pick. Moving the goal rotates and stretches the shape instead of breaking it.

τ·v̇ = K(g − y) − D·v − K(g − y₀)·x + K·f(x)
τ·ẏ = v
τ·ẋ = −α·x                (the clock)

f(x) = Σ ψᵢ(x)·wᵢ / Σ ψᵢ(x) · x
ψᵢ(x) = exp(−hᵢ (x − cᵢ)²)

Critically damped, so it never overshoots the goal. Formulation from Ijspeert et al. (2013) with the goal-scaling fix of Pastor et al. (2009).

Where it falls short

One demonstration, no idea of variance, no obstacles, no forces. Real robot learning from people uses many demonstrations and learns a policy that reacts to what it sees (diffusion policies, action-chunking transformers). A DMP is still what I reach for when a motion must provably reach its goal.

How the arm moves

The arm on the home page has three joints but its pen tip only has two coordinates. That leaves one joint spare, and the controller uses it to keep the pen leaning at a natural angle, like your wrist when you write.

Hundreds of times a second the controller asks the Jacobian which joint speeds close the gap to where the pen should be. Near a singularity (arm stretched straight), a damping term trades a little accuracy for not flailing.

The signature is a single-stroke Hershey script font from 1967, drawn with the minimum-jerk speed profile human arms produce, which is why it looks unhurried.

q̇ = J⁺(ẋ_d + Kp·e) + (I − J⁺J)·q̇₀
J⁺ = Jᵀ(JJᵀ + λ²I)⁻¹       (damped least squares)

q̇₀ = k·(φ_ref − φ)·[1 1 1]ᵀ  (pen angle, in the nullspace)
s(τ) = 10τ³ − 15τ⁴ + 6τ⁵    (minimum jerk)

Kinematic only: no masses, no torque limits. On the real Kinova arms the same structure sits on top of the robot's velocity control, and the hard part is everything around it: frames, latency, limits.

Kinematics bench

A plain three-link arm. Drag any joint, add a payload and watch the holding torques. The manipulability ellipse shows which directions the tip can move easily; when it flattens into a line, you are near a singularity.