Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No convergence at franka panda #36

Open
PARKBONG opened this issue Feb 27, 2024 · 5 comments
Open

No convergence at franka panda #36

PARKBONG opened this issue Feb 27, 2024 · 5 comments

Comments

@PARKBONG
Copy link

Hi. I tried to test this repo with Franka Panda.

here is my code.
torch_kin_test.py

import os
import torch
import pytorch_kinematics as pk

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

full_urdf = os.path.dirname(os.path.abspath(__file__)) + "/lula/lula_franka_gen.urdf"
with open(full_urdf, 'rb') as urdf_file:
    urdf_data = urdf_file.read()
    chain = pk.build_serial_chain_from_urdf(urdf_data, "panda_hand")

pos = torch.tensor([0.0, 0.0, 0.0], device=device)
rot = torch.tensor([0.0, 0.0, 0.0], device=device)
rob_tf = pk.Transform3d(pos=pos, rot=rot, device=device)

lim = torch.tensor(chain.get_joint_limits(), device=device)
goal_q = lim[0] + (lim[1] - lim[0]) / 2
goal_in_rob_frame_tf = chain.forward_kinematics(goal_q)

ik = pk.PseudoInverseIK(chain, max_iterations=100, num_retries=10,
                        joint_limits=lim.T,
                        early_stopping_any_converged=True,
                        early_stopping_no_improvement="all",
                        debug=False,
                        lr=0.2)

sol = ik.solve(goal_in_rob_frame_tf)
print(sol.converged)

tensor([[False, False, False, False, False, False, False, False, False, False]],
device='cuda:0')

Why does it fail to solve it?
Any advice will be very helpful for me.
Thanks!

@akashsharma02
Copy link

@PARKBONG were you able to resolve this issue? I am facing the same problem

@umicharmlab
Copy link

Have you been able to visualize the iterations? or tested changing any of the parameters? That might help us figure out what's going on.

@zhengkai666666
Copy link

I am facing the same problem

@williamshen-nz
Copy link

I was having this problem with the Franka when I was using a URDF that resulted in 9 actuated joints (7 DOF + gripper). Using a URDF with only 7 actuated joints solved the problem

Here's an example script based on the unit tests: https://gist.github.com/williamshen-nz/abb8bd1aaf91499741aaacb3a87f22dd

URDF I used: https://github.com/NVlabs/curobo/blob/main/src/curobo/content/assets/robot/franka_description/franka_panda.urdf

@LemonPi
Copy link
Member

LemonPi commented Aug 23, 2024

Hi sorry for the long delay. I believe this was an issue where you build a serial chain from a non-linear chain (panda + gripper and hands) and specify the end effector. The problem was the end effector frame would still have its children linking to the non-linear part of the chain later. This would explain why @williamshen-nz using a URDF with only 7 actuated joints worked while the one with 9 didn't. Commit baa6ced should've solved this.

@PARKBONG @akashsharma02 @zhengkai666666 can you try again with 0.7.3? If it persists I can look more into it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants