Skip to content
Tactiverge

School/△ Builder/Week 29

Angles in, positions out (and back again)

A camera must point at a target 10 cm away and 4 cm up. What angle do you send the tilt servo, and will your code even understand 'degrees'?

About 35 min · 3 goals · Checked by automated tests

1.Why should I care?

Robots work in both directions: from a joint angle to where the hand is, and from where a target is to the angle needed. And robot software almost always measures angles in radians, so a missing conversion can swing an arm the wrong way.

  • ◇ Find the horizontal and vertical parts of a link at any angle from 0° to 180°.
  • ◇ Recover an angle from two sides with the inverse functions tan⁻¹, sin⁻¹ and cos⁻¹.
  • ◇ Convert between degrees and radians and explain why code uses radians.

2.Predict

A 20 cm link points 60° above horizontal. How far does its tip reach horizontally?

Guess first. Being wrong here is how the surprise works.

3.Discover

Open the kinematics lab. Set the elbow joint straight so the arm acts like one long link, then try shoulder angles of 30°, 60°, 90° and 120°. For each, predict x = L cos θ and y = L sin θ before reading the tip position. What happens to x past 90°?

Explorer 01 — Robotic kinematics

From joint angles to a position, and back again

Forward kinematics turns joint angles into an end-effector position. Inverse kinematics asks the harder question: which angles put the tip where I want it?

REACH 35.0 CMHOLE 5.0J1J2(15.1, 26.4)

Fig. — 2-link planar arm · units cm · y up

Mode

Joint angles (relative)

35 °
60 °

Arm geometry

Links
20.0 cm
15.0 cm
End x
15.1 cm
End y
26.4 cm
Distance r
30.4 cm
workspace 5.0–35.0 cm
|sin θ2|
0.87
well-conditioned
Tip angle φ
95.0°

State

Forward kinematics. Joint angles: joint 1 35°, joint 2 60°. End effector at x 15.1 cm, y 26.4 cm, 30.4 cm from the base. Elbow well-conditioned (|sin θ2| = 0.87).

Forward kinematics. Joint angles: joint 1 35°, joint 2 60°. End effector at x 15.1 cm, y 26.4 cm, 30.4 cm from the base. Elbow well-conditioned (|sin θ2| = 0.87).

How to read this

The base sits at the centre (grid squares are 10 cm). Each thick bar is a link; circles are joints J1, J2. The shaded ring is the workspace: every point the tip can reach with unlimited joint travel. Its outer edge is L1 + L2; the inner hole appears when one link is longer than the others combined.

Arcs show each joint angle. θ1 is measured from the dashed horizontal; θ2 from the dashed extension of link 1. In inverse mode the square is the target (dashed and labelled unreachable when outside the ring), and the arm is solved with the law of cosines. Most targets have two solutions: elbow-up and elbow-down.

Assumptions & limitations
  • Ideal rigid links and revolute joints with no mass, friction, backlash, or flex.
  • Joints may rotate a full ±180°; real joints have hard limits that shrink the workspace, and links cannot pass through each other or the floor.
  • Kinematics only: nothing here says whether the motors are strong or fast enough to hold or reach a pose (that is dynamics).
  • Three-link inverse kinematics is made solvable by fixing the tool angle φ; real controllers choose among redundant solutions with extra goals.
  • Unreachable targets are projected onto the nearest edge of the reachable ring for display; a real controller would refuse or plan around them.
Can't use the interactive? Read a description instead

The kinematics lab shows a two-joint arm with sliders for each joint angle and a readout of the tip's x and y position. With the elbow straight it behaves like one link of the combined length: at 30°, 60°, 90° and 120° the tip's x equals length × cos θ and y equals length × sin θ, and x becomes negative past 90°.

4.Checkpoint: guided practice

Check what you just discovered before going on. Hints appear after a wrong answer.

Practice 1

A 20 cm link points 60° above horizontal. How high is its tip above the joint, in cm?

cm

5.Watch

→ Listen for how to pick which ratio to use from the two sides you know.

A calm first walk through SOH CAH TOA: which sides are opposite, adjacent and the hypotenuse, and how the ratios are formed.

Length: see YouTube · captions on YouTube · source

Nothing loads from YouTube until you press play.

The video is optional: everything you need is also in the lesson text and the interactive.

6.Understand

Past 90°, cos goes negative

Measure the angle from the positive x-axis. Between 90° and 180° the link points backwards, so its horizontal part is negative: cos 120° = −0.5. The vertical part stays positive: sin 120° ≈ 0.866. A robot's code doesn't need special cases: the signs of sin and cos tell it which way the link points.

Working backwards: inverse functions

If you know two sides and want the angle, use an inverse: θ = tan⁻¹(opposite ÷ adjacent), sin⁻¹(opposite ÷ hypotenuse) or cos⁻¹(adjacent ÷ hypotenuse). For a target 10 cm across and 4 cm up, θ = tan⁻¹(0.4) ≈ 21.8°. In code, atan2(y, x) does this and also gets the quadrant right.

Radians: the unit code uses

A radian is the angle where the arc length equals the radius. A full turn is 2π rad = 360°, so degrees × π/180 = radians. 90° ≈ 1.571 rad, and 1 rad ≈ 57.3°. Python's math.sin(30) treats 30 as radians and returns about −0.988, not 0.5. Convert with math.radians first.

Explain it another way

Degrees chop a circle into 360 slices because people liked the number. Radians measure the angle by how much of the radius you'd walk around the edge, which is why maths and code prefer them.

Worked example 1

A 25 cm link at 150°: where is its tip?

x = 25 cos 150° ≈ 25 × (−0.866) ≈ −21.7 cm (behind the joint); y = 25 sin 150° = 25 × 0.5 = 12.5 cm.

Worked example 2

A ramp must rise 30 cm over 120 cm. At what angle?

tan θ = 30 ÷ 120 = 0.25, so θ = tan⁻¹(0.25) ≈ 14.0°.

Common mix-ups

  • Angles past 90° can't be handled with sin and cos.
    ✓ They can: cos goes negative when the link points backwards, which is exactly the information you need.
  • Radians are just a fancier name for degrees.
    ✓ They are a different unit: 1 rad ≈ 57.3°. Mixing them up gives wildly wrong answers.

7.Practice on your own

Practice, not a test. Wrong answers get a hint and another try.

Practice 2 · a fresh version every time

A camera on a robot must point at a target 6 cm away horizontally and 12 cm higher. At what angle above the horizontal must it tilt, in degrees?

°

Practice 3 · a fresh version every time

A servo turns 135°. How many radians is that?

rad

Practice 4

Convert 90° to radians (to 3 decimal places).

rad

Practice 5

A learner writes math.sin(30) in Python to get the height of a link at 30° and gets about −0.988. Why?

8.Apply it

A pan-tilt camera on a rover must look at three targets: (10, 4) cm, (5, 5) cm and (−6, 8) cm relative to its pivot. Find each tilt angle in degrees and in radians, and say which target needs atan2 rather than tan⁻¹ to get the right answer.

9.Reflect

Concepts: Angles and trigonometry · Joints, degrees of freedom and workspace