rdiankov / openrave

Open Robotics Automation Virtual Environment: An environment for testing, developing, and deploying robotics motion planning algorithms.
http://www.openrave.org
Other
687 stars 340 forks source link

IKFast solver always returns zero for the 5th joint value of UR5 #1334

Closed ZSorcerer closed 7 months ago

ZSorcerer commented 7 months ago

I'm working on inverse kinematics for a ur5 robot , the openrave version I use is 116fe9af5d5b8fe3196608ec93bc0dcc1a730fa1,its almost the latest version, I successfully installed it on ubuntu20.04, openrave.py --example hanoi works fine.

I have generated an IKFast solver from the URDF file of the UR5 robot. I use the following command to generate ikfast61.cpp to calculate the inverse kinematics. The resulting .cpp solver is then made an executable for the use.

sudo python `openrave-config --python-dir`/openravepy/_openravepy_/ikfast.py --robot=ur5.dae --iktype=transform6d --baselink=0 --eelink=9 --savefile=$(pwd)/ikfast61.cpp
$ cp /usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_/ikfast.h
g++ ikfast61.cpp -o ikfast -llapack -std=c++11

Then, I use the following parameters to calculate the results:

./ikfast 0.04071115 -0.99870914 0.03037599 0.4720009 -0.99874455 -0.04156303 -0.02796067 0.12648243 0.0291871 -0.02919955 -0.99914742 0.43451169

I got 8 ik solutions, the results is:

Found 8 ik solutions: sol0 (free=0):
-2.508271157320705, 2.823952561579294, 1.650155646216849, -1.384749647758506, 0.000000000000000, 0.072538256216913,
sol1 (free=0):
-2.508271157320705, -1.895796373329697, -1.650155646216849, 0.352125272404599, 0.000000000000000, 0.072538256216913,
sol2 (free=0):
-2.508271157320705, -3.013057342110904, 1.224580420825357, 1.736242827733395, 0.000000000000000, -3.069054397372879,
sol3 (free=0):
-2.508271157320705, -1.844751854306388, -1.224580420825357, 3.017098181579593, 0.000000000000000, -3.069054397372879,
sol4 (free=0):
0.204516740215372, -1.267613560688365, 1.189775614077163, 0.255047303418910, 0.000000000000000, -2.937563102740381,
sol5 (free=0):
0.204516740215372, -0.132056655343662, -1.189775614077163, 1.499041626228533, 0.000000000000000, -2.937563102740381,
sol6 (free=0):
0.204516740215372, -1.272551922524854, 1.682834107155325, 2.908519825767067, 0.000000000000000, 0.204029550849433,
sol7 (free=0):
0.204516740215372, 0.320672463021973, -1.682834107155325, -1.602221652648701, 0.000000000000000, 0.204029550849433,

ikfast

It is obvious to see that for each solution, the 5th value is 0, the rest of them is correct.

I have tested many cases, the error is same. I also found a very similar question asked by another people, he has the same problem: https://github.com/ros-planning/moveit/issues/3493

I also tested the openrave 0.53.1 version: 2024b03554c8dd0e82ec1c48ae1eb6ed37d0aa6e , this version gives the correct answer. ikfast_correct

can anyone help me to slove this? I think this is a bug. @rdiankov

ZSorcerer commented 7 months ago

ikfast_correct

maxwelllls commented 7 months ago

image image

I tried two different configurations of the same robot. When solving with the URDF of the posture shown in the above picture, I encountered the same issue where the 5th axis was zero. After referring to the URDF file from elite_robot and modifying the configuration as follows, the CPP file was able to successfully calculate the angles for all six joints.

lQLPJyInuttfxkPNAdvNAlmw05sQiDs9iuMFYmPRiSuBAA_601_475 lQLPJwB5uGF1vcPM8c0HP7AaAB3DjfIC8wViY9x0Q7AA_1855_241