Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes safe_action logic #396

Closed
Closed
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
5 changes: 3 additions & 2 deletions lerobot/common/robot_devices/robots/koch.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,14 +554,15 @@ def send_action(self, action: torch.Tensor, follower_names: list[str] | None = N
safe_diff = torch.minimum(diff, max_relative_target)
safe_diff = torch.maximum(safe_diff, -max_relative_target)
safe_action = current_pos + safe_diff
if not torch.allclose(safe_action, action):
if not torch.allclose(safe_action, this_action):
logging.warning(
"Relative action magnitude had to be clamped to be safe.\n"
f" requested relative action target: {diff}\n"
f" clamped relative action target: {safe_diff}"
)
this_action = safe_action

follower_goal_pos[name] = safe_action.numpy()
follower_goal_pos[name] = this_action.numpy()
from_idx = to_idx

for name in self.follower_arms:
Expand Down
Loading