From 13f57febb2ceb5f0c3e25af181e40b6dad7a5d6b Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Wed, 16 Sep 2020 22:04:58 -0700 Subject: [PATCH] add more doc, user iterator Signed-off-by: Ian Chen --- gazebo/msgs/performance_metrics.proto | 2 +- gazebo/sensors/SensorManager.cc | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gazebo/msgs/performance_metrics.proto b/gazebo/msgs/performance_metrics.proto index cd0941de88..196d76efb7 100644 --- a/gazebo/msgs/performance_metrics.proto +++ b/gazebo/msgs/performance_metrics.proto @@ -22,7 +22,7 @@ message PerformanceMetrics required double sim_update_rate = 3; /// \brief If the sensor is a camera then this field should be filled - /// with fps in real time. + /// with average fps in real time. optional double fps = 4; } diff --git a/gazebo/sensors/SensorManager.cc b/gazebo/sensors/SensorManager.cc index acc3323bdf..c8853d2f5a 100644 --- a/gazebo/sensors/SensorManager.cc +++ b/gazebo/sensors/SensorManager.cc @@ -66,7 +66,11 @@ struct sensorPerformanceMetricsType /// \brief sensor sim time update rate double sensorSimUpdateRate; - /// \brief Rendering sensor average real time update rate + /// \brief Rendering sensor average real time update rate. The difference + /// between sensorAvgFps and sensorRealUpdateRte is that sensorAvgFps is + /// for rendering sensors only and the rate is averaged over a fixed + /// window size, whereas the sensorSimUpdateRate stores the instantaneous + /// update rate and it is filled by all sensors. double sensorAvgFPS; }; @@ -247,9 +251,9 @@ void PublishPerformanceMetrics() (name, emptySensorPerfomanceMetrics)); if (ret2.second == false) { - sensorPerformanceMetrics[name].sensorSimUpdateRate = + ret2.first->second.sensorSimUpdateRate = 1.0/updateSimRate; - sensorPerformanceMetrics[name].sensorRealUpdateRate = + ret2.first->second.sensorRealUpdateRate = 1.0/updateRealRate; worldLastMeasurementTime[name] = world->RealTime(); @@ -258,12 +262,12 @@ void PublishPerformanceMetrics() std::dynamic_pointer_cast(sensor); if (nullptr != cameraSensor) { - sensorPerformanceMetrics[name].sensorAvgFPS = + ret2.first->second.sensorAvgFPS = cameraSensor->Camera()->AvgFPS(); } else { - sensorPerformanceMetrics[name].sensorAvgFPS = -1; + ret2.first->second.sensorAvgFPS = -1; } } }