Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] Time wrap in recording simulation

Hi

I would like to create a video capture of a simulation, which can be run in real time. To do this I use the Traci screenshot function to make a screenshot after every step, effectively my script is this:

def run_simulation():
step = 0
while traci.simulation.getMinExpectedNumber() > 0:
print(f"SIMULATED {step} seconds")
# Compute and set the next signal setting
...
print(traci.gui.screenshot("View #0", "/tmp/sumosim/img{:07d}-{}.jpg".format(step, datetime.datetime.now())))
traci.simulationStep()
step += 1

I then generate a video using the extracted frames using ffmpeg.

My problem is that sometimes the extracted frame jumps back in time, see e.g. the attached frames, frame 51 jumps back in time in this case. Am I doing something wrong? Is there a better way to create a video of a simulation?

I have not see the issue happen in the GUI. I run the simulation as fast as possible.

Best regards Jakob Taankvist




Attachment: img0000047-2019-06-20 09:51:48.424926.jpg
Description: JPEG image

Attachment: img0000048-2019-06-20 09:51:48.569763.jpg
Description: JPEG image

Attachment: img0000049-2019-06-20 09:51:48.679283.jpg
Description: JPEG image

Attachment: img0000050-2019-06-20 09:51:48.812173.jpg
Description: JPEG image

Attachment: img0000051-2019-06-20 09:51:48.938523.jpg
Description: JPEG image

Attachment: img0000052-2019-06-20 09:51:49.051749.jpg
Description: JPEG image

Attachment: img0000053-2019-06-20 09:51:49.150861.jpg
Description: JPEG image

Attachment: img0000054-2019-06-20 09:51:49.259249.jpg
Description: JPEG image


Back to the top