• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5
Force Feedback bug
07-15-2012, 04:06 PM,
 LBodnar Junior Member Posts: 37 Threads: 10 Joined: Jul 2011
Force Feedback bug
feedback is never reset to zero before the iteration loop.
In fact it is not even intialised before first use.
Is this intended?

Leo

Code:
```void CARDYNAMICS::updateAction(btCollisionWorld * collisionWorld, btScalar dt) { ...     int repeats = 10;     btScalar dt_internal = dt / repeats;     for (int i = 0; i < repeats; ++i)     {         Tick(dt_internal, force, torque);         feedback += 0.5 * (tire[FRONT_LEFT].GetFeedback() + tire[FRONT_RIGHT].GetFeedback());     }     feedback /= (repeats + 1); ... }```
07-15-2012, 04:53 PM,
 NaN Posting Freak Posts: 2,024 Threads: 120 Joined: Jan 2010

Good catch.

The loop is OK, just a low pass to smooth the value (n + 1 values / n + 1). But the initial value should be set of course.

I've pushed a fix, don't have access to a ff-device to test atm unfortunately.
07-15-2012, 06:28 PM,
 LBodnar Junior Member Posts: 37 Threads: 10 Joined: Jul 2011

Shouldn't feedback be set to zero before 10 iterations loop in CARDYNAMICS::updateAction() ?
07-16-2012, 01:54 AM,
 NaN Posting Freak Posts: 2,024 Threads: 120 Joined: Jan 2010

It is the algorithmic implementation of a low pass filter(to smooth the value):
Quote:for i from 1 to n
y[i] :=a * x[i] + (1 - a) * y[i-1]
with a = 10/11.

It would be more obvious with:
Code:
```    float new_feedback = 0     for (int i = 0; i < repeats; ++i)     {         ...         new_feedback += 0.5 * (tire[FRONT_LEFT].GetFeedback() + tire[FRONT_RIGHT].GetFeedback());     }     new_feedback /= repeats;                            // average of internal solver loop aka new_feedback     float a = repeats / (repeats + 1)                    // weight     feedback = a * new_feedback + (1 - a) * feedback;    // low pass```
07-16-2012, 05:15 AM,
 LBodnar Junior Member Posts: 37 Threads: 10 Joined: Jul 2011

Sure, I could see exponentially decaying LPF algorithm but I was not sure if it was intentional. I am just surprised to see an arbitrary bodge in an academically accurate simulator.
Leo
07-16-2012, 05:24 AM,
 NaN Posting Freak Posts: 2,024 Threads: 120 Joined: Jan 2010

Academically accurate simulator ?
07-16-2012, 05:33 AM,
 LBodnar Junior Member Posts: 37 Threads: 10 Joined: Jul 2011

Well, if you account for things like contact patch displacement in an Ackermann geometry I'd call it reasonably accurate.
Leo
07-16-2012, 05:55 AM,
 NaN Posting Freak Posts: 2,024 Threads: 120 Joined: Jan 2010

For my taste, there is a bit too much stuff going on at tire contacts and the suspension behaves not so well at the simulation steps we are running. But yeah, it is somewhat of an approximation/compromise.

I wish I had time to work on my fork to make it a bit more accurate.
07-16-2012, 06:32 AM,
 NaN Posting Freak Posts: 2,024 Threads: 120 Joined: Jan 2010

OK, one thing that could be done is to move the low pass filter stuff out of the simulation into force feedback code and return current "normalized steering torque" instead of the feedback value.

Anyone interested?
07-16-2012, 07:20 AM,
 LBodnar Junior Member Posts: 37 Threads: 10 Joined: Jul 2011

I agree that this is the best solution.

Forum Jump:

Users browsing this thread: 1 Guest(s)