leap-hand / LEAP_Hand_Sim

http://leaphand.com/
MIT License
108 stars 18 forks source link

unable to run the pretrained policy on leap hand #18

Closed zahid990170 closed 6 months ago

zahid990170 commented 6 months ago

I followed the instructions in readMe. The pretrained policy works fine in simulation using the command below:

python3 train.py wandb_activate=false num_envs=1 headless=false test=true task=LeapHandRot checkpoint=runs/pretrained/nn/LeapHand.pth

For running on the real Leap Hand, I am using Leap Hand ROS API. . I am able to send pose commands on topics

- /leaphand_node/cmd_leap
- /leaphand_node/cmd_ones

I am also able to query the position using the service

/leap_position

However, I could not successfully execute the following command:

python3 deploy.py wandb_activate=false num_envs=1 headless=false test=true task=LeapHandRot checkpoint=runs/pretrained/nn/LeapHand.pth

The fingers move a bit, but then received the following error:

image

The above error occurs on the terminal where I issued the deploy.py command. And specifically, it fails to retrieve the leap_position, and says index out of range.

Please, any information about how to fix this error to be able to run the pretrained policy on the actual leap hand.

thanks,

Lucky7Chess commented 6 months ago

This error is pretty prescriptive. Try killing all background processes and Dynamixel wizard. Also make sure you have permissions on that serial port.

zahid990170 commented 6 months ago

thanks @Lucky7Chess for response.

ls -l /dev/ttyUSB0 crw-rw---- 1 root dialout 188, 0 May 24 15:44 /dev/ttyUSB0

checking my groups

groups
zahid dialout sudo docker

id
uid=1003(zahid) gid=1004(zahid) groups=1004(zahid),20(dialout),27(sudo),1005(docker)

That means that I have permissions on the port.

This time, (at least, once) the deploy script was continuously running (i.e., without terminating in an error), but from the debug statement, it appeared that values were not updating. For example the print outs from the following call did not change obses, _ = leap.poll_joint_position()

Also, the fingers moved relatively more, but then stayed in the same position. Sometimes, I received this error.

rospy.service.ServiceException: service [/leap_position] responded with an error: b'error processing request: device reports readiness to read but returned no data (device disconnected or multiple access on port?)' Is there some values that are in violation of limits?

Which other background processes that can be killed.

Lucky7Chess commented 6 months ago

Are you sure each motor has a unique ID? You may want to check motors one by one to make sure there isn't one defective one. I don't really have any other ideas here.

zahid990170 commented 6 months ago

thanks @Lucky7Chess for a quick response.

I tried to use the Dynamixel Wizard. I will attach some images that you can see, if after the scan the output seems ok.

dynamixel0 dynamixel1 dynamixel2

it appears that it can list the 16 motors. Should I still check 'manually' on the dynamixel wizard by dragging.

On dynamixel wizard, as we can see, by default "current-based" control is selected. Keeping it that way and by manually rotating the wheel, I could check that all the motors/joints were working except

'9'
'10'
'0'

meaning, I did not see a response on the leap hand when changing it.

Any pointers for moving forward.

Lucky7Chess commented 6 months ago

You have some ES error. I think this is usually caused by a power supply that is not clean. Try another 5v supply?

zahid990170 commented 6 months ago

ok, Motors 9 and 10 have an OL (overload error), what can be work around / solution for that.

Lucky7Chess commented 6 months ago

Reboot the motors to get rid of the OL error. These are more low level Dynamixel issues that you can also find help more generically.

zahid990170 commented 6 months ago

ok, I have some questions:

Rebooting solved the issue with errors. I reboot the hand (power supply switched off and on) and checked via Dynamixel wizard. None of the motors listed any errors ( I did not manually check their movements though).

Having done that, I follow the steps. running example.launch anddeployscript.

This time, the deploy script continues to run, though still the movement of the fingers is not very much, only the thumb shows some slow movements.

I close the two terminals, check the Dynamixel again and motor 0 has ES error.

could this be caused due to this specific error on motor 0

Finally, the readMe says that running example.launch should take the leap hand to a **home** pose. Is the joint configuration of this **home** pose is listed somewhere so I can use it to test.

Lucky7Chess commented 6 months ago

Home pose is what the cad preview on the website looks like. What size your power supply? Make sure all cables are plugged right. Other than that this is a Dynamixel setup issue.

zahid990170 commented 6 months ago

I have an adapter that input is standard power 100-240 VAC, and its output is 5 V.

is this the home pose? Screenshot from 2024-05-24 16-56-55

Is there any guidelines / tutorial for setting up Dynamixel?

thanks,

Lucky7Chess commented 6 months ago

What is the max current for the PSU. If it's not that then you may have a defective Dynamixel motor or something, contact their support.

Lucky7Chess commented 6 months ago

Yes that's the home pose.

zahid990170 commented 6 months ago

What is the max current for the PSU. If it's not that then you may have a defective Dynamixel motor or something, contact their support.

The adapter lists output 5V and 30 A.

Lucky7Chess commented 6 months ago

Is it switched to the right voltage, 120v or 240v? Common issue with this.

zahid990170 commented 6 months ago

I was checking on the Dynamixel wizard, and it is listing current limit 2352 mA. That means for 16 motors it should be

Total Current = 2.352 A×16 = 37.632 A and 30 Amay not be sufficient here.

but probably, that is the maximum and the motors do not draw that much current.

As for your question, I could not see any switch on the adapter that I could use to choose (100 - 240 VAC). It seems that it is just accepting ( in Germany, it is 230 V).

Lucky7Chess commented 6 months ago

Hmm okay, can you contact Dynamixel support? I do not know what your issue is with their motors. Let me know what they say.

Lucky7Chess commented 6 months ago

My guess is you have a bugged motor somewhere

zahid990170 commented 6 months ago

@Lucky7Chess , on further inspection, we found out that several connections were lose (it could be assembly issue). Also, when the main rosscript runs, it is supposed to take the hand to a home position as depicted above ( which I found from the code is all 180 deg joint angles). For some reasons, there was another error which caused one of the joints (motor id 9) to remain around ~250 deg even when home pose was commanded.

would you have any comments on assembly of the parts.

Lucky7Chess commented 6 months ago

You have to assemble the motor with the horn at 180 degrees so it knows what orientation is home. It may have been assembled not with the horn aligned to home into the home pose. Rotate the mount so it goes to home.

zahid990170 commented 6 months ago

another questions: are all the motors the same type. If yes, then, what is the type/model if needed to order separately.

Lucky7Chess commented 6 months ago

Please check the website for further information on this.