Re: Position is (nan, nan, nan)
James Ihrig <[email protected]> Tue, 27 Nov 2012 22:21:49 -0500
| Newsgroups | gmane.games.torcs.devel |
|---|---|
| Message-ID | <CAKQyFNfMm9dv6RXxJhs4u8X1q+JFrwYk5GN+RmxSQhVBA31W+g@mail.gmail.com> |
--===============0745939266994184873== Content-Type: multipart/alternative; boundary=f46d04447df7cbb09d04cf85aa11 --f46d04447df7cbb09d04cf85aa11 Content-Type: text/plain; charset=ISO-8859-1 Just realized I may have left out some information that may be important in that last message: The track is I am running is "Forza" under "Road Tracks". The position my car was at was just past the start line somewhere at the edge of one of the two buildings, (or between them) at the right hand side of the track. Jim On Tue, Nov 27, 2012 at 9:50 PM, James Ihrig <[email protected]> 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 > --f46d04447df7cbb09d04cf85aa11 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Just realized I may have left out some information that may be important in= that last message:<br><br>The track is I am running is "Forza" u= nder "Road Tracks".<br><br>The position my car was at was just pa= st the start line somewhere at the edge of one of the two buildings, (or be= tween them) at the right hand side of the track.<br> <br>Jim<br><div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">On= Tue, Nov 27, 2012 at 9:50 PM, James Ihrig <span dir=3D"ltr"><<a href=3D= "mailto:[email protected]" target=3D"_blank">[email protected]</a>></spa= n> wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex">Hello,<br><br>I am still running into progra= m crashes once in awhile, but for a different reason this time. It seemed t= hat my sensors were picking up bad values sometimes. (I use offset centerli= ne etc. for some calculations.)<br> <br>My bot currently turns hard right sometimes straight into the wall at t= he beginning of the race. Since I am using a neural network this is expecte= d for some runs. So I added this bit of code into my drive funciton:<br> <br>static void <br>drive(int index, tCarElt* car, tSituation *situation)<b= r>{<br>=A0=A0=A0 std::cout << "Positition =3D ("<br>=A0=A0= =A0=A0=A0=A0=A0 << car->pub.DynGC.pos.x << ", "<br= >=A0=A0=A0=A0=A0=A0=A0 << car->pub.DynGC.pos.y << ", &q= uot;<br> =A0=A0=A0=A0=A0=A0=A0 << car->pub.DynGC.pos.z << ") &qu= ot; <<std::endl;<br>=A0=A0=A0 ...<br>}<br><br>The output is:<br><br>.= ..<br>Positition =3D (667.472, 1163.4, 3.84071)<br>Positition =3D (667.472,= 1163.4, 3.84074)<br> Positition =3D (667.472, 1163.4, 3.84076)<br>Positition =3D (667.472, 1163.= 4, 3.84079)<br>Positition =3D (667.472, 1163.4, 3.84081)<br>Positition =3D = (667.472, 1163.4, 3.84083)<br>Positition =3D (667.472, 1163.4, 3.84084)<br>= Positition =3D (667.472, 1163.4, 3.84086)<br> Positition =3D (667.472, 1163.4, 3.84087)<br>Positition =3D (667.472, 1163.= 4, 3.84088)<br>Positition =3D (667.472, 1163.4, 3.84089)<br>Positition =3D = (667.472, 1163.4, 3.8409)<br>Positition =3D (-nan, nan, -nan)<br>/usr/local= /bin/torcs: line 53:=A0 7428 Segmentation fault=A0=A0=A0=A0=A0 (core dumped= ) $LIBDIR/torcs-bin -l $LOCAL_CONF -L $LIBDIR -D $DATADIR $*<br> <br><br>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 thi= s.) My solution will be to check for nan of course, but I thought I'd m= ention 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 definite= ly do not attempt to update position directly in my code, only the gas, bra= ke and steering commands.<br> <br>At the very least, someone might check the geometry at the above positi= on and see if there is anything funky there just in case. (I have no idea h= ow to check it myself.) This should be a rare case since my bot did 1270 ru= ns before this happened. Subsequent loads of my 1271st network will cause i= t to crash at the same point every time. (I have a separate program generat= ing the networks, so I have been able to load that network in via XML as a = first run multiple times)<br> <br>Feel free to let me know if I'm completely of my rocker here!<br><b= r>Jim<br> </blockquote></div><br></div> --f46d04447df7cbb09d04cf85aa11-- --===============0745939266994184873== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ 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 --===============0745939266994184873== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Torcs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/torcs-devel --===============0745939266994184873==--