Simulation timestep

Fady
2013-07-31
2013-08-07
  • Fady

    Fady - 2013-07-31

    Hi,
    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?

    Thank!

     
  • Bernhard Wymann

    Bernhard Wymann - 2013-08-01

    Hi

    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.

    Best regards

    Bernhard

     
  • Fady

    Fady - 2013-08-01

    Thanks Bernhard.
    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?

    Best,
    Fady

     
  • Bernhard Wymann

    Bernhard Wymann - 2013-08-07

    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.

    Best regards

    Bernhard

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks