EV3 RoboticsComponent tutorialsMoving to an exact angle

Motion · Level 3 · 5 min

Moving to an exact angle

Send a motor to an exact position instead of a distance from here.

ComponentMotion5 min

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.

EV3 Medium Motor from above, showing the output shaft
The motor counts its own turning all the time, so it always knows where this shaft is — which is what makes going to an exact position possible.

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

A run clockwise for 90 degrees
A run counterclockwise for 90 degrees

absolute — to a place

A run clockwise for 90 degrees
A run to position 0
0°relative, off homeabsolute, off home1trip
Relative: 0° from home and growingAbsolute: home, exactly
Both pointers are at home, on the black mark.
at rest

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