getConfigForTipPose sometimes returns a table of nan's instead of a single nil

Report crashes, strange behaviour, or apparent bugs
Post Reply
agsdyson
Posts: 30
Joined: 13 Feb 2019, 14:02

getConfigForTipPose sometimes returns a table of nan's instead of a single nil

Post by agsdyson » 25 Apr 2019, 14:19

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

agsdyson
Posts: 30
Joined: 13 Feb 2019, 14:02

Re: getConfigForTipPose sometimes returns a table of nan's instead of a single nil

Post by agsdyson » 25 Apr 2019, 15:15

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.

coppelia
Site Admin
Posts: 7229
Joined: 14 Dec 2012, 00:25

Re: getConfigForTipPose sometimes returns a table of nan's instead of a single nil

Post by coppelia » 29 Apr 2019, 07:24

Thanks for reporting this. Do you have a minimal example that triggers this bug?

Cheers

agsdyson
Posts: 30
Joined: 13 Feb 2019, 14:02

Re: getConfigForTipPose sometimes returns a table of nan's instead of a single nil

Post by agsdyson » 29 Apr 2019, 07:42

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.

agsdyson
Posts: 30
Joined: 13 Feb 2019, 14:02

Re: getConfigForTipPose sometimes returns a table of nan's instead of a single nil

Post by agsdyson » 01 May 2019, 08:24

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.

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

Post Reply