Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/lerobot/motors/motors_bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import abc
import logging
import time
from collections.abc import Sequence
from contextlib import contextmanager
from dataclasses import dataclass
Expand Down Expand Up @@ -818,13 +819,13 @@ def record_ranges_of_motion(
"""
motor_names = self._get_motors_list(motors)

start_positions = self.sync_read("Present_Position", motor_names, normalize=False)
start_positions = self.sync_read("Present_Position", motor_names, normalize=False, num_retry=5)
mins = start_positions.copy()
maxes = start_positions.copy()

user_pressed_enter = False
while not user_pressed_enter:
positions = self.sync_read("Present_Position", motor_names, normalize=False)
positions = self.sync_read("Present_Position", motor_names, normalize=False, num_retry=5)
mins = {motor: min(positions[motor], min_) for motor, min_ in mins.items()}
maxes = {motor: max(positions[motor], max_) for motor, max_ in maxes.items()}

Expand All @@ -840,6 +841,7 @@ def record_ranges_of_motion(
if display_values and not user_pressed_enter:
# Move cursor up to overwrite the previous output
move_cursor_up(len(motor_names) + 3)
time.sleep(0.02)

same_min_max = [motor for motor in motor_names if mins[motor] == maxes[motor]]
if same_min_max:
Expand Down
Loading