Skip to content

Commit

Permalink
nav2_controller: add loop rate log (ros-navigation#4228)
Browse files Browse the repository at this point in the history
* added current loop rate printout

Signed-off-by: ARK3r <kermani.areza@gmail.com>

* remove empty line

Signed-off-by: ARK3r <kermani.areza@gmail.com>

---------

Signed-off-by: ARK3r <kermani.areza@gmail.com>
  • Loading branch information
ARK3r authored and Marc-Morcos committed Jul 4, 2024
1 parent bb4f48f commit f505d30
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nav2_controller/src/controller_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,12 @@ void ControllerServer::computeControl()
break;
}

auto cycle_duration = this->now() - start_time;
if (!loop_rate.sleep()) {
RCLCPP_WARN(
get_logger(), "Control loop missed its desired rate of %.4fHz",
controller_frequency_);
get_logger(),
"Control loop missed its desired rate of %.4f Hz. Current loop rate is %.4f Hz.",
controller_frequency_, 1 / cycle_duration.seconds());
}
}
} catch (nav2_core::InvalidController & e) {
Expand Down

0 comments on commit f505d30

Please sign in to comment.