Page 1 of 1
getConfigForTipPose sometimes returns a table of nan's instead of a single nil
Posted: 25 Apr 2019, 14:19
by agsdyson
This is a pretty minor bug as I can work around it, but just thought you may want to know.
If I call sim.getConfigForTipPose(), most of the time if no solution is found it returns nil.
However, sometimes it returns:
{-nan,-nan,-nan,-nan}
I noticed this because I was accidentally setting the joint position to nan and the robot disappeared.
Thanks
Re: getConfigForTipPose sometimes returns a table of nan's instead of a single nil
Posted: 25 Apr 2019, 15:15
by agsdyson
This is my workaround code:
Code: Select all
function checkNil(nanArray)
if nanArray then
for i = 1, #nanArray, 1 do
if nanArray[i] == nil or nanArray[i] ~= nanArray[i] then
return nil
end
end
return nanArray
end
return nil
end
I just wrap every call with this function. I assume it would be faster to do this in c++ rather than lua though.
Re: getConfigForTipPose sometimes returns a table of nan's instead of a single nil
Posted: 29 Apr 2019, 07:24
by coppelia
Thanks for reporting this. Do you have a minimal example that triggers this bug?
Cheers
Re: getConfigForTipPose sometimes returns a table of nan's instead of a single nil
Posted: 29 Apr 2019, 07:42
by agsdyson
Sorry, I don't at the moment. The code is quite complex. I'll see if I can save the robot configuration that causes the bug and write a minimal working example.
I have some deadlines at the moment so it might be a little while before I can provide a minimal example.
Re: getConfigForTipPose sometimes returns a table of nan's instead of a single nil
Posted: 01 May 2019, 08:24
by agsdyson
I have not had time yet to make a minimal example, but I've noticed a case where it commonly happens.
If I create a robot that has only axial joints it seems to happen more frequently.
https://imgur.com/a/eUqgudR
This would make sense as the solver has no degrees of freedom to work with if the target it not in the axis of the robot arm.