The TORCS Racing Board
Username: Password: Remember Me?
Lost Password Register
Author: dummy | Created: 2017-05-30 17:42:02
Subject: Strange fa1_2017
I'm just curious. Does fa1_2017 drive a lap without losing control on Windows. On my Linux box he loses control in every lap.
Last Edited: 2017-05-30 17:42:02 by dummy
    Author: firechief | Created: 2017-05-30 17:45:04
    Subject: Re: Strange fa1_2017
    Yes he laps quite well on Windows.
    Last Edited: 2017-05-30 17:45:04 by firechief
      Author: dummy | Created: 2017-05-30 18:16:16
      Subject: Re: Strange fa1_2017
      Thanks, I thought it can't be right.
      Last Edited: 2017-05-30 18:16:16 by dummy
        Author: firechief | Created: 2017-05-30 18:25:52
        Subject: Re: Strange fa1_2017
        I hate to suggest it as it creates work for you, but maybe run it through valgrind if you have time?
        Last Edited: 2017-05-30 18:25:52 by firechief
    Author: fa1 | Created: 2017-05-30 18:31:31
    Subject: Re: Strange fa1_2017
    Sorry to hear that on Linux it behaves differently. Any hint on what the problem might be is of course welcome!
    Last Edited: 2017-05-30 18:31:31 by fa1
    Author: wdbee | Created: 2017-05-30 18:47:25
    Subject: Re: Strange fa1_2017
    Here the fa works as well.

    Could you check that it finds the setup files on LINUX?

    Last Edited: 2017-05-30 18:58:42 by wdbee
    Author: dummy | Created: 2017-06-03 22:04:03
    Subject: Re: Strange fa1_2017
    I found the problem and it works now as intended on Linux as well.
    The reason why it didn't work correctly is in this code segment of getSteer():

    drift_angle = atan(vy/vx);
    if (abs(drift_angle) < DRIFT_TOL ) {
    oversteering = false;
    } else {
    oversteering = true;
    double fact = COUNTER_STEER_FACT;
    alpha = alpha + drift_angle*fact;

    Who can guess what it is?
    Last Edited: 2017-06-03 22:04:03 by dummy
      Author: berniw | Created: 2017-06-03 23:51:22
      Subject: Re: Strange fa1_2017
      abs vs fabs?
      Last Edited: 2017-06-03 23:51:22 by berniw
        Author: dummy | Created: 2017-06-04 09:56:02
        Subject: Re: Strange fa1_2017

        Slolution 1:
        replace abs() with fabs()

        Solution 2:
        #include <cmath>
        replace abs() with std::abs()
        Last Edited: 2017-06-04 09:56:02 by dummy
          Author: fa1 | Created: 2017-06-04 10:34:25
          Subject: Re: Strange fa1_2017
          Thanks a lot for that analysis!
          Should have been fabs, a symple typo we didn't notice.
          Regards, Fabian
          Last Edited: 2017-06-04 10:34:25 by fa1