Re: System stability and changing gears in TORCS.

James Ihrig <[email protected]> Sat, 24 Nov 2012 23:57:39 -0500
Newsgroups gmane.games.torcs.devel
Message-ID <CAKQyFNddmzf=2oXNKuWP45RS5jg8DqkVVvxh1WRfXwjPO1t_Rw@mail.gmail.com>
--===============1722726051334324289==
Content-Type: multipart/alternative; boundary=0016e6dd96d1f6028404cf4aa70d

--0016e6dd96d1f6028404cf4aa70d
Content-Type: text/plain; charset=ISO-8859-1

Thank you, I was able to solve both the gear changing problem as well as
the crash on driver selection.

As a note, I think the crash on driver selection may have been related to
my random crashes during runs when I issued a restart. Once I changed my
name and description from:


    modInfo->name    = "MyBot";        /* name of the module (short) */
    modInfo->desc    = "";    /* description of the module (can be long) */

to

    modInfo->name    = strdup("MyBot");        /* name of the module
(short) */
    modInfo->desc    = strdup("");    /* description of the module (can be
long) */

I no longer have an issue with that. I hadn't followed the other driver
format exactly since I am not ever allowing multiple cars in my tests.

I still don't know why my earlier attempts at gear changing didn't work,
but your example code seemed to work. I will look at it more closely on
Monday.

As for the time, I am currently using situation->currentTime, my bot isn't
timing some things correctly but at this point I'm still assuming the
mistake is on my end. (30 second timer seems to take 2 minutes to end.)

Am I correct in assuming that situation->currentTime is the current
simulation time I should be using? Am I also OK to assume that this is
measured in seconds?

I have not yet attempted to speed up the simulation again as I'm still
doing stability testing at real-time first.  (450+ race restarts with up to
2 min runs each and not a single program crash so it's looking fantastic so
far.)

Thank you again for your help,

Jim Ihrig


On Sat, Nov 24, 2012 at 10:40 AM, Bernhard Wymann <[email protected]> wrote:

> Hi James
>
>
> > I've been running Torcs-1.3.3 and have had a couple problems. First,
>
>> when running my bot at a faster speed than real-time, my bot will
>> sometimes float straight up, then off to the side of the track and the
>> race will end. (This issue seems like a bug, but I'm reluctant to say so
>> since I've modified the TORCS code.) Second, I am having trouble with
>>
>
> I guess this must have something to do with your changes, I have never
> seen/heard of a problem like this before. The problem "makes no sense" if
> you look at how TORCS works: It simulates basically in simulation time,
> just when you have a "watching mode" selected it synchronizes real and
> simulation time to spit out frames, that is it. So I doubt that there can
> be something wrong. I hope you do not rely on the real time clock in your
> robot, only use the simulation time.
>
>
>  I have tried to copy/paste this into my drive() fuction (from other
>> drivers code) but all I see is the gear bouncing between 1st and 2nd
>> gear, so I feel I must be missing something. I didn't understand what
>> the code was doing so I tried a bunch of variations with _gear and
>> _gearCmd and and even tried manipulating the clutch. Is there any
>> documentation on how gear changing is supposed to work?
>>
>
> No, but it is trivial, the gearbox switches to the gear you choose. How
> you do the decision is then your business;-) But one example is explained
> in the robot tutorial: http://www.berniw.org/torcs/**robot/ch3/gears.html<http://www.berniw.org/torcs/robot/ch3/gears.html>
>
> This method just works if the gearbox ratios differ and have the correct
> order, so if you sabotage the gearbox you can make this method fail, but
> for any halfway "real" gearbox it works.
>
>
>  I have tried upgrading to TORCS-1.3.4 to see if my issue with the bot
>> leaving the course would be fixed, but it crashes once I select a track
>> when configuring the race. (It seems to be crashing sometime after the
>> constructor is called for my bot, but before any other function in that
>> class.) Is there anything I need to know to move my bot to the newer
>> version?
>>
>
> Maybe, have a loot at this, this is the only adoption regarding drivers in
> 1.3.4, all the other bots are unchanged (if I remember correct):
> http://torcs.cvs.sourceforge.**net/viewvc/torcs/torcs/torcs/**
> src/drivers/human/human.cpp?**r1=1.45.2.9&r2=1.45.2.10&**pathrev=r1-3-1<http://torcs.cvs.sourceforge.net/viewvc/torcs/torcs/torcs/src/drivers/human/human.cpp?r1=1.45.2.9&r2=1.45.2.10&pathrev=r1-3-1>
>
> If you took bt/beriw/etc. robots as base it should work then I guess. I
> recommend just comparing what you do with the existing robots or running
> the debugger, then you will see.
>
>
>  I'd also like to note that none of the links in the FAQ seem to be
>> working right now.
>>
>
> I recognized that some days ago, but I did not yet have time to look into
> this, I upgraded the CMS recently, and it could be the result of a cross
> site scripting fix which has done there, but I have to look into this.
>
> Best regards
>
> Bernhard
>

--0016e6dd96d1f6028404cf4aa70d
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Thank you, I was able to solve both the gear changing problem as well as th=
e crash on driver selection.<br><br>As a note, I think the crash on driver =
selection may have been related to my random crashes during runs when I iss=
ued a restart. Once I changed my name and description from:<br>
<br><br><font size=3D"1"><span style=3D"font-family:courier new,monospace">=
=A0=A0=A0 modInfo-&gt;name=A0=A0=A0 =3D &quot;MyBot&quot;;=A0=A0=A0 =A0=A0=
=A0 /* name of the module (short) */<br>=A0=A0=A0 modInfo-&gt;desc=A0=A0=A0=
 =3D &quot;&quot;;=A0=A0=A0 /* description of the module (can be long) */</=
span></font><br>
<br>to<br><font size=3D"1"><br><span style=3D"font-family:courier new,monos=
pace">=A0=A0=A0 modInfo-&gt;name=A0=A0=A0 =3D strdup(&quot;MyBot&quot;);=A0=
=A0=A0 =A0=A0=A0 /* name of the module (short) */<br>=A0=A0=A0 modInfo-&gt;=
desc=A0=A0=A0 =3D strdup(&quot;&quot;);=A0=A0=A0 /* description of the modu=
le (can be long) */</span></font><br>
<br>I no longer have an issue with that. I hadn&#39;t followed the other dr=
iver format exactly since I am not ever allowing multiple cars in my tests.=
<br><br>I still don&#39;t know why my earlier attempts at gear changing did=
n&#39;t work, but your example code seemed to work. I will look at it more =
closely on Monday.<br>
<br>As for the time, I am currently using situation-&gt;currentTime, my bot=
 isn&#39;t timing some things correctly but at this point I&#39;m still ass=
uming the mistake is on my end. (30 second timer seems to take 2 minutes to=
 end.) <br>
<br>Am I correct in assuming that situation-&gt;currentTime is the current =
simulation time I should be using? Am I also OK to assume that this is meas=
ured in seconds?<br><br>I have not yet attempted to speed up the simulation=
 again as I&#39;m still doing stability testing at real-time first.=A0 (450=
+ race restarts with up to 2 min runs each and not a single program crash s=
o it&#39;s looking fantastic so far.)<br>
<br>Thank you again for your help,<br><br>Jim Ihrig<br><div class=3D"gmail_=
extra"><br><br><div class=3D"gmail_quote">On Sat, Nov 24, 2012 at 10:40 AM,=
 Bernhard Wymann <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]"=
 target=3D"_blank">[email protected]</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">Hi James<div class=3D"im"><br>
<br>
&gt; I&#39;ve been running Torcs-1.3.3 and have had a couple problems. Firs=
t,<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
when running my bot at a faster speed than real-time, my bot will<br>
sometimes float straight up, then off to the side of the track and the<br>
race will end. (This issue seems like a bug, but I&#39;m reluctant to say s=
o<br>
since I&#39;ve modified the TORCS code.) Second, I am having trouble with<b=
r>
</blockquote>
<br></div>
I guess this must have something to do with your changes, I have never seen=
/heard of a problem like this before. The problem &quot;makes no sense&quot=
; if you look at how TORCS works: It simulates basically in simulation time=
, just when you have a &quot;watching mode&quot; selected it synchronizes r=
eal and simulation time to spit out frames, that is it. So I doubt that the=
re can be something wrong. I hope you do not rely on the real time clock in=
 your robot, only use the simulation time.<div class=3D"im">
<br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
I have tried to copy/paste this into my drive() fuction (from other<br>
drivers code) but all I see is the gear bouncing between 1st and 2nd<br>
gear, so I feel I must be missing something. I didn&#39;t understand what<b=
r>
the code was doing so I tried a bunch of variations with _gear and<br>
_gearCmd and and even tried manipulating the clutch. Is there any<br>
documentation on how gear changing is supposed to work?<br>
</blockquote>
<br></div>
No, but it is trivial, the gearbox switches to the gear you choose. How you=
 do the decision is then your business;-) But one example is explained in t=
he robot tutorial: <a href=3D"http://www.berniw.org/torcs/robot/ch3/gears.h=
tml" target=3D"_blank">http://www.berniw.org/torcs/<u></u>robot/ch3/gears.h=
tml</a><br>

<br>
This method just works if the gearbox ratios differ and have the correct or=
der, so if you sabotage the gearbox you can make this method fail, but for =
any halfway &quot;real&quot; gearbox it works.<div class=3D"im"><br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
I have tried upgrading to TORCS-1.3.4 to see if my issue with the bot<br>
leaving the course would be fixed, but it crashes once I select a track<br>
when configuring the race. (It seems to be crashing sometime after the<br>
constructor is called for my bot, but before any other function in that<br>
class.) Is there anything I need to know to move my bot to the newer<br>
version?<br>
</blockquote>
<br></div>
Maybe, have a loot at this, this is the only adoption regarding drivers in =
1.3.4, all the other bots are unchanged (if I remember correct):<br>
<a href=3D"http://torcs.cvs.sourceforge.net/viewvc/torcs/torcs/torcs/src/dr=
ivers/human/human.cpp?r1=3D1.45.2.9&amp;r2=3D1.45.2.10&amp;pathrev=3Dr1-3-1=
" target=3D"_blank">http://torcs.cvs.sourceforge.<u></u>net/viewvc/torcs/to=
rcs/torcs/<u></u>src/drivers/human/human.cpp?<u></u>r1=3D1.45.2.9&amp;r2=3D=
1.45.2.10&amp;<u></u>pathrev=3Dr1-3-1</a><br>

<br>
If you took bt/beriw/etc. robots as base it should work then I guess. I rec=
ommend just comparing what you do with the existing robots or running the d=
ebugger, then you will see.<div class=3D"im"><br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
I&#39;d also like to note that none of the links in the FAQ seem to be<br>
working right now.<br>
</blockquote>
<br></div>
I recognized that some days ago, but I did not yet have time to look into t=
his, I upgraded the CMS recently, and it could be the result of a cross sit=
e scripting fix which has done there, but I have to look into this.<br>

<br>
Best regards<span class=3D"HOEnZb"><font color=3D"#888888"><br>
<br>
Bernhard<br>
</font></span></blockquote></div><br></div>

--0016e6dd96d1f6028404cf4aa70d--


--===============1722726051334324289==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
--===============1722726051334324289==
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

--===============1722726051334324289==--