I've ran into a few situations in RoboDK with a calibrated robot where I can solve forward kinematics, but I can't solve inverse kinematics.
Example joints where this occured:
[-12.330000, -2.750000, -36.190000, 170.420000, 0.030000, 19.520000]
For example these joint values for my calibrated Motoman mh180-120 will work forward and inverse for uncalibrated kinematics.
But if I enable calibrated kinematics forward kinematics works, but inverse fails.
I found the above joint values from a robot operating in the field that came across this error, but I was able to find many more by running the following script.
It randomly sample joint space within the robot's joint limits at whole degree values for simplicity.
I used this code for testing:
Example joints where this occured:
[-12.330000, -2.750000, -36.190000, 170.420000, 0.030000, 19.520000]
For example these joint values for my calibrated Motoman mh180-120 will work forward and inverse for uncalibrated kinematics.
But if I enable calibrated kinematics forward kinematics works, but inverse fails.
I found the above joint values from a robot operating in the field that came across this error, but I was able to find many more by running the following script.
It randomly sample joint space within the robot's joint limits at whole degree values for simplicity.
I used this code for testing:
Code:
import random
limit_upper = [89.0, 75.0, 89.0, 359.0, 129.0, 359.0]
limit_lower = [-89.0, -59.0, -85.0, -359.0, -129.0, -359.0]
step = 1.0
seed = 42
counts = [int((hi - lo) / step) for lo, hi in zip(limit_lower, limit_upper)]
if seed is not None:
random.seed(seed)
tool = rbt.PoseTool()
frame = rbt.PoseFrame()
def random_joints(num_trials, func):
for _ in range(num_trials):
offsets = [random.randrange(c) for c in counts]
jnt = [lo + off * step for lo, off in zip(limit_lower, offsets)]
if func(jnt):
return jnt
return []
def test(jnt):
rbt.setJoints(jnt)
pose = rbt.SolveFK(rbt.Joints(), tool=tool, reference=frame)
newjnts = rbt.SolveIK(pose, rbt.Joints(), tool=tool, reference=frame)
if len(newjnts.tolist()) == 1:
print(jnt)
return False
random_joints(10000, test)