MuJoCo_RL_UR5 icon indicating copy to clipboard operation
MuJoCo_RL_UR5 copied to clipboard

Running example.py

Open ashwin-97 opened this issue 2 years ago • 11 comments

Hello Running the example code throws out an error saying inverse kinematics is not possible for the coordinates

ashwin-97 avatar Mar 06 '22 23:03 ashwin-97

Hello, I also encountered the same problem when I downloaded this code for the second time, prompting ' x0 is infeasible. Could not find an inverse kinematics solution. ' Did you solve it?

LiukeyCC avatar Mar 22 '22 12:03 LiukeyCC

@ashwin-97 @LiukeyCC just replace the urdf file. what i have done is:

  1. download ur5.urdf.xacro from here,;
  2. run rosrun xacro xacro ur5.urdf.xacro > ur5.urdf in where u download ur5.urdf.xacro to get a urdf file
  3. change the original ur5_gripper.urdf with ur5.urdf
  4. or u can just use the file ur5.txt, and change .txt to .urdf

i thought it will works fine if you try all the steps above, but i have also did some other change since i got some warnings, all the changes are in MujocoController.py:

  1. in line 41, it seems the robot only control 5 DOF, so change self.create_group("Arm", list(range(5))) to self.create_group("Arm", list(range(6)))
  2. in line 47, change self.ee_chain = ... to self.ee_chain = ikpy.chain.Chain.from_urdf_file(path + "/UR5+gripper/ur5.urdf",active_links_mask=[False, True, True, True, True, True, True, False]). (u may got a warnning if u not change, but it works fine though)
  3. in line 509, change joint_angles = joint_angles[1:-2] to joint_angles = joint_angles[1:-1], so u get to control all the 6 joint

Hello Running the example code throws out an error saying inverse kinematics is not possible for the coordinates

peterwarlg avatar Mar 22 '22 14:03 peterwarlg

@peterwarlg dear, peter Thanks a lot, I will try it.

LiukeyCC avatar Mar 22 '22 14:03 LiukeyCC

Hi everyone sorry for the late reply. Unfortunately, I do not have the time to still keep the repo updated, there are quite a few things I would change if I were to do it again. The inverse kinematic solver I used was implemented in another repository, and sometimes failed to calculate joint angles for coordinates that the robot EE should be able to reach. Have you tried changing the target coordinates? I saw that the ikpy repo is also still being updated, it is possible that a breaking change was introduced, which could be a problem since I did not pin the dependency version. In that case downgrading the ikpy version might also help.

PaulDanielML avatar Mar 23 '22 09:03 PaulDanielML

@ashwin-97 @LiukeyCC just replace the urdf file. what i have done is:

1. download `ur5.urdf.xacro`  from [here](https://github.com/ros-industrial/universal_robot/tree/kinetic-devel/ur_description/urdf),;

2. run  `rosrun xacro xacro ur5.urdf.xacro > ur5.urdf` in where u download `ur5.urdf.xacro` to get a urdf file

3. change the original `ur5_gripper.urdf` with `ur5.urdf`

4. or u can just use the file [ur5.txt](https://github.com/PaulDanielML/MuJoCo_RL_UR5/files/8324908/ur5.txt), and change `.txt` to `.urdf`

i thought it will works fine if you try all the steps above, but i have also did some other change since i got some warnings, all the changes are in MujocoController.py:

1. in **line 41**,  it seems the robot only control 5 DOF, so change `self.create_group("Arm", list(range(5)))` to `self.create_group("Arm", list(range(6)))`

2. in **line 47**,  change ` self.ee_chain = ...` to `self.ee_chain = ikpy.chain.Chain.from_urdf_file(path + "/UR5+gripper/ur5.urdf",active_links_mask=[False, True, True, True, True, True, True, False])`. (u may got a warnning if u not change, but it works fine though)

3. in **line 509**, change `joint_angles = joint_angles[1:-2]` to `joint_angles = joint_angles[1:-1]`, so u get to control all the 6 joint

Hello Running the example code throws out an error saying inverse kinematics is not possible for the coordinates

Hello Peter Can I get your email ID, I had some more things to ask.

ashwin-97 avatar Mar 23 '22 23:03 ashwin-97

@ashwin-97 @LiukeyCC just replace the urdf file. what i have done is:

1. download `ur5.urdf.xacro`  from [here](https://github.com/ros-industrial/universal_robot/tree/kinetic-devel/ur_description/urdf),;

2. run  `rosrun xacro xacro ur5.urdf.xacro > ur5.urdf` in where u download `ur5.urdf.xacro` to get a urdf file

3. change the original `ur5_gripper.urdf` with `ur5.urdf`

4. or u can just use the file [ur5.txt](https://github.com/PaulDanielML/MuJoCo_RL_UR5/files/8324908/ur5.txt), and change `.txt` to `.urdf`

i thought it will works fine if you try all the steps above, but i have also did some other change since i got some warnings, all the changes are in MujocoController.py:

1. in **line 41**,  it seems the robot only control 5 DOF, so change `self.create_group("Arm", list(range(5)))` to `self.create_group("Arm", list(range(6)))`

2. in **line 47**,  change ` self.ee_chain = ...` to `self.ee_chain = ikpy.chain.Chain.from_urdf_file(path + "/UR5+gripper/ur5.urdf",active_links_mask=[False, True, True, True, True, True, True, False])`. (u may got a warnning if u not change, but it works fine though)

3. in **line 509**, change `joint_angles = joint_angles[1:-2]` to `joint_angles = joint_angles[1:-1]`, so u get to control all the 6 joint

Hello Running the example code throws out an error saying inverse kinematics is not possible for the coordinates

Hello Peter Can I get your email ID, I had some more things to ask.

[email protected]

peterwarlg avatar Mar 24 '22 14:03 peterwarlg

@ashwin-97 @LiukeyCC just replace the urdf file. what i have done is:

1. download `ur5.urdf.xacro`  from [here](https://github.com/ros-industrial/universal_robot/tree/kinetic-devel/ur_description/urdf),;

2. run  `rosrun xacro xacro ur5.urdf.xacro > ur5.urdf` in where u download `ur5.urdf.xacro` to get a urdf file

3. change the original `ur5_gripper.urdf` with `ur5.urdf`

4. or u can just use the file [ur5.txt](https://github.com/PaulDanielML/MuJoCo_RL_UR5/files/8324908/ur5.txt), and change `.txt` to `.urdf`

i thought it will works fine if you try all the steps above, but i have also did some other change since i got some warnings, all the changes are in MujocoController.py:

1. in **line 41**,  it seems the robot only control 5 DOF, so change `self.create_group("Arm", list(range(5)))` to `self.create_group("Arm", list(range(6)))`

2. in **line 47**,  change ` self.ee_chain = ...` to `self.ee_chain = ikpy.chain.Chain.from_urdf_file(path + "/UR5+gripper/ur5.urdf",active_links_mask=[False, True, True, True, True, True, True, False])`. (u may got a warnning if u not change, but it works fine though)

3. in **line 509**, change `joint_angles = joint_angles[1:-2]` to `joint_angles = joint_angles[1:-1]`, so u get to control all the 6 joint

Hello Running the example code throws out an error saying inverse kinematics is not possible for the coordinates

Hello Peter Can I get your email ID, I had some more things to ask.

Does it work? I modified it according to this. There are still questions, what version of IKPY are you using?

xiaopoche1221 avatar Apr 20 '22 01:04 xiaopoche1221

A downgrade to ikpy==3.1 solved ik problem in my case

papercut-linkin avatar Apr 25 '22 09:04 papercut-linkin

Dear @papercut-linkin which version of numpy did you use because I am receiving the following error when downgrading to ikpy==3.1

module 'numpy' has no attribute 'float'. np.float was a deprecated alias for the builtin float. To avoid this error in existing code, use float by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.float64 here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations Could not find an inverse kinematics solution.

Thank you very much for your valuable help!

Christos Peridis

ChristosPeridis avatar Jun 15 '23 13:06 ChristosPeridis

@ChristosPeridis, I was able to solve this error by using ikpy==3.3 using the most recent version of numpy (1.24.4).

giovannicordova avatar Aug 03 '23 22:08 giovannicordova