From 9571a713df7810fe8ac17408c76cfc08eae65404 Mon Sep 17 00:00:00 2001 From: Simon Alibert Date: Wed, 4 Jun 2025 14:54:29 +0200 Subject: [PATCH] Refactor record_ranges_of_motion --- lerobot/common/motors/motors_bus.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lerobot/common/motors/motors_bus.py b/lerobot/common/motors/motors_bus.py index 6d841d777..6793600f3 100644 --- a/lerobot/common/motors/motors_bus.py +++ b/lerobot/common/motors/motors_bus.py @@ -746,7 +746,9 @@ class MotorsBus(abc.ABC): start_positions = self.sync_read("Present_Position", motors, normalize=False) mins = start_positions.copy() maxes = start_positions.copy() - while True: + + user_pressed_enter = False + while not user_pressed_enter: positions = self.sync_read("Present_Position", motors, normalize=False) mins = {motor: min(positions[motor], min_) for motor, min_ in mins.items()} maxes = {motor: max(positions[motor], max_) for motor, max_ in maxes.items()} @@ -758,9 +760,9 @@ class MotorsBus(abc.ABC): print(f"{motor:<15} | {mins[motor]:>6} | {positions[motor]:>6} | {maxes[motor]:>6}") if enter_pressed(): - break + user_pressed_enter = True - if display_values: + if display_values and not user_pressed_enter: # Move cursor up to overwrite the previous output move_cursor_up(len(motors) + 3)