• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5
Better algorithm for speed sensitive steering?
06-27-2009, 03:58 AM,
 fudje Member Posts: 87 Threads: 6 Joined: Dec 2007
Better algorithm for speed sensitive steering?
Don't know about anyone else, but I find the way this is set up at the current time to be wholly annoying, and yet with anything apart from a multiple-turn wheel it's necessary to achieve a reasonable line at speed.

The problem comes when you happen to enter any kind of situation which requires a greater steering range at speed (eg. drifting) - you're left with very little lock angle and will tend to enter an uncontrollable skid in one direction or the other.

I had another dive into the source code to find where this is worked out, grabbed the current algorithm and crunched some algebra until I'd worked out a formula that looked reasonable.

Diff (For obviousnessosity):
Code:
```Index: carcontrolmap_local.cpp =================================================================== --- carcontrolmap_local.cpp    (revision 2505) +++ carcontrolmap_local.cpp    (working copy) @@ -590,8 +590,9 @@     {         float ratio = 20.0f;         float coeff = 1.0; +        float ssco = speedsens*(1-pow(val,2));         if (carmph > 1) -            coeff = ratio/(carmph*(0.1+speedsens*2.0)); +            coeff = ratio/(carmph*(0.1+ssco*2.0));         if (coeff > 1)             coeff = 1.0;```

Now, you can probably tell from looking that this increases the complexity of the damping algorithm by a differential magnitude based on the steering value.

Or, in layman's terms, the speed sensitivity is modified based on both the speed of the car and the amount of steering used such that at most speeds you'd expect to need full lock, it's still available in the same place, however smaller amounts of steering will be dampened.

I applied it with a nice quadratic curve to make it feel like a more direct transition from fine to gross control (even though it's actually less direct).

If you're still lost, here's some graphs to give a representation of what it does to your steering controls:

As you can see there's a lot more lock available to all speeds.

I've tested it on a few cars (GTV6, G4, Z06, 360) and from my perspective it maintains a much smoother drive while giving back control in a sliding situation.

There may be nicer algorithms and there may be more efficient ones. This is by no means the be all and end all of the suchlike. I'd encourage people building from source to try it out, though

Cheers,
fudje
06-28-2009, 01:55 PM,
 joevenzon Administrator Posts: 2,678 Threads: 52 Joined: Jun 2005

Cool plots! I've been wanting to do something like this. Driving the 360, for example, is almost impossible without speed sensitive steering because it's such a twitchy car, but then if you ever break the rear loose (which happens all the time), you can't counter steer to correct.

I added your changes in R2507. This system works great. Most of the steering range is still pretty linear, but at the ends of the range it gets exponential so you can still countersteer effectively. Also, I tweaked the equation I was using for fading in the speed sensitivity -- I realized I really wanted an arctan function, and what I had been using before was basically an approximation of it, so now I just use the arctan directly (this is only called once per car, so no huge performance hit).
07-14-2009, 05:14 PM,
 alex25 Senior Member Posts: 531 Threads: 42 Joined: Jun 2006

joevenzon Wrote:I added your changes in R2507. This system works great. Most of the steering range is still pretty linear, but at the ends of the range it gets exponential so you can still countersteer effectively.
this really killed the f1 car. at high speeds i turn the wheel and not too much happens. maybe the steering should be car dependent and as such should be defined in the car config file.

--alex--
07-15-2009, 08:11 AM,
 fudje Member Posts: 87 Threads: 6 Joined: Dec 2007

alex25 Wrote:this really killed the f1 car. at high speeds i turn the wheel and not too much happens. maybe the steering should be car dependent and as such should be defined in the car config file.

--alex--

I suspect this may have more to do with that the f1 car(s) appear to be steering to 45Â° still.... I don't think that's even physically possible with their steering arm setup.
07-15-2009, 10:27 PM,
 joevenzon Administrator Posts: 2,678 Threads: 52 Joined: Jun 2005

Here's the only info I could find:

"usually this is adjusted somewhere between 10 (oval) and 35 (Monaco), with a range in the middle being typical for most road courses"

I think the steering angle should be fully adjustable by the user, but I'm not sure about the interface. Should this be part of a new "car tuning" interface (so, a per-car setting), or should this be in the options->controls screen and apply to all cars?
07-15-2009, 10:37 PM,
 alex25 Senior Member Posts: 531 Threads: 42 Joined: Jun 2006

joevenzon Wrote:I think the steering angle should be fully adjustable by the user, but I'm not sure about the interface. Should this be part of a new "car tuning" interface (so, a per-car setting), or should this be in the options->controls screen and apply to all cars?
i really think it should be on a per car basis. a "car tuning" interface is long overdue.

--alex--
07-20-2009, 05:44 PM,
 stan.distortion Member Posts: 88 Threads: 3 Joined: Jul 2009

Kind of off topic for this thread but didn't want to start a new one for it. Tried changing the button press rates at carcontrolmap_local.h@281 to give a quicker fall when a button is released:

This did not want to post no matter what I tried:
carcontrolmap_local.h@293
- float sign = 1.0;
+ float sign = 0.3;

carcontrolmap_local.h@295
- sign = -1.0;
+ sign = -1.2;

I finally got the F1-02 car around a circuit The rates may be messed up for other cars though, that car seems to steer quicker than most others, and the throttle/brake rate could do with being different to the steering as its a bit on the slow side.
cheers
07-22-2009, 10:07 PM,
 joevenzon Administrator Posts: 2,678 Threads: 52 Joined: Jun 2005

Checked it in, R2518. I'll set you up with SVN access to the code repo; PM me your desired user/pass.

Forum Jump:

Users browsing this thread: 1 Guest(s)