# What causes a car's velocity to follow the front wheels' direction?

I'm trying to simulate a car with correct physics models. In this example we let the car have a constant speed, and there are no forces (friction and drag) to slow down the speed.

Here's a video that shows my problem. As I leave the curve by turning the front wheel straight the car's velocity does not follow. Video: https://vid.me/XrSJ. The car's velocity is shown with a blue arrow, the centripetal force with a green and the acceleration with a red arrow.

So, the simulation is missing something that would cause the direction of the velocity to follow the front wheel's direction as the front wheel straightens. What is this missing piece, where does it come from, and how is it calculated?

UPDATE

The following image illustrates how I'm calculated the forces acting on the car. The car has just made a left turn, but its front wheel was instantaneously turned to the right. That is why the rear and front wheels have different center of curve points.

The rear wheel's curve point is always calculated relative to the car's velocity (note the 90 degrees between the car's velocity and the radius to the curve point. Not sure if it should be calculated relative to the front wheel's velocity instead.

• "the velocity doesn't follow this transition". What happens instead? The car has angular momentum from going around in a circle - when you straighten the wheels, you have to stop it from turning. Is the problem that the car never ends up going straight in your simulation? What is allowing it to turn when the wheels are straight? Maybe you can clarify... May 7 '15 at 20:05
• @Floris If I would change the wheels from 45 degrees to 0, there would be no forces acting on the car anymore, and the car would just slide away in the same direction as it was when it was going in a circle, since there are no forces that make the velocity change direction as the wheels rotate back to 0. I realize my simulation is missing something, I'm just not sure what. You say I have to stop it from turning, what is it that is stopping the car from turning when the wheels are going back to 0 degrees? May 7 '15 at 20:14
• A car that is driving in a circle in uniform motion (presumably), is experiencing a constant force pointing exactly towards the center of this circle. The car must be causing this force through driving the wheels. That the car is at 45 degrees and remains in uniform motion suggests that despite this orientation, in the direction parallel to the car's motion there is a net force of 0. The key here is friction - the wheels need it to push "into" the turn, and it acts against perpendicular motion of the car. May 8 '15 at 4:22
• @Floris Here's a video I made that shows the problem: vid.me/XrSJ May 8 '15 at 6:22
• @lawls that clears it up a lot! The problem is that your simulation does not "see" that an ideal rolling wheel has no resistance against motion in the direction of rolling - but it does resist lateral slipping. As the wheel straightens there should be a torque on the car from the wheels' lateral motion. I will try to compose an answer when I am near a computer. May 8 '15 at 10:29

There are several interesting things going on when a car turns.

First - let's take the simple diagram of two front wheels turned by 45°:

As you can see, the top tire would like the car to turn around the point $C_1$, but the bottom tire (at the same angle) wants to turn around $C_2$. This means that in reality both tires will experience some lateral slip. In ordinary cars, this problem is normally solved with something called the Ackermann steering geometry which makes the wheels turn by a slightly different amount so they both "want" the same center of rotation; this means that in reality the inner wheel is turned a bit more sharply than the outer wheel:

This is a bit of a simplification, but I hope you appreciate that wheels should not, in general, point in the same direction when you turn (in fact, for reasons of stability they don't point the same way when you drive straight, either - this is something called the toe and it needs adjusting from time to time when you get a wheel alignment done on your car).

Now let's look at the forces acting on the wheels.

To simplify things, I am going to draw just two wheels like you did in your simulation. We see that the inner wheel is making a tighter turn than the outer wheel; the net force on the car must be such that the center of mass $C$ makes a circle of radius $R$ about point $P$:

Now let us assume initially that the wheels only have lateral friction: that is, they roll perfectly and the force on them is perpendicular to the direction they are pointing. The resulting force must be centered on the center of mass, and point to the center of rotation. In other words - can we solve for $F_1$ and $F_2$? Extending the forces $F_1$ and $F_2$ along their direction, we get the following diagram and see there is a relationship between $F_1$ and $F_2$:

Now if the front wheel were to change the direction in which it is pointing, the amount and direction of force that it provides will change. But until the car changes its path, the force on the rear ($F_1$) does not change.

What you need to do is this.

By changing the angle of the front wheels and solving for the rotation in the steady state (basically, solving the parallelogram of forces I drew above) you will get a relationship between the forces $F_1$ and $F_2$ and the angle between the wheel and the velocity vector (in fact this is the same in magnitude as the angles $\theta_1$ and $\theta_2$ in my diagram).

When the front wheel changes direction, you are changing the angle between it and the velocity vector; but if you suddenly change the front wheel to pointing "straight", the rear wheel (still) finds itself at an angle to the velocity vector. This means that there will be a lateral force (which you can calculate from the relationship above), and a torque that will straighten out the car.

UPDATE a better way to look at the equation of motion is to work backwards: you know that the motion of the font of the car must follow the direction in which the wheel is (instantaneously) pointing; similarly, the back must follow the direction the rear wheel is pointing. This tells you what the position of the car will be after $\Delta t$, and from this you can compute the instantaneous acceleration and thus force / torque of the wheels. Such a model will give you the right motion as well as the correct forces.

I wrote a simple implementation of the motion (not the force calculation) in Python:

# simple car simulation
# one front wheel, one back wheel

import math
import numpy as np
from scipy import interpolate
import matplotlib.pyplot as plt

def sind(x):
return math.sin(x*math.pi/180.)

def cosd(x):
return math.cos(x*math.pi/180.)

def atan2d(y,x):
return 180/math.pi*math.atan2(y,x)

# dimensions:
length = 2  # axis to axis

# time when wheel is turned, and by how much:
timePoints =  [0, 1,  5, 9, 12, 15]
thetaPoints = [0, 0, 15,  15, 0,  0]
theta = interpolate.interp1d(timePoints, thetaPoints)

# time step for simulation:
dt = 0.05

# show that it worked:
plt.figure()
t = np.arange(0, 15, dt)
plt.plot(t, theta(t))
plt.xlabel('time')
plt.ylabel('steering angle')
plt.title('steering angle vs time')
plt.show()

# position of rear wheel of car at time t:
x = 0
y = 0

# velocity of rear wheel
v = 5

# angle of car body
alpha = 0

plt.figure()
for T, th in enumerate(theta(t)):
dx = v * dt * cosd(alpha)
dy = v * dt * sind(alpha)
vf = v / cosd(th)
dxf = vf * dt * cosd(th+alpha)
dyf = vf * dt * sind(th+alpha)
yl = dyf - dy + length * sind(alpha)
xl = dxf - dx + length * cosd(alpha)
alpha = atan2d(yl, xl)
plt.plot(x,y,'.b')
if (T%50==0):
plt.plot([x, x+xl], [y,y+yl], 'r', linewidth=5)
x = x + dx
y = y + dy

plt.xlabel('x')
plt.ylabel('y')
plt.title('trajectory')
plt.axis('equal')
plt.show()

In this case the wheel is turned slowly - according to the following plot:

and the trajectory is given by this plot (the red line corresponds to the direction that the car is pointing every 2.5 seconds - you can see that when the wheel is straight, the car follows the direction of the wheels):

• Ackermann steering geometry has nothing to do with why you need to include friction. The friction is needed to create a constraint on the path of travel. It doesn't necessarily include a dissipative force so the notion of "friction" reducing kinetic energy need not be invoked. Centripital forces can be "conservative".
– DWin
May 10 '15 at 9:34
• @DWin my point was that the simple notion of pointing the two wheels 45 degrees overconstrains the problem - which is why the analysis with one wheel at front and back is easier to solve without getting wrapped around the axle with details. May 10 '15 at 13:14
• Thank you very much for taking your time to help me. I've tried to incorporate your answer into my simulation all week. It works okay, but not there are some issues. To see if I understood your answer correctly I updated my question with a picture to illustrate how I currrently calculate the forces acting on the car. Are they correctly calculated? Also, I don't think I can do this "backwards" as you suggested in your update, since I need the car to skid during sharp turns etc, correct me if I'm wrong though. May 14 '15 at 16:47
• To incorporate skidding, start by assuming "no skid". Then you can compute the force that appears to be applied. If that force exceeds that which is available, the wheel will skid. The direction of the force on a skidding, rolling wheel is tricky - the magnitude is whatever the normal force times the dynamic friction coefficient is. But maybe that should be the topic of a new (and more focused) question... May 14 '15 at 16:53
• Shouldn't skidding happen by itself if we don't let the centripetal forces of the wheels be greater than the maximum friction? May 14 '15 at 17:54

I don't understand why this question has not been answered in the comments. If there's no friction, then the "direction of the wheels" cannot turn the car. It's as though the car were on a sheer-ice skidpad. (Those of us who have driven in winter weather know the feeling of encountering a patch of "black ice".)

To answer your question directly, when the direction of the velocity of the front of the car does not match the front wheels' direction, the tire is deformed, acting like a spring which exerts a lateral force on the car. The deviation between these directions is called the slip angle, and to a first order approximation the lateral force on the tire is proportional to this slip angle.

In your model it looks like the forces are calculated assuming that the car is already moving in the correct direction. This works fine when the car is moving in the correct direction, but as soon as there is a deviation (say caused by a sudden change in wheel position) then the forces calculated will be incorrect. As a specific example, if the wheel is pointed straight, the motion "should" be straight so there "should" be zero force, and your model faithfully gives you zero force, failing to actually straighten the car.

To correctly model your forces you could use an equation along the lines of

$$F_f= - C \cdot A_f \cdot \frac{A_f\bullet V_f}{|V_f|}$$

Where $C$ is a constant, $V_f$ is the velocity of the front of the car, and $A_f$ is a unit vector in the direction of the front wheel's axis (Note it doesn't matter which direction along that axis it points as if you flip it the magnitude will flip too)

This also works for the rear wheel

$$F_r= - C \cdot A_r \cdot \frac{A_r\bullet V_r}{|V_f|}$$

Of course now the forces are no longer perpendicular to the velocities so you will get frictional losses. On the plus side, these would be realistic frictional losses, but if you wanted your car to coast around turns indefinitely this treatment of wheels would not allow for that.

I created a simulation that integrates these forces to give a vehicle path, however, the naive implementation is very numerically unstable and requires a time step of .0005 s to get a stable result with slip coefficients that seem to produce reasonable results.

This was using the same setup as Floris to give you a comparison of the results.

Wheel base of 2 m, initial velocity of 5 m/s and the same steering angle profile.

Given the issues of numerical stability using this method I would recommend trying to go the route that Floris has explored.

If I find a way to easily combine the methods I'll update.

when you accelerate the vehicle and you turn, the center of gravity shifts from different parts of the car body. Maybe I am misinterpreting your question though..