Bird-Leg Inverse Kinematics
3.6 mmankle RMS error after optimisation

Challenge
A bird leg has four actuated joints but only three foot coordinates to control, so the leg is redundant. Reproducing the measured toe, ankle, knee and hip trajectories on a real walking cycle requires handling that redundancy without letting the joint angles drift.
Solution
Foot Jacobian pseudo-inverse plus a null-space term that keeps the joint angles close to the rest pose. The four joint-axis angles (second hip, ankle) were then optimised with scipy.optimize.minimize (Nelder–Mead, multi-start) to bring the model's knee and ankle closer to the measured ones.
Impact
Foot follows the measured trajectory with an error below 0.07 mm and the motion stays periodic. Ankle RMS error drops by 30 % (5.1 → 3.6 mm), knee error stays at 5.9 mm — the remaining gap comes from rigid segments vs. 5–11 % varying measured lengths.