Skip to content
Lab
manipulator control rigid-body dynamics · computed torque · damped least squares

Robot Arm Lab

Four identical three-link arms follow the same trajectory at the same time. The only difference is how each computes its joint torques: decentralised PID per joint, PD with gravity compensation, PD with inverse-dynamics feedforward on the reference (FF+PD), and computed torque control (CTC), which cancels the whole arm's dynamics. Hand them a payload the model does not know about, weaken the drives, or stretch the arm towards a singularity, and see in numbers which assumption breaks and when.

Presets
t 0.00 / 0.00 s READY
Work cell · side view PIDPD+gFF+PDCTC reference straight line
tool error ×10
ep PID—
ep PD+g—
ep FF+PD—
ep CTC—
τ {focus} J1/J2/J3—
w · cond(J)—
IK λmax · resid.—
Telemetry vs. time PIDPD+gFF+PDCTC drive limit gripper closed
Run summary not started
MetricPIDPD+gFF+PDCTC
RMS tool error ep ————
Peak tool error max ep ————
Placement error at release ————
Final error end of dwell ————
RMS joint error eq ————
Peak torque use |τ|/τmax ————
Saturated time share ————
Drive energy ∫Peldt ————

Green marks the best value in a row. Tool error is the tool-tip position against the reference joint trajectory; drive energy counts copper loss kiτi2 plus positive mechanical power, with no regeneration.

Payload sweep · 0–5 kg queued

Full-cycle batch runs in a worker: the actual payload varies, the model keeps m̂p (dashed line). Hollow markers: the drive tripped (following error > 100 mm or floor contact).

Plant · rigid-body dynamics

M(q) q̈ + C(q, q̇) q̇ + g(q) + Fvq̇ + Fc tanh(q̇/vs) = sat(τ)

Inverse dynamics by recursive Newton–Euler; M(q) from three unit-acceleration passes, q̈ by Cholesky. Rotor inertia N²Jm added on the diagonal. RK4 at 0.5 ms with τ held over the 1 ms control period.

Links 0.45 / 0.38 / 0.22 m, 6 / 4 / 1.6 kg; drives 130 / 75 / 20 N·m. The payload is a point mass that exists only while the gripper is closed.

Controllers · e = qr − q

PID τi = kp,iei + kd,iėi + ki,i∫ei

PD+g τ = Kpe + Kdė + ĝ(q)

FF+PD τ = ID̂(qr, q̇r, q̈r) + Kpe + Kdė

CTC τ = M̂(q)(q̈r + ωn2e + 2ζωnė) + ĥ(q, q̇)

Decentralised gains kp,i = M̂ii(q0)ωn2, kd,i = 2ζωnM̂ii, ki = kpωn/8 with conditional anti-windup. Hats use m̂p.

Kinematics & reference

Δq = Jᵀ(JJᵀ + λ²I)⁻¹ e, λ² = λ02(1 − (σmin/ε)2) for σmin < ε

w = √det(JvN NTJvT), N ⟂ [1 1 1] (tool angle held)

Quintic s(u) = 10u³ − 15u⁴ + 6u⁵ or a trapezoidal velocity with ¼ ramps. Task space: tool on a straight line, IK every millisecond. Joint space: joint angles interpolated between the same IK waypoints.

Avg. controller step — µs (4 arms, this browser).

What to look for

Things worth watching

  • With the right model the two model-based controllers (FF+PD, CTC) track tens of times better than PID and PD+g. What remains comes from the 1 ms zero-order hold and the lag of the encoder velocity estimate.
  • With an unknown payload most of computed torque's advantage disappears. In the payload sweep the FF+PD and CTC curves bottom out only where the actual payload equals the model payload m̂: computed torque is exactly as good as the model it is given.
  • When torque saturates the premise of feedback linearisation, that the commanded acceleration can be produced, no longer holds. If the drives cannot hold the arm, they trip on following error.
  • At full stretch the manipulability ellipse flattens, and small tool motions need large joint motions. Joint-space interpolation passes between the same waypoints on a curve.
control
1 kHz
plant
RK4 · 0.5 ms
links
0.45/0.38/0.22 m
drives
130/75/20 N·m
Simulation scope

What is simplified

The plant is a rigid 3R arm moving in a vertical plane. Its dynamics are exact (the tests check the mass matrix, energy conservation and the work–energy balance), but there is no joint flexibility, gear backlash, current loop or contact. Rotor inertia is added on the diagonal only, and Coulomb friction is smoothed with tanh. The payload is a point mass at the tip while the gripper is closed; collisions with the tables are not computed (only floor contact is detected). To keep the comparison fair all four controllers share one ωn and ζ. In practice each would be tuned on its own, so read trends rather than absolute values.