Skip to main content
Torqheart
← Foundations

Mathematics

Derivatives: how fast it changes

A derivative is “how fast is it changing right now”. A robot uses it to know how fast it is falling, not just how far it leans.

See it first

Try it

An angle and its rate of change

-505100246Time (s)
AngleRate
Largest rate
10 °/s
The rate curve is the slope of the angle curve at every point.

One step at a time

Step by step

Derivatives: how fast it changes

Step 1 of 5

Read the value now

The sensor gives this loop's tilt, say 4.0°.

In words

Position says where it is; speed says where it is heading. A controller that looks only at position always reacts one beat late.

On a graph the derivative is the slope at that point. At the top of the wave the angle is largest but its rate is zero; where the angle crosses zero, the rate is largest. Drag and see that the two curves never peak together.

The formula

v = dx/dt ≈ (x_now − x_before) / Δt

Where you meet this in a robot

The D term of a balance controller is the derivative of the tilt. In real code we estimate it as the difference of two readings divided by one loop period.