Page 1 of 1

Only the collision-free model is output during simulation

Posted: 02 Jul 2022, 10:08
by qxy1020
Hello, I need to detect the collision between the manipulator and the object. When there is a collision, I need to replan the location of the collision point. Therefore, I use the "simxsetjointposition“ function to update the position of the manipulator, and then use the "simxcheckcollision" function to detect its collision, but the "simxsetjointposition" function seems to update the model in the display simulation environment. Now I want it to do collision detection without updating the display, and the final display is the collision-free model I want. What should I do?
Thanks!

Re: Only the collision-free model is output during simulation

Posted: 04 Jul 2022, 13:03
by coppelia
Hello,

if you need to independently check collision from the actually scene content, best would be to have e.g. 2 equivalent manipulators: one is actually doing the movement, the other one is invisible and used for collision checking in other configurations/situations, etc.

In order to have the invisible manipulator detect collisions with the environment but not the other (visible) robot, use a collection, e.g.:

Code: Select all

    invisibleRobotCollection=sim.createCollection(0)
    sim.addItemToCollection(invisibleRobotCollection,sim.handle_tree,invisibleRobotHandle,0)
    
    environenmentCollection=sim.createCollection(0)
    sim.addItemToCollection(environenmentCollection,sim.handle_all,-1,0)
    sim.addItemToCollection(environenmentCollection,sim.handle_tree,invisibleRobotHandle,1)
    sim.addItemToCollection(environenmentCollection,sim.handle_tree,visibleRobotHandle,1)

    -- Check for collision:
    sim.checkCollision(invisibleRobotCollection,environenmentCollection)
Also, try to use the ZeroMQ remote API, which is much easier and flexible than the legacy remote API.

Cheers