Skip to content

Commit 9f43545

Browse files
gennartanagennart
andauthored
Fix: reset controller_server loop_rate when missed desired rate #5712 (#5723)
When a single iteration takes longer than the expected period, this impacts the next iterations behavior since they will have less time to perform the control logic, thus increasing the actual controller_frequency. By resetting the loop_rate on sleep() failure, this ensures that each iteration will have a full period to exectue its logic. Signed-off-by: agennart <[email protected]> Co-authored-by: agennart <[email protected]>
1 parent a7a59f8 commit 9f43545

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

nav2_controller/src/controller_server.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ void ControllerServer::computeControl()
517517
get_logger(),
518518
"Control loop missed its desired rate of %.4f Hz. Current loop rate is %.4f Hz.",
519519
controller_frequency_, 1 / cycle_duration.seconds());
520+
loop_rate.reset();
520521
}
521522
}
522523
} catch (nav2_core::InvalidController & e) {

0 commit comments

Comments
 (0)