I am trying to make a program that requires my 51515 to turn a specified number of degrees. I found a way to do that on the LEGO app's "Knowledge Base", but the given example was:

import math
from mindstorms import MotorPair

motor_pair = MotorPair('B', 'A')

# Turn a Driving Base 180 degrees in place (if wheels are 8.1 cm apart).
motor_pair.move(8.1 * math.pi / 2, 'cm', steering=100)

My issue is that I do not know exactly how to measure the distance between the wheels. Am I supposed to measure from the middles of the wheels? The outsides? the insides?


This formula will need the lateral distance between wheels, i.e. the distance between left and right wheel, not the back and front wheel.


The steering=100 parameter means that the wheels will move in opposite directions. For the 8.1 value, one wheel will move +12.7cm and the other wheel will move -12.7cm. That is half of the circumference of a circle with diameter of 8.1 cm.

Now to the question: exactly what point of the wheel you should measure in left-right direction. It should be the point of the wheel that does not slip when turning - the outer edge will slip one way and the inner edge will slip the other way.

Measuring between the middle of the wheels will be a good first approximation. However the exact value will depend on the tire texture and their mounting alignment. You can test how exactly it turns 180 degrees and fine tune the value to larger or smaller.

Your Answer

