Projects

HEXAPOD — Inverse Kinematics and Gait Simulator

Active
Next.jsReact Three FiberThree.jsJavaScript
Product demo

Problem

Hexapod gait and leg IK are usually explained with equations and a video, or hidden inside a robotics library. Neither lets you feel what changing duty factor or step height actually does to a walking robot.

Business Impact

A working reference implementation of legged-robot IK and gait sequencing that runs in a tab. Useful for anyone building an actual hexapod, and a far better teaching artifact than a diagram because the parameters are live.

System Approach

  • Analytic 3-DOF leg IK — atan2 for coxa yaw, law of cosines for the femur-tibia planar two-link
  • Six legs solved per frame at 60 fps with no solver iteration
  • Gait engine as phase offsets plus per-leg duty factor — tripod, ripple, wave
  • Stance feet move backward in the body frame at exactly body velocity, eliminating foot slip
  • Swing trajectory as smoothstep forward return with sinusoidal lift
  • IK-to-FK round-trip self-check in the test suite
  • Live sliders for speed, stride, step height, body height, and stance width

Key Decisions & Trade-offs

  • Write the IK and gait math from scratch rather than pull a robotics library — the math is the project
  • Analytic IK over an iterative solver so six legs at 60 fps is trivial rather than tight
  • No foot slip as a hard constraint; it is the difference between a simulation and an animation
  • Browser over a native sim so the thing can simply be linked
  • UI and concept credit to Dilum Sanjaya's simulator, with the IK, gait math, and implementation written independently

Current Status

Public and open source at github.com/rohitguta2432/hexapod-simulator. All three gaits, the full parameter set, and the IK-to-FK verification test working. Runs with npm install and npm run dev.

Roadmap

  • Body pose control — translate and rotate the chassis over planted feet
  • Uneven terrain with per-leg ground adaptation
  • Export a gait to servo angle sequences for real hardware

What I'd Improve Next

  • Turning gaits, not just straight-line locomotion
  • A plot of per-leg phase so the duty factor is visible as well as felt

Explore More