Take the 2-minute tour ×
LEGO® Answers is a question and answer site for LEGO® and building block enthusiasts. It's 100% free, no registration required.

I have an EV3 robot with motors, like a car, that can move forward/backward and left/right and have some sensors attached. I want it to remember its initial position by remembering all the movements of motors when robot starts moving, then after some movements, that can be random in time, distance and direction, I want to return it back home.

How can I do this? What is the principle of returning "home" knowing there are no GPS or other helpers?

share|improve this question

2 Answers 2

You should look up 'Dead Reckoning'. It is a method where you always know (or guess) your current position by tracking all your previous moves. Knowing your current position, you can then retrace your steps backward or reach any position back calculating a straight line to it (hoping that there's nothing in the way).

Here's the Wikipedia on the subject: Dead reckoning

share|improve this answer

You have two options.

You can use an accelerometer. Lego sells one that can be found here. There are also aftermarket ones at mindsensors.com. This allows you to independently measure the acceleration of the robot. You have to then integrate this information twice to get positional change. The way to do this is to put it in your control loop and sum up 0.5*dt*dt*a where a is the accelerometer reading (there will be one for each axis of motion) and dt is the time between samples. This nice thing about this is it gives you absolute displacement. That is it accounts for motions that cancel out so you can set a straight line path back.

You can record each displacement into a variable for x and y directions using the servo readings from the motors - remember to reset the encoder value from the servos after each reading. This is harder because you have to account for the geometry of the wheels and keep track of the robot heading - lego also sells a compass sensor if you don't want to deal with finding your heading, but you'll still have to deal with non-spinning turns. It's also prone to accumulation of errors. (the accelerometer is too but not as bad I think.)

Your admonition of 'no other helpers' could be interpreted to mean you don't want the first solution in which case you are left with using the encoders and figuring out the differential motion of your chassis design (which may be non trivial).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.