Moving to an exact angle
Everything so far has been relative: move 90 degrees from wherever you are now. Sometimes what you actually want is absolute: go to the 90-degree position, whatever position you happen to be in at the moment.
Relative drifts, absolute does not
Both pointers below do the same job over and over: swing out a quarter turn, then come home. The only difference is the block that brings them back. Watch one trip and they look identical — so let it run for several.
relative — by an amount
absolute — to a place
Let it loop. Nothing about the left program is wrong — it is just that every trip starts from wherever the last one finished, so a small error is never corrected, only added to.
A pointer moved relatively slowly wanders: each movement starts from wherever the last one finished, so any small error is carried forward and added to. Each orange dash is a trip that called a slightly different place “home”. Nothing about that program is wrong — it is simply that a relative move has no idea where it is supposed to end up.
An absolute movement has no memory of the error. Told to go to position 0, it goes to position 0 — the same place every time, however wrong it was beforehand. That makes it the right tool for a home position: the known place a mechanism returns to before it starts work.
Every motor knows where it is
This is possible because an EV3 motor counts its own turning all the time. Its position can be read back, and can be reset to zero — which is how you tell the motor that here is what you mean by zero, usually at the start of a program with the mechanism held at its resting place.
Why it matters
A clock hand returns to twelve; a car’s steering returns to centre; a 3D printer homes its head before every print. All of them go to a position rather than moving by an amount.
More motion tutorials
- One motor, on and off — Start one motor, let it run, and stop it again.
- The Medium Motor — The small, fast motor that drives arms, gates, jaws and winches.
- The Large Motor — The big, strong motor used for wheels and heavy lifting.
- Driving with two motors — Drive a robot in a straight line, and turn it, using two Large Motors.
- Rotations and degrees — Measure how far a motor turns, so the same movement repeats exactly.
- Speed and power — Make a motor go faster or slower.
- Brake or coast — Stop a motor dead, or let it roll to a halt.