From 4f21f94ac01f97816b548996fd65f31106c4e024 Mon Sep 17 00:00:00 2001 From: Praveen Kumar Date: Mon, 9 Mar 2020 17:37:14 +0530 Subject: [PATCH] Synchronous mode bug demonstration --- .../carla/trafficmanager/PerformanceDiagnostics.cpp | 6 +++--- PythonAPI/examples/spawn_npc.py | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/LibCarla/source/carla/trafficmanager/PerformanceDiagnostics.cpp b/LibCarla/source/carla/trafficmanager/PerformanceDiagnostics.cpp index 117fdc9c1..a976472f5 100644 --- a/LibCarla/source/carla/trafficmanager/PerformanceDiagnostics.cpp +++ b/LibCarla/source/carla/trafficmanager/PerformanceDiagnostics.cpp @@ -26,9 +26,9 @@ namespace traffic_manager { const chr::duration throughput_count_duration = current_time - throughput_clock; if (throughput_count_duration.count() > 1.0f) { - //std::cout << "Stage: " + stage_name + ", throughput: " << throughput_counter - // << ", avg. cycle duration: " << 1000* inter_update_duration.count() - // << " ms" << std::endl; + std::cout << "Stage: " + stage_name + ", throughput: " << throughput_counter + << ", avg. cycle duration: " << 1000* inter_update_duration.count() + << " ms" << std::endl; throughput_clock = current_time; throughput_counter = 0u; diff --git a/PythonAPI/examples/spawn_npc.py b/PythonAPI/examples/spawn_npc.py index 817212322..fc0fb5920 100755 --- a/PythonAPI/examples/spawn_npc.py +++ b/PythonAPI/examples/spawn_npc.py @@ -236,9 +236,17 @@ def main(): # example of how to use parameters traffic_manager.global_percentage_speed_difference(30.0) + throughput_counter = 0 + begining = time.time() while True: if args.sync and synchronous_master: world.tick() + throughput_counter += 1 + current = time.time() + if ((current - begining) > 1.0): + begining = current + print ('||||||||||| CARLA THROUGHPUT ||||||||||| >>> ' + str(throughput_counter)) + throughput_counter = 0 else: world.wait_for_tick()