Skip to content

Commit f505d30

Browse files
ARK3rMarc-Morcos
authored andcommitted
nav2_controller: add loop rate log (ros-navigation#4228)
* added current loop rate printout Signed-off-by: ARK3r <[email protected]> * remove empty line Signed-off-by: ARK3r <[email protected]> --------- Signed-off-by: ARK3r <[email protected]>
1 parent bb4f48f commit f505d30

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

nav2_controller/src/controller_server.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,12 @@ void ControllerServer::computeControl()
491491
break;
492492
}
493493

494+
auto cycle_duration = this->now() - start_time;
494495
if (!loop_rate.sleep()) {
495496
RCLCPP_WARN(
496-
get_logger(), "Control loop missed its desired rate of %.4fHz",
497-
controller_frequency_);
497+
get_logger(),
498+
"Control loop missed its desired rate of %.4f Hz. Current loop rate is %.4f Hz.",
499+
controller_frequency_, 1 / cycle_duration.seconds());
498500
}
499501
}
500502
} catch (nav2_core::InvalidController & e) {

0 commit comments

Comments
 (0)