PaulDanielML / MuJoCo_RL_UR5

A MuJoCo/Gym environment for robot control using Reinforcement Learning. The task of agents in this environment is pixel-wise prediction of grasp success chances.
MIT License
413 stars 54 forks source link

Running example.py #9

Open ashwin-97 opened 2 years ago

ashwin-97 commented 2 years ago

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

LiukeyCC commented 2 years ago

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?

peterwarlg commented 2 years ago

@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

LiukeyCC commented 2 years ago

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

PaulDanielML commented 2 years ago

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.

ashwin-97 commented 2 years ago

@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.

peterwarlg commented 2 years ago

@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.

wangzituuu@gmail.com

xiaopoche1221 commented 2 years ago

@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?

papercut-linkin commented 2 years ago

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

ChristosPeridis commented 1 year ago

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

giovannicordova commented 1 year ago

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