Bernhard Wymann | 29 Jan 2012 14:57
Picon
Favicon

Re: Unable to compile all-in-one torcs 1.3.2

Hi Alessandro

> For that purpose, i need to start practise race and then if my robot is
> stuck or meets some other "bad" condition i want to re-start the
> practice race from the beginning. I want to do it automatically without
> my manual input.
> I tried to call some of functions declared in racemain.h from my
> driver.cpp class, but in all cases the engine restarts completely (i.e.
> as i choosed "quit game" and then re-launched it) and it needs my human
> input to select a practice race again and to start it.
> Can you help me to understand how to do this task if it's possible?

Hmm, I could imagine a quick and dirty solution, but did not try it:
- Record a screen macro with a screen macro recorder to start the race 
(this starts it up)
- If your robot discovers that it wants to restart do an "exit" in your 
robot (this shuts it down), in the robots shutdown function you could do 
the same.
- Now create a shell/batch script/application which does:
1. do while "torcs is running" (so hang here till the process is gone)
1. execute start macro
2. sleep a moment
3. goto 1

Another solution would be to modify these 2 things (should be easy as well):
- Add in the car->ctrl struct a field where your robot can ask the 
simulation to terminate
- Evaluate this in the raceengine, set up a state transition (modify the 
race state machine in src/libs/raceengineclient/racestate.cpp)

(Continue reading)


Gmane