The TORCS Racing Board
Username: Password: Remember Me?
Lost Password Register
Author: wdbee | Created: 2019-10-01 16:57:27
Subject: Wheel-2 USR Crash
Hi all,

here I get a crash starting the race at usr_2019 opponent.cpp line 482.
Any thing I can do?

Last Edited: 2019-10-01 16:57:27 by wdbee
    Author: dummy | Created: 2019-10-01 17:46:55
    Subject: Re: Wheel-2 USR Crash
    Same problem here. It's opponent.cpp:483 though:

    if (t_impact < 10.0 ||
    Last Edited: 2019-10-01 17:46:55 by dummy
      Author: firechief | Created: 2019-10-02 04:03:33
      Subject: Re: Wheel-2 USR Crash
      This is a little difficult for me to solve because I'm _not_ getting the crash - isn't that always the way?

      My guess is it's trying to query arrays that haven't been setup yet given it's crashing at the very start of the race. As a hack-workaround I suggest changing line 477 to this:-

      if (simTime > 1.0 && team != TEAM_FRIEND && car->_speed_x >= mycar->_speed_x - 2.0 && dist > 0)

      Adding the simTime test should stop this section of code from executing until the race is underway, and (fingers crossed) stop it from crashing.
      Last Edited: 2019-10-02 04:03:33 by firechief
        Author: dummy | Created: 2019-10-02 09:48:28
        Subject: Re: Wheel-2 USR Crash
        Thanks Andrew. It works!
        And welcome to the club of the 'uninitialisers'. I was one of them in the early races and wdbee as well. We only got rid of them with the help of Valgrind, so I ran Valgrind and sure enough it is complaining about something in USR. Will send you the report via mail. Maybe you find the root cause(s) of the problem(s).

        Last Edited: 2019-10-02 09:48:28 by dummy