Skip to content

Commit

Permalink
Move get_available_arms has_method
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadene committed Oct 10, 2024
1 parent 5e6ba38 commit d297d48
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions lerobot/scripts/control_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,22 @@ def is_headless():
return True


def has_method(_object: object, method_name: str):
return hasattr(_object, method_name) and callable(getattr(_object, method_name))


def get_available_arms(robot):
# TODO(rcadene): moves this function in manipulator class?
available_arms = []
for name in robot.follower_arms:
arm_id = get_arm_id(name, "follower")
available_arms.append(arm_id)
for name in robot.leader_arms:
arm_id = get_arm_id(name, "leader")
available_arms.append(arm_id)
return available_arms


########################################################################################
# Asynchrounous saving of images on disk
########################################################################################
Expand Down Expand Up @@ -365,22 +381,6 @@ def stop_image_writer(image_writer, timeout):
stop_processes(processes_pool, image_queue, timeout=timeout)


def has_method(_object: object, method_name: str):
return hasattr(_object, method_name) and callable(getattr(_object, method_name))


def get_available_arms(robot):
# TODO(rcadene): moves this function in manipulator class?
available_arms = []
for name in robot.follower_arms:
arm_id = get_arm_id(name, "follower")
available_arms.append(arm_id)
for name in robot.leader_arms:
arm_id = get_arm_id(name, "leader")
available_arms.append(arm_id)
return available_arms


########################################################################################
# Control modes
########################################################################################
Expand Down

0 comments on commit d297d48

Please sign in to comment.