Position is (nan, nan, nan)
James Ihrig <[email protected]> Tue, 27 Nov 2012 21:50:48 -0500
| Newsgroups | gmane.games.torcs.devel |
|---|---|
| Message-ID | <CAKQyFNfi=wavSEv6tMxA8ZMwe3qB_4R6_rzt7WFLJ_nvboDeNA@mail.gmail.com> |
--===============2334958685995098913==
Content-Type: multipart/alternative; boundary=0016e6dd96d1e0ff4504cf853b0f
--0016e6dd96d1e0ff4504cf853b0f
Content-Type: text/plain; charset=ISO-8859-1
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
--0016e6dd96d1e0ff4504cf853b0f
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hello,<br><br>I am still running into program crashes once in awhile, but f=
or a different reason this time. It seemed that my sensors were picking up =
bad values sometimes. (I use offset centerline 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>
--0016e6dd96d1e0ff4504cf853b0f--
--===============2334958685995098913==
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
--===============2334958685995098913==
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
--===============2334958685995098913==--