NVIDIAGameWorks / PhysX-3.4

NVIDIA PhysX SDK 3.4
https://www.nvidia.com/
2.35k stars 274 forks source link

Bug: the direction of camber thrust in PxVehicle #26

Closed buyaoshuo-netease closed 7 years ago

buyaoshuo-netease commented 7 years ago

It's strange that my posts in DevTalk Forums became hidden, so I create an issue here.

Following lines are from the original post :

"In the default coordinate settings, when posing the vehicle wheels, the signs of camber angle agree with left wheels. (So we must reverse the signs when setting up right wheels, Am I right ?)

However, in this coordinate settings, for left wheels, positive camber angles will generate lateral forces along negative x-axis, negative camber angles will generate lateral forces along positive x-axis, The implementation of PxVehicleComputeTireForceDefault follows equation (17) and equation (19) of CarSim Manual Appendix H, which doing the reverse."

https://devtalk.nvidia.com/default/topic/1011024/physx-and-physics-modeling/possible-bug-the-direction-of-camber-thrust-in-pxvehicle-physx-3-4-/

In his/her replies, gyeoman confirmed the bug, but he/she also suggested that the sign of camber angles do not affect the direction of camber thrust. I do not think it's correct. See the following wiki page, it has a good explanation.

https://en.wikipedia.org/wiki/Camber_thrust

And the following line comes from Gillespie's "Fundamentals of Vehicle Dynamics":

"...For discussion it is sufficient to recognize that the force is always oriented in the direction the tire is inclined..."

As gyeoman pointed out, the tire model comes from Equation 19, but Equation 19 comes from Equation 17. By Equation 17, it's easy to see the effect of the sign of camber angles.

Sorry for the lack of analysis, it really pains me to type a long explanation (I am not good at English), I give up. :(

gyeomannvidia commented 7 years ago

Sorry, I really don't know what happened to your comments on devtalk.

Camber can be a primary source of turning force for motorbikes and bicycles. I can corner on my bicycle, for example, just by leaning in to the turn. The camber angle generates a turning force and that force is dependent on the direction of the camber. I can steer to the left or right just by leaning in a different direction. You're quite right about that. For cars and trucks, however, camber is only a secondary force due to cancelling between the left and right wheels. The net effect is that it is normally no more than a correction to the primary force from the steer angle. Here's what Gillespie says about camber for 4-wheeled vehicles (taken from page 359):

"On passenger cars and trucks, camber thrust contributes to undesteer behavior, but normally as a secondary source".

The PhysX Vehicle SDK is really geared towards cars and trucks rather than motorbikes. The default tire model is adapted from CarSimEd, which was also developed with cars and trucks in mind. For cars and trucks the net effect of camber angle is to generate understeer. I think Gillespie is quite clear about that. The purpose of the camber angle in the physx vehicle sdk is to introduce understeer. There is a bug in there, which you kindly pointed out. My intention was to add an understeer effect by combining the steer and camber angles to introduce an effective steer angle. The effective steer angle (Teff) should be smaller in magnitude than the raw steer angle. Sadly, there's a bug right now so that isn't happening but it was my intention.

Is my proposed fix physically correct? No, it is a simplistic model of camber forces. You're quite right to point that out. Rather than model all the forces and torques arising from camber and adding them all together I started with the expected effect for cars and trucks. The expected effect is understeer so that's what I implemented. A more detailed model would result in camber acting as a primary effect for 2-wheeled vehicles but only contributing an understeer for balanced 4-wheel vehicles. My ideas was just to start at the most typical outcome of understeer and make that as simple to control as possible. The model is simple and has its limitations but should be enough for most users.

If you wish to model camber as a primary effect then I recommend implementing your own tyre shader. The sdk will call your shader function as a stateless callback. If you have any questions about that I'm happy to help.

Cheers,

Gordon

buyaoshuo-netease commented 7 years ago

Thanks for your reply, Gordon. But as your pointed out, camber thrust contributes to undesteer behavior just due to net effects between left wheels and right wheels. This does not change the fact about the dependency between the camber angle and the camber thrust for a single wheel. May I just use CarSimEd model with the camber thrust direction corrected ? Equation 17 and 19 accept both negative and positive camber angles.

gyeomannvidia commented 7 years ago

You're free to make any changes you like to the tyre force function. Please be aware, though, that the physx vehicle sdk will continue to model only net effects of camber. That was the original intention - to keep this as simple as possible. Tyre shaders were introduced to allow advanced users to implement more complex models.

buyaoshuo-netease commented 7 years ago

OK, that's enough for me right now. As a final comment, note that in particular, negative camber (at rest) improves grip when cornering. Please beware of this when you fix the camber thrust part.

gyeomannvidia commented 7 years ago

I'll close this issue now.

Thanks for pointing out the bug.