I am currently using a driving simulator application based on jMonkeyEngine ([OpenDS]).
I have some trouble to understand how to get a correct deceleration for the controlled vehicle.
According to the [wiki] it is said that the braking function is straightforward and should be applied as simple as
vehicle.brake(brakeForce). My question is then: How do you define
brakeForce to reach a given deceleration? i.e. if I want to reach 10m/s^2 of deceleration, how shall I evaluate the
I read parts of the code from Bullet Physics, but the lack of comments in the source is not helpful.
Subsidiary question, in Bullet Physics they assign the
float maxImpulse = wheel_info.brake != 0f ? wheel_info.brake : defaultRollingFrictionImpulse;
How come that a force is assigned to an impulse?
I thank you in advance for your assistance!
Well the equation between force and acceleration is:
F = m * a, so if you wanted to break with 10m/s^2 (which is quite good, usual vehicles have to brake stable up to 0.9g), you’d do brakeForce = 10 * getVehicleMass().
The Equation between Impulse I and Force F is:
I = Integral(F, t);
This means the Impulse is always a measure of Forces, but time dependent.
Physics Engines use this to simulate the applied force over their discrete time step (since they aren’t continuous)
I haven’t take a look at your page but it might be a good start to have a look at basic vehicle dynamics analysis (mostly for ~10th grade physics).
Momentums and such also come in handy
Thanks Darkchaos, I appreciate your prompt answer. I did not know about how the physics engines were operating, now I understand why impulses are used.
Concerning the basic vehicle dynamics, I am pretty sure I have the knowledge to understand. The problem is that in the OpenDS source code, they defined the
0.004375f * decelerationBrake * mass, with
mass=vehicleMass and here
decelerationBrake = 10 (it is just for the example and not the value that I am after).
The brakeForce is then defined as the percentage of brake pedal input times
maxBrakeForce. For me the constant
0.004375 is a mystery. That is the reason why I came on jme forum, to understand which dimension the fonction
.brake() has as input to try to make some reverse engineering.
I contacted the authors of OpenDS to understand more, since it seems that the factor is defined after some reasons that only them know. I hope I will get an answer.
I have still a minor question, the
.brake() function takes the total force as input or the force/wheel ? (According to your answer it should be the total force but just to be sure)
Thank you again!
Actually I can’t tell you whether this is the total or the per-wheel force.
I guess they just use 0.04375 as m/s^2 of braking then.
It’s a bit wierd though.
It could be that they just experimented to see what looks realistic. It could be that Bullet doesn’t actually behave as in a simulation (especially when you set a too high friction, which allows irrelastic braking).
Try to see what happens when you leave out the constant.
There you can also set different brake values on a per-wheel base
Thanks again. Well I tried many scenarios, without the constant, changing the constant, changing the car model. Weirdly, the car model changes the maximum deceleration reachable, I cannot explain that. Except if the force input in
.brake() is not a force but a torque as said in this document (p. 3) and the wheel radius has an influence. But I would hardly believe that according to your input.
Thank you for your time and I will try to get a straight answer from OpenDS authors to this questioning.
Well it could also be that the documentation is wrong in that case, not stating it’s the actual torque.
That way it would be 0.043m as r_dyn which is pretty small for any wheel. (M = m * a * r)
Btw: Maximum acceleration reachable means that your brake force is actually wrongly orientated and as such accelerates the car.
I agree that in that case the wheel radius would be really small. That is why I do not think that this is the reason…
Oh, and yes I meant deceleration not acceleration.
Well, it could be that it’s meant as 0.43m radius and 1m/s^2 as maximum brake force. Or anything inbetween, like 0.215m and 2m/s^2.
Does the car brake heavy?
Well the constant is
0.004375 so even with your reasoning I am afraid that we are still off.
I am wondering if there is not a scaling somewhere that I have not seen that might explain everything…