According to the specs, the simulation time step is 0.02sec. I noticed that if the driver's computing time exceeds 0.02sec then the simulator simply waits until he finishes its computation before it refreshes the screen while I thought that the simulator uses the previous control data of the car and doesn't wait for more than 0.02sec.
I simply added a busy wait to the drive function just to see what happens and the graphics refresh rate became slower.
Could you please explain this behavior?
No, the simulation timestep is 0.002s (500Hz), the robots are called all 0.02s (50Hz). The simulator has just one thread and works the following:
- Simulate as fast as you can without worrying about real time
- If visualization is enabled then a frame is rendered if:
1. the simulation time catches up with real time
2. for 2 seconds of simulation time no frame has rendered, so render a frame to show progress and to process GUI events
Have a look as well into the TORCS FAQ, the researchers section.
The scr patch changes the game, if you are interested follow the link on the TORCS site.
I am more interested in the robot calls, don't they have a timeout? what happens in case the computational time took more than 0.02sec?
Also, could you please direct me to the place where the AI engine calls the drivers and passes the relevant info?
Without the scr patch, the robots have no timeout (one thread), correct. From my previous post you can see then what happens: the simulation just lags behind real time. The scr patch handles that differently, there you can run the AI on a different computer if you like and it is non-blocking.
The robots are called in raceengine.cpp, around line 600, please have a look as well in the TORCS FAQ.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.