Bent SCARA arm with exposed rotary encoder discs positioning its quill over a violet reference target.

What you need

Use a calculator or Python with a two-link drawing. Define the elbow angle relative to the first link.

Forward-kinematics example coordinates. Pose A X: 100 mm; Pose A Y: 100 mm; Pose B X: 86.6 mm; Pose B Y: 150 mm.
Forward-kinematics example coordinates. Original Academy diagram using illustrative values; not a measured hardware result.
Read the diagram as a data table
Values used in the illustration
Condition or componentmm
Pose A X100
Pose A Y100
Pose B X86.6
Pose B Y150

The calculation

x = L₁ cos θ₁ + L₂ cos(θ₁ + θ₂)
y = L₁ sin θ₁ + L₂ sin(θ₁ + θ₂)

Link lengths and x,y share one length unit. Trigonometric library functions normally expect radians.

Worked example

Illustrative numbers. Replace them with your measured inputs.

With L₁=L₂=100 mm, θ₁=0° and θ₂=90°, the result is (100,100) mm. At θ₁=30° and θ₂=60°, the result is approximately (86.60,150.00) mm. The second link uses the sum of the two angles.

Try it step by step

  1. Draw a straight-arm zero pose and mark each positive rotation direction before writing code.
  2. Implement the equations in a pure function with explicit input units and no hardware communication.
  3. Test straight, folded and right-angle configurations whose positions can be checked geometrically.
  4. Compare the function with the simulator and measured unpowered geometry before using encoder readings.

Offline starter code

This snippet processes local data only; it sends no robot commands.

from math import cos, sin, radians
def fk(q1_deg, q2_deg, l1=100.0, l2=100.0):
    q1, q2 = radians(q1_deg), radians(q2_deg)
    return (l1*cos(q1)+l2*cos(q1+q2),
            l1*sin(q1)+l2*sin(q1+q2))
print(fk(0, 90))  # (100, 100), approximately

How to check the result

Known poses must agree to numerical precision in simulation. Physical discrepancies should be investigated as calibration, compliance or measurement issues.

Common mistake to avoid

Using θ₂ alone for the second link treats it as an absolute angle. That is incorrect for the relative-joint convention used here.

Reference reading

Primary references for the underlying models, APIs or application context. The worked numbers and plots above are educational calculations, not results reported by these sources.

Read our methods, limitations and safety notes.