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) */
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,
Hi JamesI 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'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
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
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?
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.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):
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
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 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.
I'd also like to note that none of the links in the FAQ seem to be
working right now.