← All practice sets

Practice · Unit 4 Inverse Kinematics

Inverse kinematics

arctan2 and its quadrant trap, the 2-link arm with the cosine rule, counting solutions from the distance, and linear FK solved by Gaussian elimination. Drag a target and watch both elbows.

The method formulary · (4.7)–(4.10), Q59–63

arctan2, not arctan

arctan2⁡(0,−1)=180∘butarctan⁡(0/−1)=0∘\operatorname{arctan2}(0, -1) = 180^\circ \quad\text{but}\quad \arctan(0/{-1}) = 0^\circ

arctan2 sees the signs of y and x separately, so it knows the quadrant. Casio: Pol(x, y), x first, the angle comes out as θ.

q₂ from the cosine rule (4.7)

cos⁡q2=x2+y2−a12−a222a1a2\cos q_2 = \frac{x^2 + y^2 - a_1^2 - a_2^2}{2 a_1 a_2}
sin⁡q2=±1−cos⁡2q2,q2=arctan2⁡(sin⁡q2,cos⁡q2)\sin q_2 = \pm\sqrt{1 - \cos^2 q_2}, \qquad q_2 = \operatorname{arctan2}(\sin q_2, \cos q_2)

The ± is the two elbows: q₂ > 0 elbow down, q₂ < 0 elbow up (Q63).

q₁ (4.10)

q1=arctan2⁡(y,x)−arctan2⁡(a2sin⁡q2, a1+a2cos⁡q2)q_1 = \operatorname{arctan2}(y, x) - \operatorname{arctan2}(a_2 \sin q_2,\ a_1 + a_2 \cos q_2)

Angle to the target, minus the angle the elbow bends the line away from link 1 (Q62).

How many solutions?

  • ‖X‖ > a₁ + a₂: none
  • ‖X‖ = a₁ + a₂: one (q₂ = 0)
  • inside: two (elbow up / down)
  • ‖X‖ = 0, a₁ = a₂: infinite (q₂ = π)

One link of length a: reachable only if ‖X‖ = a (Q59).

Linear FK: X = A q

Gaussian elimination on [ A∣X ]\text{Gaussian elimination on } [\,A \mid X\,]

Kill one variable at a time, back-substitute, then plug q into A q to check (Q60, Q61). Casio EQN mode solves it too.

Play with it drag the target

Solid = elbow down (q₂ > 0) · faint = elbow up · ring = workspace
2
1.5

Drill endless, mixed

Angles in degrees, between −180° and 180°. Targets are rounded to 3 decimals, so your angle only has to be within half a degree.

Loading…

Open