cambel / ur_ikfast

Python IKFast library for Universal Robots
MIT License
85 stars 18 forks source link

No solutions for axis-aligned orientations #4

Closed tlpss closed 2 years ago

tlpss commented 2 years ago

Hi, thanks for your work.

I was trying to use the IKFast IK for the UR3e, but I noticed that for axis-aligned orientations, the solver does not return a joint configuration, although there clearly are joint configurations available.

Have you also encountered this? And have you by any chance found a solution? I've found that adding some noise on the quaternion (which results in non-zero values for all components) seems to overcome this, but that's quite an ugly hack imo.

you can recreate this yourself using following snippet:

if __name__ == "__main__":
    ur3e_arm = ur_kinematics.URKinematics('ur3e')

    """
    IKFast seems to struggle with quaternions along axis?
    also note that the order for the wrapper is w,x,y,z!
    """
    pose_quat =  [-0.2,-0.2,0.2,  0.0,1.0,0.0,0] # top-down EEF
    print("inverse() one from quat", ur3e_arm.inverse(pose_quat, False, q_guess=joint_angles))

    pose_quat[4:] += np.random.randn(3) * 0.01
    print("inverse() one from noisy quat", ur3e_arm.inverse(pose_quat, False, q_guess=joint_angles))
cambel commented 2 years ago

Hi @tlpss,

Some axis-aligned orientations are considered singularities. Though solutions may exist, it is very hard or even impossible to compute the inverse kinematics with analytically methods such as the one used in IKFAST.

Your solution is not at all an ugly hack, it is actually used in practice.

tlpss commented 2 years ago

Thanks for your reply. I suspected it had something to do with wrist-alignment singularities..

Your solution is not at all an ugly hack, it is actually used in practice.

Good to know, thanks!