Add setup_motors

This commit is contained in:
Simon Alibert
2025-05-19 12:43:02 +02:00
parent a5eaec857d
commit e9d1b5588c
2 changed files with 12 additions and 0 deletions

View File

@@ -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.")

View File

@@ -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.")