From 2dab82d422cce9f4a46fed72a0574854774546a1 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Thu, 21 Mar 2024 18:36:12 +0000 Subject: [PATCH 1/2] publish step size in world stats Signed-off-by: Ian Chen --- src/SimulationRunner.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/SimulationRunner.cc b/src/SimulationRunner.cc index 4ee08be76a..568775316c 100644 --- a/src/SimulationRunner.cc +++ b/src/SimulationRunner.cc @@ -463,6 +463,15 @@ void SimulationRunner::PublishStats() msg.set_paused(this->currentInfo.paused); + msg.mutable_step_size(); + if (!this->currentInfo.paused) + { + auto stepSizeSecNsec = + math::durationToSecNsec(this->stepSize); + msg.mutable_step_size()->set_sec(stepSizeSecNsec.first); + msg.mutable_step_size()->set_nsec(stepSizeSecNsec.second); + } + if (this->Stepping()) { // (deprecated) Remove this header in Gazebo H From 497d8e1253208c87213d01823d1c2764fa134c1b Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Thu, 21 Mar 2024 18:53:56 +0000 Subject: [PATCH 2/2] use dt Signed-off-by: Ian Chen --- src/SimulationRunner.cc | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/SimulationRunner.cc b/src/SimulationRunner.cc index 568775316c..a5ba51e96c 100644 --- a/src/SimulationRunner.cc +++ b/src/SimulationRunner.cc @@ -463,14 +463,7 @@ void SimulationRunner::PublishStats() msg.set_paused(this->currentInfo.paused); - msg.mutable_step_size(); - if (!this->currentInfo.paused) - { - auto stepSizeSecNsec = - math::durationToSecNsec(this->stepSize); - msg.mutable_step_size()->set_sec(stepSizeSecNsec.first); - msg.mutable_step_size()->set_nsec(stepSizeSecNsec.second); - } + msgs::Set(msg.mutable_step_size(), this->currentInfo.dt); if (this->Stepping()) {