Page 1 of 1

Collision detection problems in version 4.2

Posted: 01 Aug 2022, 14:55
by Wang
I read the operation documents of version 4.2 and used sim in vrep Checkcollision function for collision detection. I have a ur manipulator connected with Rg2 gripper through the assemble button, and the system always shows that there has been a collision at the connection between ur manipulator and Rg2. I remotely control vrep through python, hoping that the python end can receive a signal in case of collision, so as to facilitate other operations. Please tell me how to solve the problem that ur always collides with Rg2, and which function is used to return the signal to python when the collision occurs.
Thank you.

Re: Collision detection problems in version 4.2

Posted: 03 Aug 2022, 12:24
by coppelia
Hello,

it really depends how and which collision you are checking. There can of course be a lot of internal collisions occuring. Easiest would be to use the latest CoppeliaSim version.

Then, you can easily check for model self collisions and model-environment collisions via the following add.on: [Menu bar --> Modules --> Collision check]

But in general, if you want to e.g. check the collision state between a model (e.g. a robot) and the environment, then use sim.checkCollision and do something like:

Code: Select all

function sysCall_init()
    robotBase=sim.getObject('.')
    robotCollection=sim.createCollection(0)
    sim.addItemToCollection(robotCollection,sim.handle_tree,robotBase,0)
end

function sysCall_sensing()
    local result=sim.checkCollision(robotCollection,sim.handle_all)
    if result>0 then
        print("Colliding!")
    end
end
Cheers