Skip to content

timestamp doesn't consider pause time #4350

Closed
@rhalaly

Description

@rhalaly

Bug report

  • AirSim Version/#commit: 8057725
  • UE/Unity version: 4.27
  • autopilot version:
  • OS Version: Windows 11

What's the issue you encountered?

It seems that #4305 didn't fully solve the issue (@zimmy87 can you assist please?). Trying this piece of code:

import airsim

import time

client = airsim.CarClient()
client.confirmConnection()
client.enableApiControl(True)

prev = client.getCarState().timestamp

client.simPause(True)  # Pause the simulation
while True:
    curr = client.getCarState().timestamp
    delta = curr - prev
    prev = curr
    print(delta * 1e-9)

    time.sleep(2.0)  # Sleep for 2 seconds - should be ignored by the simulator
    client.simContinueForTime(1.0)  # Continue the simulation for 1 second
    while not client.simIsPause():
        time.sleep(0.1)

This code sleeps 2 seconds while the simulation is paused and continues the simulation for 1 second. So the expected output should be 1 second since the simulation was played for 1 second every time.

But got the output

Connected!
Client Ver:1 (Min Req: 1), Server Ver:1 (Min Req: 1)

0.0
5.6500268
3.0188154000000003
3.0312138
3.0336949
3.0241089000000003
3.0263058000000003
3.0252388000000003
3.0206698000000003
3.0262011
3.020782
3.0155367
3.0184487
...

If I ignore the first value, I don't fully understand why I get 5.65 (and other high numbers) in the first reading. But after that, I get 3 seconds constantly instead of 1 second as expected.

Settings

{
  "SeeDocsAt": "https://github.com/Microsoft/AirSim/blob/master/docs/settings.md",
  "SettingsVersion": 1.2,
  "SimMode": "Car"
}

How can the issue be reproduced?

  1. Build AirSim with commit 8057725
  2. Run the above code

Include full error message in text form

No error, just unexpected result

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions