mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-10 18:08:30 -04:00
autotest: fixed sleep_overhead calculation in sim_multicopter.py
This commit is contained in:
parent
8d992ae615
commit
960574cccf
@ -176,10 +176,11 @@ while True:
|
|||||||
frame_count += 1
|
frame_count += 1
|
||||||
t = time.time()
|
t = time.time()
|
||||||
if t - lastt > 1.0:
|
if t - lastt > 1.0:
|
||||||
#print("%.2f fps zspeed=%.2f zaccel=%.2f h=%.1f a=%.1f yaw=%.1f yawrate=%.1f" % (
|
# print("%.2f fps sleepOverhead=%f zspeed=%.2f zaccel=%.2f h=%.1f a=%.1f yaw=%.1f" % (
|
||||||
# frame_count/(t-lastt),
|
# frame_count/(t-lastt),
|
||||||
# a.velocity.z, a.accel.z, a.position.z, a.altitude,
|
# sleep_overhead,
|
||||||
# a.yaw, a.yaw_rate))
|
# a.velocity.z, a.accelerometer.z, a.position.z, a.altitude,
|
||||||
|
# a.yaw))
|
||||||
lastt = t
|
lastt = t
|
||||||
frame_count = 0
|
frame_count = 0
|
||||||
frame_end = time.time()
|
frame_end = time.time()
|
||||||
@ -188,4 +189,4 @@ while True:
|
|||||||
dt -= sleep_overhead
|
dt -= sleep_overhead
|
||||||
if dt > 0:
|
if dt > 0:
|
||||||
time.sleep(dt)
|
time.sleep(dt)
|
||||||
sleep_overhead = 0.99*sleep_overhead + 0.01*(time.time() - frame_end)
|
sleep_overhead = 0.99*sleep_overhead + 0.01*(time.time() - frame_end - dt)
|
||||||
|
Loading…
Reference in New Issue
Block a user