From 3399513e5e5b284e0d5e45ea5a51f945fac6cc88 Mon Sep 17 00:00:00 2001 From: CarolinePascal Date: Wed, 24 Dec 2025 08:59:44 +0100 Subject: [PATCH] feat(control loop): adding logs for control loop delays --- src/lerobot/scripts/lerobot_record.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lerobot/scripts/lerobot_record.py b/src/lerobot/scripts/lerobot_record.py index 93795c0b3..1921ca1eb 100644 --- a/src/lerobot/scripts/lerobot_record.py +++ b/src/lerobot/scripts/lerobot_record.py @@ -457,7 +457,14 @@ def record_loop( ) dt_s = time.perf_counter() - start_loop_t - precise_sleep(max(1 / fps - dt_s, 0.0)) + remaining_time = 1 / fps - dt_s + if remaining_time > 0.0: + print(f"Waiting {remaining_time:.2f} seconds to maintain {fps:.2f} Hz control loop frequency.") + precise_sleep(remaining_time) + else: + logging.warning( + f"Inconsistent control loop frequency: {1 / dt_s:.2f} Hz < {fps:.2f} Hz. Try reducing the cameras resolution or FPS." + ) timestamp = time.perf_counter() - start_episode_t