LEGO Mindstorms Motor Rotation Gotcha

The mindstorm motors have an intersting "bug". This bug is that the motors turn absolute to the starting position of the motor.

  • #670
  • 31 Dec 2020

The motors can be moved with something that can be measured - rotations or degrees. When you make a program to move a motor forward 90 degrees then another 180 degrees. The motor will be at 270 degrees at the end of the program. You can see that in the bottom right of the EV3-G where the Port View is.

The problem occurs when you make the same program, but with a wait in the beginning. Play the program and during that waiting turn the motor to negative 90 degrees. After that you will see that the motor will compensate your 90 degrees and turn the 90 degrees desired from the block. The second block will turn 180 degrees forward and the motor will be at 270 degrees (but it will have turned in total of 360 degrees to compensate the initial -90). 

The third thing to test is to add a wait between the blocks. Like the first part turn the motor to negative 90 degrees. The first block will turn the motor 180 degrees, so the motor measures 90 degrees. In the waiting period between the blocks turn the motor forward for 1 rotation (more than the desired distends of the block). You will see that the motor will turn backward fast for 180 degrees to be at the desired end of 270 degrees - 90 from the first block and 180 from the second. 

The thing here to understand is that the motor knows where it is at the start and where it should be at the end. So if there is any interference in between it should compensate it.