From e9d1b5588ce3d9feaa38b18f28592a7c98048689 Mon Sep 17 00:00:00 2001 From: Simon Alibert Date: Mon, 19 May 2025 12:43:02 +0200 Subject: [PATCH] Add setup_motors --- lerobot/common/robots/hope_jr/hope_jr_arm.py | 6 ++++++ lerobot/common/robots/hope_jr/hope_jr_hand.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/lerobot/common/robots/hope_jr/hope_jr_arm.py b/lerobot/common/robots/hope_jr/hope_jr_arm.py index 799cbc75..d3bef910 100644 --- a/lerobot/common/robots/hope_jr/hope_jr_arm.py +++ b/lerobot/common/robots/hope_jr/hope_jr_arm.py @@ -141,6 +141,12 @@ class HopeJrArm(Robot): self.bus.configure_motors() # TODO + def setup_motors(self) -> None: + for motor in reversed(self.bus.motors): + input(f"Connect the controller board to the '{motor}' motor only and press enter.") + self.bus.setup_motor(motor) + print(f"'{motor}' motor id set to {self.bus.motors[motor].id}") + def get_observation(self) -> dict[str, Any]: if not self.is_connected: raise DeviceNotConnectedError(f"{self} is not connected.") diff --git a/lerobot/common/robots/hope_jr/hope_jr_hand.py b/lerobot/common/robots/hope_jr/hope_jr_hand.py index bdf1e03d..0f358ba3 100644 --- a/lerobot/common/robots/hope_jr/hope_jr_hand.py +++ b/lerobot/common/robots/hope_jr/hope_jr_hand.py @@ -151,6 +151,12 @@ class HopeJrHand(Robot): self.bus.configure_motors() # TODO + def setup_motors(self) -> None: + for motor in self.bus.motors: + input(f"Connect the controller board to the '{motor}' motor only and press enter.") + self.bus.setup_motor(motor) + print(f"'{motor}' motor id set to {self.bus.motors[motor].id}") + def get_observation(self) -> dict[str, Any]: if not self.is_connected: raise DeviceNotConnectedError(f"{self} is not connected.")