# Defining car speed relative to rear wheels rotation

This topic is 2850 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi !

I have a comprehension problem when i want to define the car speed in my simulation.
Lets make it simple :
There is 0 slip and the car should go as fast as the rear wheels rotation goes.

 TorqueEngine = 200; TorqueDrive = TorqueEngine * gearRatio * differentialRatio * transmissionEfficiency; ForceDrive = TorqueDrive / WHEEL_RADIUS; rearWheelsAngularAcceleration = TorqueDrive / (getCylinderInertia( 75, WHEEL_RADIUS) * 2); rearWheelsAngularVelocity += rearWheelsAngularAcceleration * TIME_STEP; acceleration = ForceDrive / mass; velocity = velocity + (TIME_STEP * acceleration); position = position + (TIME_STEP * velocity); 

What i don't understand is the fact that we calculate the acceleration with the ForceDrive / mass...
But the rearWheels rotation depend of the inertia... ?

In my simulation, how can i get the wheel turn in a realistic behavior compared to the car speed ???
Right now, too slow or too fast... (It depends on the amount of inertia i set)...

I am a little bit confuse.
Any help or comment would help a lot.

Thank you very much for any answer.
Regards.

##### Share on other sites
nope, that's not the way to do it. Here's a simple breakdown of the process you need to simulate:

- Engine accelerates the wheels and you are doing it right.
- Wheel relative speed with respect to the ground (slip) generates longitudinal forces.. according to whatever slip/force relationship you have (paecjjka? brush? lookup table?)
- Longitudinal forces accelerate the car and SLOW down wheel / drivetrain and engine

##### Share on other sites
Hey Kunos !

Some times ago, i made a post to get a simple 2D car simulation and made it work. (I remember you was also joining the thread ;) )
Previous Car demo

But in my previous simulation pacejka was not implemented and the wheels was just following the car speed. (0 slip).

Now, i am back for more and i would like to add pacejka LONGITUDINAL formula to get a more interesting result. (I don't need pacjka lateral because its only a straight line sim at the moment...).
But i can't understand where to put the formula ? what is the timing ?

I need to know the back wheels angular velocity + the car velocity to get the slip ratio right ?

Hum, i really have trouble to understand here...

The car SLOW down the wheels ???

##### Share on other sites

The car SLOW down the wheels ???

No it is not the car. It is the longitudinal force generated by the tyre at the point of contact. This is acting on the wheel center moving it forward (or backward) but it is also creating a torque around the wheel axis that gets transfered to the drivetrain and engine. Draw a wheel on a paper, apply a force at the bottom of it and it will be easy to visualize the torque that will try to slow down wheel, drivetrain and engine.

If you disregard this torque (in my code this is called "feedback torque") the engine will always accelerate VERY fast regardless of the car weight, the only variable controlling how fast the engine (and thus, wheel) will rev up is the wheel inertia.. and that, of course, can't be true.

##### Share on other sites
Hi kunos, thank you for taking time to reply.
I understand what you mean.

To recap, if i disregard this torque, its like my car weight was like 0kg right ?

If i understand, the car weight is the load on the tire for Pacejka curve ? (Is half of the car weight a good value for the rear wheels ?)
And the pacejka curve will give me the resulting feedback torque ?

Is something like this correct ?(One more time i would like to ignore the slip for the moment).

 //We get the Forcedrive first TorqueEngine = 200; TorqueDrive = TorqueEngine * gearRatio * differentialRatio * transmissionEfficiency; ForceDrive = TorqueDrive / WHEEL_RADIUS; Then we divide the Force by the mass of the car CarAcceleration = ForceDrive / (mass/2); TorqueFeedback = CarAcceleration * WHEEL_RADIUS; TorqueTotal = TorqueDrive + TorqueFeedback; rearWheelsAngularAcceleration = TorqueTotal / (getCylinderInertia( 75, WHEEL_RADIUS) * 2); rearWheelsAngularVelocity += rearWheelsAngularAcceleration * TIME_STEP; 

**EDIT**
in my code this is called "feedback torque"[/quote]
You made a tutorial somewhere ?

##### Share on other sites

Hi kunos, thank you for taking time to reply.
I understand what you mean.

To recap, if i disregard this torque, its like my car weight was like 0kg right ?

If i understand, the car weight is the load on the tire for Pacejka curve ? (Is half of the car weight a good value for the rear wheels ?)
And the pacejka curve will give me the resulting feedback torque ?

Is something like this correct ?(One more time i would like to ignore the slip for the moment).

 //We get the Forcedrive first TorqueEngine = 200; TorqueDrive = TorqueEngine * gearRatio * differentialRatio * transmissionEfficiency; ForceDrive = TorqueDrive / WHEEL_RADIUS; Then we divide the Force by the mass of the car CarAcceleration = ForceDrive / (mass/2); TorqueFeedback = CarAcceleration * WHEEL_RADIUS; TorqueTotal = TorqueDrive + TorqueFeedback; rearWheelsAngularAcceleration = TorqueTotal / (getCylinderInertia( 75, WHEEL_RADIUS) * 2); rearWheelsAngularVelocity += rearWheelsAngularAcceleration * TIME_STEP; 

**EDIT**
in my code this is called "feedback torque"

You made a tutorial somewhere ?
[/quote]

hya.. sorry for the long time to answer.. it has been relocation time and I am finally settling in

Your code is a huge oversimplification of the situation, it's difficult to understand if the implications of that simplification are clear or not to you.. For example you are still assuming that the inertia of the drivetrain seen from the engine is the same as the inertia seen from the wheels... which isn't the case because the gear and final ratios involved.
Calculating inertias for geared components can be tricky.. I suggest you to google for a nice math rundown from Ruud Van Gaal about this matter, or get yourself a copy of the car dynamics book by Gillespie that goes through this stuff a bit.

Sadly no, I never had the time to write a tutorial on these stuff.. too busy coding.

##### Share on other sites
Hey kunos, thank you for following my thread.

I decided to rethink my code and adopt a new strategy..

After reading a lot of documentation about the traction force (I think this is what is missing in my code now) and pacejka.
But there is still something that i don't understand.

My longitudinal Pacejka return a number between 0 and 1. (Is it supposed to be correct ?)
Then, i do not really know what to do with this output.. Every articles i read say that Pacejka return a force.

What force does it return ? Traction Force ? How do i calculate this traction force if my output is between 0 and 1 ?

##### Share on other sites
Guys, that ain't rocket science after all. If you have 0 slip, then the linear velocity of the point of the wheel touching the ground is zero, and that's enough to work out a kinetic model.

##### Share on other sites
Surely if you have the velocity of the car, the angular velocity of the wheel, assuming no slip, should just be the magnitude of the car velocity, divided by the circumference of the wheel?

##### Share on other sites
Guys, that ain't rocket science after all. If you have 0 slip, then the linear velocity of the point of the wheel touching the ground is zero, and that's enough to work out a kinetic model. [/quote]

Surely if you have the velocity of the car, the angular velocity of the wheel, assuming no slip, should just be the magnitude of the car velocity, divided by the circumference of the wheel? [/quote]

I a sorry my first post was not clear.
Probably because i am not English native.

In fact, my question was not a kinetic problem, but i was trying to understand how to calculate the good way of calculating wheels rotation speed/
Then Kunos told me that the way of doing my calculation was not correct. He also suggest me to take the Friction force in consideration.

So, i still do not understand how to deal with the Pacejka longitudinal and how to use it correctly in my program.

As i said, before, the force returned from pacejka is between 0 and 1. I still don't know if it is a correct way of returning the friction force and how to deal with it...
May i have some more explanations ?

Sorry again in my first topic was confusing.
Regards.

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 15
• 21
• 21
• 11
• 25