Skip to content

Commit

Permalink
use more exact sleep function
Browse files Browse the repository at this point in the history
  • Loading branch information
DocGarbanzo committed Oct 3, 2024
1 parent 3a37f71 commit 1d12e0b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions donkeycar/parts/imu.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ def shutdown(self):
ax = plt.axes(xlim=(-5, 5), ylim=(-5, 5))
line, = ax.plot([], [], lw=2)
print('Go!')
tic = time.time()
start = time.time()
tic = start
while True:
try:
euler, matrix, accel = p.run()
Expand Down Expand Up @@ -280,7 +281,8 @@ def shutdown(self):
p.shutdown()
stdout.write("\n")
break
print(f'Effective sampling time: {(time.time() - tic) * 1000/count:.2f} ms')
print(f'Effective sampling time: {(time.time() - start) * 1000/count:.2f} '
f'ms')
sys.exit(0)

iter = 0
Expand Down

0 comments on commit 1d12e0b

Please sign in to comment.