huggingface / lerobot

🤗 LeRobot: Making AI for Robotics more accessible with end-to-end learning
Apache License 2.0
7.34k stars 677 forks source link

where to set the initial joint (position + angle) information when controlling real aloha robot? #334

Open cong1024 opened 3 months ago

cong1024 commented 3 months ago

System Info

ubuntu 20

Information

Reproduction

Hi Guys, I am using the pr #316 written by Cadene to control the real aloha robot, when running cmd : python control_robot.py teleoperate --robot aloha, I found the follower move fast to HORIZONTAL_POSITION, all arms in HORIZONTAL_POSITION like a line. When I control the follower arm with the master arm, I find that the movement direction of the follower arm is exactly opposite to that of the master arm. I thinke there may be some bug in code, or my own problem. I tried to figure out the following:

  1. where to set the initial pose info of follower and leader in code
  2. how to solve the opposite moving problem, have you guys met the same problem ? Thx

Expected behavior

^^

Cadene commented 3 months ago

@cong1024 I will be quick, but happy to help further.

First, checkout origin/main to get the latest version (we merged the PR). Then, redo the calibration precedure by deleting this file: https://github.com/huggingface/lerobot/blob/main/lerobot/common/robot_devices/robots/koch.py#L305 Click on the image urls during the procedure and carefully match the positions with your arms.

Secondly check that the index of the motor corresponds to what you have with DynamixelWizzard

Without Dynamixel Wizzard, you can try to order each one to move seperately by reading their position and writing a delta position:

goal_position_array, self.leader_arms[name].read("Present_Position")
# update each dim seperately
self.leader_arms[name].write("Goal_Position", goal_position_array)

You can also write one value each time and the name of the motor similarly to:

self.leader_arms[name].write("Goal_Position", GRIPPER_OPEN, "gripper")

You can also access their ID and make sure it goes from 1 to 6: https://github.com/huggingface/lerobot/blob/main/lerobot/common/robot_devices/motors/dynamixel.py#L38-L39

We are working on a precedure to ensure the motor indices are well set.

cong1024 commented 3 months ago

Thanks for help ! @Cadene , yes ,I have seen the main branch has merged the control of koch robot. For controlling aloha robot, I see the pr is still in draft, maybe working on branch user/rcadene/2024_07_11_control_aloha is better to debug? Since the configuration for aloha and koch is different. For the rest suggestion, Yes, I will try to working on ! thx~

Cadene commented 3 months ago

this branch is not stable, I dont recommend using it

Cadene commented 2 months ago

Once this PR merges, Aloha will be natively supported: https://github.com/huggingface/lerobot/pull/316 Sorry for the wait!