robotics-toolbox-python icon indicating copy to clipboard operation
robotics-toolbox-python copied to clipboard

Error while using ikine_min()

Open hamyyy opened this issue 2 years ago • 0 comments

Description

Trying to use URDF.UR10.ikine_min() resulted in division by zero error. UR10.reach is zero when it should be arount 1.6

Using DH.UR10.ikine_min() does not produce this error, however, the IK solver hangs and never exits the function. This may be another issue entirely.

Version information

pip3: 20.0.2 roboticstoolbox-python: 1.0.1 (installed via pip3) spatialmath-python: 1.0.0 (automatically installed when rtb was installed)

To Reproduce

Steps to reproduce the behavior:

import roboticstoolbox as rtb
from spatialmath import SE3
from math import pi

robot = rtb.models.URDF.UR10()

startingQ = [-pi / 2, -pi / 2, -pi / 2, -pi / 2, pi / 2, 0] # elbow up position
desiredPose = SE3(0, 0.5, 0.5) * SE3.Ry(pi) # well within reach of robot

solution = robot.ikine_min(desiredPose, q0=startingQ, qlim=True) # error occurs here
print(solution.q)
Traceback (most recent call last):
  File "/home/USERNAME/script.py", line 12, in <module>
    solution = robot.ikine_min(desiredPose, q0=startingQ, qlim=True) # error occurs here
  File "/home/USERNAME/.local/lib/python3.8/site-packages/roboticstoolbox/robot/IK.py", line 752, in ikine_min
    wr = 1 / self.reach
ZeroDivisionError: division by zero

Error points to this line: (from git master) https://github.com/petercorke/robotics-toolbox-python/blob/4b3e82a6522757ffde1f83aef8d05b3ad475e9de/roboticstoolbox/robot/IK.py#L752

Expected behavior

Inverse Kinematics is solved and produces joint angle values

Environment

Python: 3.8.10 Ubuntu: 20.04

hamyyy avatar May 21 '22 06:05 hamyyy