MCPcopy Create free account
hub / github.com/AdaCompNUS/summit / collision_statistics_loop

Function collision_statistics_loop

PythonAPI/examples/gamma_crowd.py:1358–1374  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

1356
1357
1358def collision_statistics_loop(args):
1359 try:
1360 # Wait for crowd service.
1361 time.sleep(3)
1362 c = Context(args)
1363 print('Collision statistics loop running.')
1364
1365 statistics_file = open('statistics_collision.log', 'w')
1366 sim_start_time = time.time()
1367
1368 while True:
1369 start = time.time()
1370 do_collision_statistics(c, time.time() - sim_start_time, statistics_file)
1371 time.sleep(max(0, 1 / COLLISION_STATISTICS_MAX_RATE - (time.time() - start))) # 40 Hz
1372 # print('({}) Collision statistics rate: {} Hz'.format(os.getpid(), 1 / max(time.time() - start, 0.001)))
1373 except Pyro4.errors.ConnectionClosedError:
1374 pass
1375
1376
1377def main(args):

Callers

nothing calls this directly

Calls 2

ContextClass · 0.85
do_collision_statisticsFunction · 0.85

Tested by

no test coverage detected