How to check if the configuration cause collision between robot and floor?

Typically: "How do I... ", "How can I... " questions
Post Reply
Hacher
Posts: 16
Joined: 28 Nov 2024, 02:00

How to check if the configuration cause collision between robot and floor?

Post by Hacher »

When I use the function 'sim.checkCollision', it cannot detect the collsion between floor and robot. Even though the configration that input to the function may cause collision with floor obviously. My code is following:

Code: Select all

function sysCall_thread()
robotCollection=sim.createCollection()
sim.addItemToCollection(robotCollection,sim.handle_tree,simBase,0)
end
function configurationValidationCallback(config)
    -- check if a configuration is valid, i.e. doesn't collide
    -- save current config:
    local tmp=getConfig()
    -- apply new config:
    setConfig(config)
    -- does new config collide?
    local res=sim.checkCollision(robotCollection,sim.handle_all)
    -- restore original config:
    setConfig(tmp)
    return res==0
end
coppelia
Site Admin
Posts: 10747
Joined: 14 Dec 2012, 00:25

Re: How to check if the configuration cause collision between robot and floor?

Post by coppelia »

Hello,

make sure that the objects you are testing are collidable.

Cheers
Post Reply