EV3 Going Straight and Turning

Straight travel. Let’s say that you have a wheel with a circumference of 6 inches (0.95″ radius). What do you need the duration set to for the robot to travel 10 inches?

Driving 10 inches the wheel turns 1 2/3 revolutions (10″ / 6″ per rev). If you use degrees the duration is 600 degrees (360 degrees/rev x 1 2/3 rev). To convert straight distance to motor degrees:

motor degrees = 360 x distance / wheel circumference


Turning is a bit more complicated than going straight, but not a lot. Let’s say you like to do turns by stopping one wheel and turning the other. When you turn like this the wheel that is spinning follows a circular path. To make the robot turn 90 degrees the wheel has to follow the circle 1/4 of the way around. If the wheel goes half way around the circle the robot turned 180 degrees. All the way around the circle equals a 360 degree turn.

So to do a turn we need to program the duration so the wheel travels the desired distance around the circle. But how big is the circle? In this right turn example the right wheel is the center of the circle, and the left wheel is on the circumference. The distance from the center to the edge of a circle is called radius and it equals the distance between our wheels (called the track). There are equations that let us calculate the length of the circumference if we know the radius:

circumference = 2 x radius x PI

I like to use 22/7 for PI. In math class they use 3.14. Let’s say the track of our imaginary robot is 4″. What is the distance one wheel has to travel while the robot turns 360 degrees?

circumference = 2 x track x PI = 2 x 4 x 3.14 = 25.12″

And from the straight example above we can figure out the motor duration:

duration = distance / wheel circumference = 25.12″ / 6″ per rev = 4.18 rev

or 1507 motor degrees (4.18 rev x 360 degrees/rev)

A 90 degree turn is 1/4 of a 360 degree turn. The duration for a 90 degree turn is 1507 / 4 or 377 motor degrees. Turning the robot 90 degrees requires we turn the outer wheel more that 360 degrees.

Math is Cool
Converting turns into arcs and computing the distance will tell you what numbers you need for duration when making turns, but looking at the problem in greater depth reveals a very cool insight.

Above we found that that the during a 360 degree turn the distance the outer wheel needs to travel = 2 x track x PI, and that the duration for this turn (in rotations) = 2 x track x PI / wheel circumference.

The circumference of the wheel = 2 x wheel radius x PI. If we put that in the equation above we get:

duration = 2 x track x PI / (2 x wheel radius x PI)

Simplify and we get

duration = track / wheel radius

In our example track = 4″ and wheel radius = 0.95″, so the duration for a 360 degree turn is 4.2 revolutions or 1512 degrees. Except for a little rounding error these are the same numbers we got before. And this nifty little ratio is unit-less and works for all turns. Say I wanted to figure out duration for a 90 degree turn.

Duration in degrees = 90 degrees * 4.2 = 378 degrees

We have a magic number that will convert any robot turn into the required move duration. You could even put the conversion into a MyBlock and command all turns in robot heading degrees instead of motor degrees.

What was that insight?
Oh yeah, I mentioned something about a great insight. The insight is that you can dial in your turns by adjusting your robot track. Clever FLL teams found out that by adjusting their robot’s track to work with the wheel diameter measuring turns was a breeze.

Say you use a wheel with 1.5″ radius. Look what happens when you make the track 6″.

Turning ratio = Track / wheel radius = 6 / 1.5 = 4

For a 360 degree turn the wheel turns 4 revolutions. At 16 counts per revolution that is 64 counts on the rotation sensor. For a 90 degree turn we divide by 4 and get 16. A 45 degree turn is 8 counts. A 22.5 degree turn is 4 counts. This works out much nicer than the messy numbers you get if the track were 5″ or 7″.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s