6

I am currently working on a project that uses large motors. I want the project to return to a "starting position" (0,0,0) at the touch of a button so that it can be used multiple (identical) times. How can I do this with the regular Mindstorms EV3 software (I am using the education version)?

  • I tried to find the answer to this a year ago. Unless you build some sort of synchronisation point using another sensor, you can't. – Simon Featherstone Jul 17 '16 at 20:47
4

The simplest way to "remember" a starting position is to make the starting position 0. You can do this using Rest in the Motor Rotation block (1). After your motors have moved (simulated by (2)), you can use a loop (3) to run the motors back to zero.

The basic idea though is that if the motor position is negative, then we need to run the motor in the positive direction and vice versa. This way we run back towards a position of 0. Once we reach a motor position of 0, we exit from the loop and stop the motor (5).

This is meant to be an example to point you in the right direction and can be improved. For example, you could use a proportional controller at (4) to slow the motor as it nears the 0 position. The sample code as it is below will oscillate several times before it gets exactly to 0, which is not very nice.

Additionally, you will need to add code that waits for a button press before starting the loop and you will need additional loops for each motor.

sample code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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