The basic LEGO Mindstorm EV3 truck we are using in this example contains two main drive tires and two smaller “bumper” tires. The balance of the weight is carried on a skid on the back-center of the robot. Each of the main drive tires are driven by a large motor. The task is to pre-program a robot to drive along the border of a 5 foot by 3 foot rectangle.

The main drive tires are the only one that we are interested in to solve this problem. First, we need to know the diameter of each tire. In this case, the truck is using 68.8mm diameter tires. We know the circumference of a circle is calculated by multiplying Pi (π) times the diameter or multiplying Pi (π) times double the radius.

*C = πd* or *C = π(2r)*

So, with a diameter 68.8mm, these tires have an approximate circumference of 216.14157mm. This means that for every full rotation of the tire, the robot moves 216.14157mm.

Now, let’s look at the length of our track. It is two 5-foot lengths and two 3-foot lengths. The converts to two 60-inch lengths and two 36-inch lengths. There are 25.4mm in 1 inch. As such, our track consists of two 1,524mm lengths and two 762mm lengths.

Unfortunately, we don’t luck out with our circumference evenly dividing into either of our lengths. This means that to stop at the exact length, the tire will not end at a complete rotation. We must calculate how many complete rotations and then how much of a fractional rotation would be needed for each length.

Let’s start with the 5-foot lengths. Remember, they are 1,524mm. Each complete tire rotation is 216.14157mm. So, we need to do some division:

**1,524 ÷ 216.14157 = 7r11.00901**

In common English, this means that to travel 1,524mm the wheel must rotate 7 complete times and then an additional 11.00901mm. The problem is how do we tell the computer to accomplish this task?

**Option 1 – ***Fractional Rotations*

In LEGO Mindstorm LabView, we can instruct the motor to turn a set number of rotations. In this case, we need to return to our division problem and solve for a floating decimal remainder

**1,524 ÷ 216.14157 = 7.05093**

This means that the motor will need to rotate 7.05093 times. If we double-check this, we multiply our answer (total number of rotations) by the circumference (distance traveled by each rotation) and should get our total distance.

**7.05093 X 216.14157 = 1,523.99908mm**

As we are working with approximations of π, a drift of 0.00091mm is sufficiently close.

**Option 2 – ***Degree Rotations*

In LEGO Mindstorm LabView, we can also instruct the motor to turn a set number of degrees. We know from earlier that we must perform a minimum of 7 complete rotations and then a fractional rotation.

To perform this calculation, we first need to know how much distance is traveled by a single degree of rotation. For this, we do the following:

**216.14157mm ÷ 360° = 0.60039mm/1°**

For every degree of rotation, the wheel will travel approximately 0.60039mm. So, to determine how many degrees are needed to travel 1,524mm, we divide that distance by the distance of 1 degree of rotation.

**1,524mm ÷ 0.60039mm = 2,538.35007°**

This means that to travel 1,524mm, the wheel needs to rotate 2,538.35007°. We know that this answer makes logical sense since we know from earlier that the wheel must complete just over 7 full rotations. There are 360° in a single rotation and 2,520° in 7 full rotations. This leaves 18.35007° to go.

Let’s double-check this. We calculated that a single degree of rotation produced 0.60039mm of travel. So, let’s see how much travel we get with 2,538.35007° of rotation.

**0.60039mm X 2,538.35007° = 1,523.99999mm**

As we are working with approximations of π, a drift of 0.00001mm is sufficiently close.

**What About the Short Length?**

Let’s take a moment to look at the short length and see if the level of accuracy between rotations and degrees holds.

Let’s start with rotations again. We know that a single rotation gives us approximately 216.14157mm of travel. We also know that our distance to be traveled is 3 feet or 762mm.

**762 ÷ 216.14157 = 3.52546**

This means the motor will need to rotate 3.52546 times to travel 3 feet. If we double-check this, we multiply our answer (total number of rotation) by the circumference (distance traveled by each rotation) and should get our total distance.

**3.52546 X 216.14157 = 761.99845mm**

When working with rotations on the shorter distance, our drift is 0.00154mm. This would mean that our total drift for the entire rectangle would be 0.0049mm.

**(0.00091 X 2) + (0.00154 X 2) = 0.0049mm**

Now, let’s look at degrees for the short length. Once again, we know that a single degree of rotation gives us approximately 0.60039mm of travel. We also know that our distance to be traveled is 3 feel or 762mm.

**762mm ÷ 0.60039mm = 1,269.17503°**

This means that if the tire rotates 1,269.17503°, we should travel 3 feet. If we double-check this, we multiply our total distance per degree traveled by the total number of degrees of rotation.

**0.60039mm X 1,269.17503° = 761.99999mm**

When working with degrees on the shorter distance, our drift is 0.00001mm. This would mean that our total drive for the entire rectangle would be 0.00004mm.

**(0.00001 X 2) + (0.00001 X 2) = 0.00004mm**

**Which is the Best?**

Well, if we look at which option gives us the most accurate result, working with degrees resulted in an answer that is only a total of 0.00004mm off while working with rotations results in an answer that was a total of 0.00490mm off. That is a total difference of 0.00486mm.

If we are looking for ease of calculation, the number or rotations requires far fewer calculations and in theory less possibility for calculation error.