rotary encoder
A rotary encoder is a small sensor that watches a spinning shaft and reports how far it has turned. Every robot joint, wheel, and motor needs to know its own angle — otherwise the robot is moving blind, like trying to point at something with your eyes shut. The encoder answers the question "how much have I rotated?" by reading marks on a disk that turns with the shaft; often the disk's pattern blocks and unblocks a tiny beam of light, though some encoders read magnetic or electrical patterns instead.
There are two main kinds, and the difference matters. An incremental encoder only counts steps as the shaft turns — it sends out a tick for each small slice of rotation, so the robot adds the ticks to track movement. It is cheap and precise, but it has no memory: switch the power off and on, and it has no idea what angle it is at until something tells it. An absolute encoder, by contrast, gives each position its own unique code, like every spot on the dial having its own house number. The moment you power it up, it already knows exactly where the shaft is sitting.
The tradeoff is the usual one between cost and convenience. Incremental encoders are simpler and cheaper, so they are everywhere, but they need a known starting point — many robots do a little "homing" wiggle at startup to find it. Absolute encoders cost more and are a bit more complex inside, but they never lose their place, which is exactly what you want for a robot arm that must come back online knowing its real pose without flailing around to recalibrate.
When a robot arm is unplugged overnight, an absolute encoder lets it wake up already knowing its elbow is bent at 40 degrees; an incremental one would first have to nudge to a home switch to find that out.
Absolute encoders remember their position through a power cut; incremental ones must re-find a reference.
Encoders measure rotation, not absolute speed by themselves; speed is worked out by watching how fast the count changes over time.