Hexapod Leg Inverse Kinematics: 3-DOF Cycloidal Step and Workspace
Calculate 3-DOF coxa–femur–tibia joint angles and speeds for a cycloidal swing. Animate the leg and explore joint-limited workspace and velocity manipulability.
A hexapod leg inverse kinematics calculation turns a requested foot path into commands for three joints. This tool models a serial coxa–femur–tibia leg with hip yaw and two parallel pitch axes. It is useful for engineers choosing link lengths and servos, students checking a robotics model, and builders planning a smooth swing before implementing a full gait controller.
Enter the distances between joint axes, then describe the swing by its horizontal midpoint, lift-off height, step length, clearance, direction and duration. Coordinates belong to the leg-fixed frame: the hip yaw axis is the origin, +z points upward, and the step direction is measured from +x toward +y. A negative lift-off height puts the ground below the hip. The midpoint coordinates refer to the horizontal midpoint of the step; the foot rises above that line during swing.
Choose the knee-bend sign and enter mechanical joint limits in the same geometric angle convention. Coxa yaw is zero along +x. Femur pitch is zero when the femur is horizontal and increases upward. Tibia bend is zero when femur and tibia are straight, and is measured relative to the femur. Servo horn offsets, reversed motors and pulse-width calibration must be applied separately.
Use the play control to follow one cycloidal foot trajectory from lift-off to touchdown. The results show instantaneous joint angles and signed velocities, peak absolute speed for each joint, the smallest angle margin over the swing and the duration needed for the entered common speed limit. The joint curves help distinguish a fast knee reversal from a fast yaw motion. A slower swing reduces every joint speed in inverse proportion to its duration.
The hexapod leg workspace maps answer where the foot can reach well. The radial section shows the selected knee branch subject to femur and tibia limits. Rotating that section through the allowed coxa yaw angles forms its three-dimensional workspace. The horizontal map cuts this volume at the entered lift-off height. Blank regions are excluded; color indicates relative Yoshikawa manipulability. The path overlay in the horizontal map is a plan projection, so its lifted portion lies above that plane.
The velocity ellipsoid shows directional motion capability at the animated pose for a unit Euclidean joint-rate norm. Its three rings are orthogonal principal sections. Isotropy compares the smallest and largest semi-axes; values near zero identify a difficult motion direction even when the foot is geometrically reachable.
This 3 DOF leg IK calculator covers a single fixed-base swing, not a complete walking gait. It does not determine support stability, actuator torque, acceleration limits, collisions, structural deflection, terrain contact or motor tracking. Check those separately before using the trajectory on hardware.
How it is calculated
The geometry follows Meisner's geometric hexapod IK derivation and pinned worked notebook (attached sources s1, s2 and s5, page 1). The implementation uses quadrant-aware atan2 and signed joint bends. With , and :
The knee branch has or . Reachability is checked before accepting results; the acos argument is clamped only to keep rejected configurations and roundoff from causing domain errors. Forward kinematics independently checks the complete sampled path.
The conventional composite cycloid is the baseline in Spider-Leg-Inspired Structural Design and Bézier Foot Trajectory Planning for Stable Walking of a Hexapod Robot (2026), DOI 10.3390/biomimetics11050352, section on composite cycloid trajectories. For , the distance along the step is and height is . Analytic derivatives supply Cartesian velocity.
The translational Jacobian is differentiated from and . Joint rates solve exactly, without damping. Yoshikawa (1985), DOI 10.1177/027836498500400201, defines . Here . The color maps divide this by the geometric upper bound , so color lies between zero and one. This normalization is separate from Yoshikawa's dimensional measure.
The eigenvectors of give the ellipsoid directions, and square roots of its eigenvalues give semi-axes (Lynch and Park, Modern Robotics, 2017, §5.4). The yaw direction decouples from the radial–vertical block, whose two eigenvalues are solved analytically. Isotropy is . The three displayed semi-axes are sagittal major, sagittal minor and tangential; their numerical ordering can change.
Assumptions
Rigid links and ideal revolute joints; the coxa offset is horizontal, the femur and tibia pitch axes are parallel, and the fixed hip frame does not translate during swing. Joint limits are geometric angles, with no servo offsets. IK selects the yaw pointing toward the foot and one continuous knee branch. Other configurations with the coxa pointing away from the foot are not included.
The velocity ellipsoid uses equal joint-rate weighting: rad/s. Displayed lengths in mm/rad become foot velocities in mm/s under that normalization. This sphere is not the box formed by three independent actuator speed limits. Defaults are an illustrative small robot geometry, not a particular commercial leg.
Where it applies
The tool evaluates 601 evenly spaced swing poses. Each workspace color mask is evaluated directly on a 256 × 256 grid, with excluded configurations kept empty. The outlines follow 721-point joint-limit curves; horizontal radial boundaries are located by bisection after a 1025-point scan, and yaw-sector edges are straight. Isocontours use a 101 × 81 radial–height grid and a 121 × 121 horizontal grid. Boundary detail below the display grid spacing and very narrow permitted or excluded radial intervals below the scan spacing can be missed. Swing extrema and limit margins are sampled estimates: very narrow limit violations or speed peaks between samples can be missed. Add margin when selecting actuators or paths near a boundary. Residual summaries round below 10⁻⁹ mm or mm/s to remove floating-point noise.
The radial map is independent of yaw and applies only within the entered yaw sector; the horizontal map includes all three joint limits. Its path overlay is the horizontal projection of the lifted path. The workspace maps show the full path and remain static during playback; the leg and velocity ellipsoid animate.
The conventional cycloid has zero endpoint velocity but nonzero vertical acceleration at lift-off and touchdown. Joining it directly to a stationary stance gives a vertical acceleration discontinuity; it is not a jerk-limited or impact-free contact model. Animation shows one swing and stops at touchdown. Playback uses a fixed display rate; reported velocities use the entered swing duration.
At a singularity, arbitrary Cartesian velocity has no unique finite joint-rate solution; singular pitch-rate samples on a moving trajectory are left undefined, including lift-off and touchdown where instantaneous foot velocity is zero. Finite one-sided limits can exist, but this Jacobian-inverse calculation does not substitute a trajectory limit for an undefined sample. Peak pitch speeds and the speed-only minimum duration are also undefined when any sampled pitch rate is undefined. Zero joint rates at a singular pose are assigned only when both step length and clearance are zero, making the entire trajectory stationary. Near singularities, a small foot perturbation may demand a large joint-speed change. Speed-only minimum duration is meaningful only for a reachable, continuous path satisfying joint-angle limits; it does not check torque or acceleration. The common speed limit is applied to each joint separately.
References
- Yoshikawa, T. (1985). Manipulability of Robotic Mechanisms. The International Journal of Robotics Research 4(2), 3–9. DOI: https://doi.org/10.1177/027836498500400201
- Meisner, R. Inverse Kinematics for a Hexapod Leg, updated 12 September 2026. https://catchit.pl/blog/inverse-kinematics-for-a-hexapod-leg/
- Meisner, R. Worked notebook, pinned commit e6c3b43a236786db4c871d0bb5884f6dae3bb335. https://github.com/robs-tech-workbench/hexapod_spiderbot_tutorials/blob/e6c3b43a236786db4c871d0bb5884f6dae3bb335/tutorial_inverse_kinematics/inverse_kinematics_code.ipynb
- Spider-Leg-Inspired Structural Design and Bézier Foot Trajectory Planning for Stable Walking of a Hexapod Robot (2026). Biomimetics 11(5), 352. DOI: https://doi.org/10.3390/biomimetics11050352
- Lynch, K. M. and Park, F. C. (2017). Modern Robotics, first edition, §5.4, Manipulability. https://modernrobotics.northwestern.edu/nu-gm-book-resource/5-4-manipulability/
Inputs
| Input | Symbol | Unit | Default |
|---|---|---|---|
| Coxa length | L_c | mm | 40 |
| Femur length | L_f | mm | 80 |
| Tibia length | L_t | mm | 130 |
| Knee branch The sign is the tibia rotation relative to the femur. | knee_branch | Negative bend (knee above) | |
| Step midpoint x | x_mid | mm | 140 |
| Step midpoint y | y_mid | mm | 20 |
| Lift-off and touchdown z The hip yaw axis is the origin; +z points upward. | z_base | mm | -110 |
| Step length | stride | mm | 80 |
| Foot clearance | lift | mm | 40 |
| Step direction Measured from +x toward +y in the leg-fixed frame. | heading | deg | 90 |
| Swing duration | T_sw | s | 0.7 |
| Swing progress Play runs once from lift-off to touchdown. | u | 0.35 | |
| Coxa minimum angle | q1_min | deg | -80 |
| Coxa maximum angle | q1_max | deg | 80 |
| Femur minimum angle | q2_min | deg | -90 |
| Femur maximum angle | q2_max | deg | 90 |
| Tibia minimum angle | q3_min | deg | -160 |
| Tibia maximum angle | q3_max | deg | 160 |
| Joint speed limit A common limit for the three joints; use the lowest actuator rating. | omega_max | deg/s | 300 |
Results
With the default inputs above, the calc gives:
| Result | Value |
|---|---|
| Swing assessment | Swing limits met |
| Coxa angle | -0.94 deg |
| Femur angle | 35.89 deg |
| Tibia angle | -110.18 deg |
| Coxa velocity | 74.24 deg/s |
| Femur velocity | 107.29 deg/s |
| Tibia velocity | -68.45 deg/s |
| Peak coxa speed | 91.9 deg/s |
| Peak femur speed | 133.5 deg/s |
| Peak tibia speed | 114.7 deg/s |
| Minimum duration for speed limit | 0.311 s |
| Swing joint-limit margin | 46.83 deg |
| Current Yoshikawa measure | 1,366,840 mm³ |
| Current isotropy | 0.327 |
| Minimum swing isotropy | 0.267 |
| Sagittal major semi-axis | 172.7 mm/rad |
| Sagittal minor semi-axis | 56.5 mm/rad |
| Tangential semi-axis | 140 mm/rad |
Checked against sources
Each case below was calculated by this calc and agrees with the value from its source (within the tolerance where one is shown).
Published 3-DOF IK target
Source: Robert Meisner, tutorial notebook, commit e6c3b43a236786db4c871d0bb5884f6dae3bb335, saved output for COXA=50, FEMUR=100, TIBIA=100 and target [70,70,-10]. Our signed knee bend is the negative of the notebook's positive theta3; yaw and femur conventions agree. https://github.com/robs-tech-workbench/hexapod_spiderbot_tutorials/blob/e6c3b43a236786db4c871d0bb5884f6dae3bb335/tutorial_inverse_kinematics/inverse_kinematics_code.ipynb
Inputs: Coxa length = 50 mm; Femur length = 100 mm; Tibia length = 100 mm; Step midpoint x = 70 mm; Step midpoint y = 70 mm; Lift-off and touchdown z = -10 mm; Step length = 0 mm; Foot clearance = 0 mm; Swing progress = 0.5; Coxa minimum angle = -180 deg; Coxa maximum angle = 180 deg; Femur minimum angle = -180 deg; Femur maximum angle = 180 deg; Tibia minimum angle = -180 deg; Tibia maximum angle = 180 deg; the others as above.
| Result | Source | This calc |
|---|---|---|
| Coxa angle | 45 deg | 45 deg |
| Femur angle | 63.985 deg | 63.985 deg |
| Tibia angle | -151 deg | -151 deg |
| Knee x | 66.369 mm | 66.369 mm |
| Knee z | 89.868 mm | 89.868 mm |
Published initialized straight-leg position
Source: Meisner pinned notebook e6c3b43, saved Current Target Position [250,0,-0] with lengths 50,100,100. This is the constructor's zero-angle, fully extended position. The notebook prints it next to later angles [30,45,60] because setAngles does not update its cached position; those displayed angles do NOT describe this target. The check uses the correct initialized geometry. Zero manipulability at this singular pose also follows Yoshikawa (1985), DOI 10.1177/027836498500400201.
Inputs: Coxa length = 50 mm; Femur length = 100 mm; Tibia length = 100 mm; Step midpoint x = 250 mm; Step midpoint y = 0 mm; Lift-off and touchdown z = 0 mm; Step length = 0 mm; Foot clearance = 0 mm; Swing progress = 0; the others as above.
| Result | Source | This calc |
|---|---|---|
| Current foot x | 250 mm | 250 mm |
| Coxa angle | 0 deg | 0 deg |
| Femur angle | 0 deg | 0 deg |
| Tibia angle | 0 deg | 0 deg |
| Current Yoshikawa measure | 0 mm³ | 0 mm³ |
| Current isotropy | 0 | 0 |
| Largest joint speed | 0 deg/s | 0 deg/s |

Responses