Re: Position is (nan, nan, nan)
Bernhard Wymann <[email protected]> Fri, 30 Nov 2012 09:36:32 +0100
| Newsgroups | gmane.games.torcs.devel |
|---|---|
| Organization | wytec |
| Message-ID | <[email protected]> |
Hi Jim
Sensors, so do you use 1.3.1 with the competition patch? Which platfrom?
I checked the side right after the start with TORCS 1.3.4, car7-trb1,
human player, everything seems to be fine.
Beware, car setups are not validated, so if you have a fancy car
definition file this might let the simulation "explode" (once there is
somewhere a NAN produced it propagates to whatever it "touches", the
"things fall apart"), e.g. super strong damping on "fast" values causes
a NaN somewhere when hitting a high curb on high speed IIRC (e.g. the
curb of the last chicane before the start on e-track-1, high speed and
high curb slope and strong damping results in an exorbitant force -> plonk).
There are usually additional compiler switches/pragmas to jump into the
debugger on FPU exceptions, this way you might be able to catch it for
investigation, see:
vs2008/10:
http://stackoverflow.com/questions/4454582/visual-studio-c-2008-2010-break-on-float-nan
gcc:
http://www.network-theory.co.uk/docs/gccintro/gccintro_70.html
http://www-personal.umich.edu/~williams/archive/computation/fe-handling-example.c
If you found an actual but in TORCS please let me know:-)
Best regards
Bernhard
On 11/28/2012 03:50 AM, James Ihrig wrote:
> Hello,
>
> I am still running into program crashes once in awhile, but for a
> different reason this time. It seemed that my sensors were picking up
> bad values sometimes. (I use offset centerline etc. for some calculations.)
>
> My bot currently turns hard right sometimes straight into the wall at
> the beginning of the race. Since I am using a neural network this is
> expected for some runs. So I added this bit of code into my drive funciton:
>
> static void
> drive(int index, tCarElt* car, tSituation *situation)
> {
> std::cout << "Positition = ("
> << car->pub.DynGC.pos.x << ", "
> << car->pub.DynGC.pos.y << ", "
> << car->pub.DynGC.pos.z << ") " <<std::endl;
> ...
> }
>
> The output is:
>
> ...
> Positition = (667.472, 1163.4, 3.84071)
> Positition = (667.472, 1163.4, 3.84074)
> Positition = (667.472, 1163.4, 3.84076)
> Positition = (667.472, 1163.4, 3.84079)
> Positition = (667.472, 1163.4, 3.84081)
> Positition = (667.472, 1163.4, 3.84083)
> Positition = (667.472, 1163.4, 3.84084)
> Positition = (667.472, 1163.4, 3.84086)
> Positition = (667.472, 1163.4, 3.84087)
> Positition = (667.472, 1163.4, 3.84088)
> Positition = (667.472, 1163.4, 3.84089)
> Positition = (667.472, 1163.4, 3.8409)
> Positition = (-nan, nan, -nan)
> /usr/local/bin/torcs: line 53: 7428 Segmentation fault (core
> dumped) $LIBDIR/torcs-bin -l $LOCAL_CONF -L $LIBDIR -D $DATADIR $*
>
>
> Once the position is nan or -nan, my program crashes because these
> values are ultimately used to index an array that I store approximations
> of a sigmoid in. (I don't imagine most others would do something like
> this.) My solution will be to check for nan of course, but I thought I'd
> mention it here in case it is a bug with TORCS. Perhaps some bad
> geometry at the edge of the track? Perhaps it's just my code again, but
> I definitely do not attempt to update position directly in my code, only
> the gas, brake and steering commands.
>
> At the very least, someone might check the geometry at the above
> position and see if there is anything funky there just in case. (I have
> no idea how to check it myself.) This should be a rare case since my bot
> did 1270 runs before this happened. Subsequent loads of my 1271st
> network will cause it to crash at the same point every time. (I have a
> separate program generating the networks, so I have been able to load
> that network in via XML as a first run multiple times)
>
> Feel free to let me know if I'm completely of my rocker here!
>
> Jim
>
>
> ------------------------------------------------------------------------------
> Keep yourself connected to Go Parallel:
> INSIGHTS What's next for parallel hardware, programming and related areas?
> Interviews and blogs by thought leaders keep you ahead of the curve.
> http://goparallel.sourceforge.net
>
>
>
> _______________________________________________
> Torcs-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/torcs-devel
>
------------------------------------------------------------------------------
Keep yourself connected to Go Parallel:
TUNE You got it built. Now make it sing. Tune shows you how.
http://goparallel.sourceforge.net