Robot Wheel Speed and Turn Time, Tested in Webots

How to drive a robot to a target: find direction with atan2, convert wheel speed (rad/s) to robot speed (m/s), estimate turn time, and test it in Webots.

Author
AuthorAuthor

AI Engineer · 36+ years in IT · Japanese, based in Manila for 13+ years

Robot Wheel Speed and Turn Time, Tested in Webots

Summary

  • Treat the robot's starting point as the origin. For a target at (x, y), use atan2(y, x) to find the direction and √(x² + y²) to find the distance. Then turn in place to face the target and drive straight. atan2 is a function that returns the angle to a point from its x and y values.
  • Wheel rotation speed (rad/s) and robot speed (m/s) have different units. For straight travel, v = r × ω gives the robot's speed from the wheel radius and wheel rotation speed. Use that speed to estimate drive time. To estimate turn time, use the rate at which the robot changes heading.
  • In a test with the e-puck, a two-wheeled robot, in the robot simulator Webots, the robot speed matched the calculation, and doubling the wheel rotation speed halved the drive time. However, the robot turned only about 0.92 times the predicted angle. That heading error explained why it stopped off target.

When a company considers a transport robot or a serving robot, questions like these come up: "How many seconds will it take to reach the shelf?" and "If we replace the wheels, how should we change the settings?" A few calculations can answer both questions. To find out why a robot stops slightly off the target, you compare the calculated values with measured values.

Below, we cover how to find the target direction and distance, how to tell wheel speed from robot speed, and how to estimate the turn time and drive time, using everyday examples and calculations. The second half covers the results of running the robot in the robot simulator Webots, and how to check the error in the turn angle.

The Basic Flow for Driving a Robot to a Target Point

The simplest way to move a robot with left and right wheels from where it is now to a target point has two steps:

  1. Turn in place to face the target direction
  2. Drive straight to the target

Before the robot moves, you need four values: the target direction, the distance to the target, the turn time, and the drive time. The direction and distance come from the target coordinates. The angle to turn depends on the target direction and the current heading. Dividing that angle by the turning speed gives the turn time. The drive time is the distance divided by the robot speed.

Before a run, I always calculate how long the robot should take and where it should stop. Afterward, I compare those predictions with the measurements. Without a prediction, you cannot tell whether a robot that stops slightly off is behaving as expected or has a problem.

Finding the Target Direction and Distance from Coordinates

Direction is atan2(y, x), distance is √(x² + y²)

Suppose the robot is at the origin (0, 0) and faces the positive direction of the x-axis. When the target point is at (x, y), the direction and distance are found with these formulas:

  • Direction θ = atan2(y, x)
  • Distance = √(x² + y²)

The result of atan2 is in radians (a unit of angle), between -π and π. The table below shows the direction converted to degrees.

Target pointDirectionDistance
(1, 1)45 degrees1.4142 m
(0.3, 0.4)53.1301 degrees0.5 m
(-0.4, 0.3)143.1301 degrees0.5 m
(0.3, -0.4)-53.1301 degrees0.5 m

When the robot starts facing the positive x-axis, a positive angle means turn left and a negative angle means turn right. If the target is on the right side, as with (0.3, -0.4), the robot turns 53.1301 degrees to the right.

y ÷ x alone cannot tell directions apart

Finding an angle from the value of y ÷ x is not enough to decide the direction. For example, (-0.4, 0.3) and (0.4, -0.3) give the same value of y ÷ x, but the targets lie in opposite directions.

The x- and y-axes divide the plane into four regions called quadrants. The signs of x and y tell atan2 which quadrant contains the target, so it can distinguish the two opposite directions in the example above. The official Python documentation also gives this as the reason for using atan2. For how atan2 gives the angle to turn, see robot trigonometry and atan2.

The radian (rad) is the SI unit for plane angles and can be expressed as a ratio of two lengths (m/m). Use radians during calculations and degrees when explaining to people, and you will avoid mixing up units.

Try it: aim at a target with atan2
xy
  • gray: current heading
  • orange dot: target
  • blue: shorter turn
  • dashed red: plain difference
Distance to the target
0.5 m
√((-0.4)² + (-0.3)²)
Direction from atan2(y, x)
-143.13 °
-2.4981 rad
Direction from atan(y / x)
36.87 °

atan(y / x) points the opposite way (180° off) because x is negative.

Turn using the plain difference
-303.13 °
-143.13 − 160
Turn after keeping it within −180° to 180°
56.87 °

The plain difference is the long way round.

Telling Wheel Rotation Speed (rad/s) from Robot Speed (m/s)

Two "speeds" with different units

When people talk about a robot's "speed," two different values often get mixed together:

  • Wheel rotation speed (rad/s): The value given to the motor. How many radians the wheel turns per second
  • Robot speed (m/s): How many meters the robot's position changes per second

To make a wheel turn continuously in Webots, set the motor's target position to infinity. Then set the wheel's rotation speed in rad/s. The value you specify is the wheel rotation speed, not the robot's speed in m/s.

Convert to straight-line speed with v = r × ω

When the left and right wheels turn at the same speed and the robot drives straight, multiplying the wheel radius by the wheel rotation speed gives the robot speed. To get the wheel rotation speed from the robot speed, divide by the radius.

Robot speed v = wheel radius r × wheel rotation speed ω

With the e-puck's wheels (radius 0.02 m), the calculation looks like this:

Wheel rotation speedCalculationRobot speed
2.5 rad/s0.02 × 2.50.05 m/s
5 rad/s0.02 × 50.1 m/s

One full turn of the wheel moves the robot 2π × 0.02 = 0.1257 m.

Note that the rad/s setting alone does not decide the robot speed. At the same 2 rad/s, a wheel with a 0.02 m radius gives 0.04 m/s, and a wheel with a 0.04 m radius gives 0.08 m/s. If you use the same setting on robots with different wheel sizes, they will move at different speeds.

Estimating Turn Time and Drive Time Before the Robot Moves

Time to turn in place

If the left wheel turns at -2 rad/s and the right wheel at +2 rad/s, the robot turns left in place. Its turning speed (how fast its heading changes) is found with this formula:

Turning speed of the robot (rad/s) = wheel radius × (right wheel rotation speed − left wheel rotation speed) ÷ distance between the left and right wheels

The e-puck has a wheel radius of 0.02 m and a distance of 0.052 m between the left and right wheels. The turning speed is 0.02 × (2 + 2) ÷ 0.052 = 1.5385 rad/s.

The turn time is the turn angle (in radians) ÷ the turning speed.

Turn angleTurn time
53.1301 degrees0.6027 s
90 degrees1.021 s
143.1301 degrees1.6237 s

Time to drive straight

The drive time is distance ÷ robot speed. To travel 0.5 m, it takes 0.5 ÷ 0.05 = 10 seconds at 0.05 m/s, and 0.5 ÷ 0.1 = 5 seconds at 0.1 m/s.

For the same heading and distance, doubling the wheel speed should halve the drive time. The robot should stop at the same point at either speed. The next section shows the results of checking this prediction in Webots.

Try it: turn to face the target, then drive
xy
  • blue: planned path
  • orange dot: target
Direction to the target (atan2)
53.13 °
atan2(0.4, 0.3) = 0.9273 rad

Positive: turn left (counterclockwise).

Distance to the target
0.5 m
√(0.3² + 0.4²)
Turn rate
1.5385 rad/s
0.02 × (2 + 2) ÷ 0.052
Turn time
0.6027 s
0.9273 ÷ 1.5385
Robot speed v = r × ω
0.05 m/s
0.02 × 2.5
Drive time
10 s
0.5 ÷ 0.05
Heading the robot really faces
53.13 °
53.13 × 1
Distance from the target where it stops
0 mm
2 × 0.5 × sin(0° ÷ 2)

Results from Testing in Webots

Test conditions

I ran the e-puck in Webots R2025a under these conditions:

  • The robot is the e-puck (run as a Supervisor, a Webots mode that can read a robot's position and heading in world coordinates, the coordinates of the whole floor). One simulation step (basicTimeStep) is 32 ms
  • The floor is 1.2 m square. There are three target points, (0.3, 0.4), (-0.4, 0.3) and (0.3, -0.4), each 0.5 m from the origin
  • Each time, the robot is placed at (0, 0) facing 0 degrees
  • The robot finds the target direction with atan2 and turns in place according to its sign. For a left turn, the left wheel is set to -2.0 rad/s and the right wheel to +2.0 rad/s
  • Because the robot starts at a heading of 0 degrees, the turn time is the size of the target angle in radians divided by 1.5385 rad/s, rounded to a whole number of 32 ms simulation steps
  • After turning, the robot drives straight for a time equal to the distance to the target divided by the robot speed
  • The only condition changed is the wheel speed while driving straight (2.5 rad/s in Run 1 and 5.0 rad/s in Run 2)

I used Webots Supervisor to measure the robot's heading and position in the coordinates of the whole floor (world coordinates). Using the same coordinate system for predictions and measurements let me compare the headings and measure how far the robot stopped from each target. For the basics of Supervisor and basicTimeStep, see how to use Webots.

Webots floor with green target marks, red stop-position marks and the e-puck Green marks are the target points, and red marks are where the robot stopped (Run 1)

Doubling the wheel rotation speed halved the drive time

Here are the results for the straight-driving part. All three targets gave the same values.

RunWheel speedPredicted robot speedMeasured robot speedDrive time
Run 12.5 rad/s0.05 m/s0.0500 m/s9.984 s
Run 25.0 rad/s0.1 m/s0.1000 m/s4.992 s

Webots screen and console showing the results of Run 2 with wheels at 5.0 rad/s Run 2 (wheels at 5.0 rad/s). The drive time was 4.992 s and the speed was 0.1000 m/s

Doubling the wheel speed doubled the robot speed from 0.05 m/s to 0.1 m/s and halved the drive time from 9.984 s to 4.992 s. For each target, the robot stopped at the same point in both runs.

In Run 1, the calculated drive time was 10 seconds. With the simulation running in 32 ms steps, the robot drove for 9.984 seconds. The distance traveled was 0.05 × 9.984 = 0.4992 m, and the stop position was also 0.4992 m from the origin. The measured straight-line speed matched the prediction from v = r × ω.

Top view of the paths on the floor and a graph of robot speed and drive time for each run Left: top view of the paths, targets and stop positions. Right: robot speed for each run and the time taken to travel 0.5 m

The robot turned less than predicted

The turning part, on the other hand, showed an error. These are the Run 1 results (Run 2 gave the same values).

Target pointPredicted directionTurn timeActual headingHeading errorStop positionDistance from target
(0.3, 0.4)53.13 degrees0.608 s49.13 degrees-4.00 degrees(0.3267, 0.3775)34.9 mm
(-0.4, 0.3)143.13 degrees1.632 s131.89 degrees-11.24 degrees(-0.3333, 0.3716)97.9 mm
(0.3, -0.4)-53.13 degrees0.608 s-49.13 degrees4.00 degrees(0.3267, -0.3775)34.9 mm

Webots screen and console showing the results of Run 1 with wheels at 2.5 rad/s Run 1 (wheels at 2.5 rad/s). dir err is the heading error, and error mm is the distance from the target

For every target, the angle the robot actually turned was smaller than predicted. On the right turn, the robot turned 49.13 degrees toward a target 53.13 degrees to its right. Of the three targets tested, the one requiring the largest turn also had the largest heading error and the greatest distance between target and stopping point.

How I checked the error

I used three calculations to find where the error came from:

  1. Back-calculate the actual turning speed: Divide the angle actually turned (in radians) by the turn time. 49.13 degrees converted to radians ÷ 0.608 ≈ 1.4103 rad/s, and 131.89 degrees converted to radians ÷ 1.632 ≈ 1.4105 rad/s. For both the smaller and larger turns, the measured turning speed was about 0.9167 times the predicted 1.5385 rad/s. This suggests that the turning speed itself was slower than predicted.
  2. Check whether the heading error explains the position error: Imagine two straight paths from the same starting point, each of length L. One points toward the target and the other follows the robot's measured heading. If Δθ is the angle between them, their endpoints are 2 × L × sin(Δθ ÷ 2) apart. For this calculation, L is the target distance of 0.5 m. For a 4.00 degree error, 2 × 0.5 × sin(4.00 degrees ÷ 2) ≈ 34.8995 mm, close to the measured 34.9 mm. For 11.24 degrees, the result is ≈ 97.9303 mm, and the measured value is 97.9 mm. The values calculated from the heading error almost matched the measured stop-position errors.
  3. Find the wheel spacing that would give the measured turning speed. Using 1.4103 rad/s in the formula gives 0.02 × (2 + 2) ÷ 1.4103 ≈ 0.0567 m. The model specifies a wheel spacing of 0.052 m.

The cause of the slower turn is still uncertain. In the simulation, the shape used to model each wheel's contact with the floor is 5 mm wide. My guess is that the contact point lies outward from the wheel's centerline, which could explain the lower turning speed.

When the calculation and the actual motion do not match like this, recalculate the turn time using the measured turning speed. Correcting a calculated value with a measurement in this way is called calibration.

Example Scenarios for Japanese Companies in the Philippines

These hypothetical examples use sample figures to show how Japanese companies in the Philippines might apply the calculations in a warehouse, restaurant, or factory.

Warehouse transport robot: review the settings after replacing the wheels

Suppose a transport robot with a 0.1 m wheel radius runs with its wheels at 5 rad/s. The robot speed is 0.1 × 5 = 0.5 m/s. If the shelf is at (30, 40) m, the direction is 53.1301 degrees, the distance is 50 m, and the drive time is 50 ÷ 0.5 = 100 seconds.

Now suppose you install wheels with a radius of 0.15 m and keep the wheel speed and drive time the same. The wheels still turn at 5 rad/s, and the robot still drives for 100 seconds. The robot speed becomes 0.15 × 5 = 0.75 m/s, so it travels 75 m in 100 seconds and overshoots the shelf by 25 m. To stop at the shelf (50 m ahead), the drive time must be changed to 50 ÷ 0.75 ≈ 66.6667 seconds.

Restaurant serving robot: a small heading error becomes a position error

Suppose the distance from the serving robot to the table is 10 m. If the robot travels the full 10 m with a 5-degree heading error, it finishes about 0.8724 m from the table's target point (2 × 10 × sin(5 degrees ÷ 2)). Even with a 1-degree heading error, the stop position is off by about 0.1745 m. With the same angle error, the longer the distance traveled, the larger the stop-position error.

Factory parts-carrying robot: recalculate with the measured turning speed

Consider a robot whose calculated turning speed is 1 rad/s and whose measured turning speed is 0.9 rad/s. At the predicted speed, a 90-degree turn would take 1.5708 seconds. At the measured speed, the robot would turn only 81 degrees in that time. Using the measured 0.9 rad/s gives a turn time of 1.7453 seconds for the full 90 degrees. Measure the turning speed at installation and use that value to review the turn times.

FAQ

Q: Why can't I tell the robot speed when I set the wheel speed in rad/s?

Wheel speed in rad/s tells you how fast the wheel turns. To find how fast the robot travels in a straight line, multiply by the wheel radius in meters. The result is the robot's speed in m/s, given by v = r × ω. For example, at the same 2 rad/s, a 0.02 m radius wheel gives 0.04 m/s, and a 0.04 m radius wheel gives 0.08 m/s.

Q: How do I calculate the time to turn in place?

First, find the turning speed with "wheel radius × (right wheel rotation speed − left wheel rotation speed) ÷ distance between the left and right wheels." The turn time is the turn angle (in radians) divided by that speed. With the e-puck's left wheel at −2 rad/s and its right wheel at +2 rad/s, the formula predicts a turning speed of 1.5385 rad/s. At that speed, a 90-degree turn would take 1.021 seconds.

Q: What should I do when the robot does not turn the calculated angle?

Measure how far the robot turned, express that angle in radians, and divide by the turn time in seconds. This gives the measured turning speed in rad/s. Then recalculate the turn time with that value. This process is called calibration. In my Webots test, the actual turning speed was 0.9167 times the predicted value.

Q: Can't I calculate the target direction from y ÷ x?

y ÷ x alone cannot tell which quadrant the target is in. For example, (-0.4, 0.3) and (0.4, -0.3) give the same value of y ÷ x, but they point in opposite directions. Calculate the direction with atan2, which uses the signs of both x and y, so the robot turns the right way.

Conclusion

The basic way to drive a robot to a target point is to find the direction with atan2 and the distance with √(x² + y²), turn in place, and then drive straight. Keep wheel rotation speed (rad/s) separate from robot speed (m/s), convert between them with v = r × ω, and estimate the turn time and drive time before the robot moves.

In the Webots test, the robot speed matched the calculation, and doubling the wheel rotation speed halved the drive time. However, the robot turned only about 0.92 times the predicted angle. That heading error accounted for the distance between each target and the point where the robot stopped. Predicting with a formula before running the robot, then breaking the error down in numbers, shows you what to fix.

PH AI Works is based in Manila, Philippines, and supports small and mid-sized businesses with AI adoption, business automation, and web development. If you would like to talk about introducing robots or estimating their motion before they run, please book a free consultation.

References

About the author

Author
Author

Founder / AI Engineer (36+ years in IT)

  • ●From Tokyo · based in Manila for 13+ years
  • ●36+ years in IT (development, SEO, AI)
  • ●Google Certified AI Professional
  • ●IBM Certified Generative AI Engineer
  • ●AI chatbots, RAG & AI agent development
  • ●Physical AI Engineer

A Japanese AI engineer with 36+ years in IT and 13+ years on the ground in the Philippines. I write from hands-on experience to help Japanese companies adopt AI that actually delivers results — chatbots, workflow automation, AI agents, and AI-driven marketing. Feel free to reach out in Japanese or English.

Your Competitors Are Already Using AI!

Is your business keeping up?