I fixed some items and improved my understanding of the steering model. It was incorrectly failing to transition from the static friction to the dynamic friction skid model as I was calculating those forces simultaneously, and the vehicle dynamics caused the calculation for the alternative model to be incorrect.
I also related the stiffness of the pseudo spring forces to prevent skid to the shear forces of a rubber tire with a known tread height and contact patch area. It yields a stiffness very close to the ad hoc stiffness I applied previously, which is nice that it relates to a reasonable physical model for the tires.
Looking at this spring model for static friction, I realized that the algorithm to calculate the force needed to keep the wheels from slipping sideways was rather identical to a PI controller where the integral gain was the stiffness and the proportional gain was the damping constant. It seems to be working very nicely now.
Some additional user improvements:
- Can shift up and down through forward, neutral, and reverse.
- Now transitions between skid and turning model appropriately.
- Indicators are provided to show which steering model is in effect for each wheel. (probably should implement some skid sounds for immersion).
- A simple positive caster model that slowly reduces the steering angle to zero when no steering inputs are given. This replaces suddenly sending it to 0 degrees with the keypad 5 key as activated the skid model inappropriately.
- Minor code cleanup, whitespace, comments, etc..
Feedback welcome, either here or on the related thread.