you have several things that are not right with your scene.
The first is that you do not correctly specify collision pairs. They should be, e.g.: entity1A,entity1B,entity2A,entity2B, etc.
Entity1A will be tested against entity1B, and entity2A will be tested against entity2B, etc.
The simplest to check if your robot (in its entirety) is colliding against the environment would be to do something like:
Code: Select all
local robotBase=sim.getObjectHandle('IRB2600'),
robotCollection=sim.createCollection(0)
sim.addItemToCollection(robotCollection,sim.handle_tree,robotBase,0)
environmentCollection=sim.createCollection(0)
sim.addItemToCollection(environmentCollection,sim.handle_all,-1,0)
sim.addItemToCollection(robotCollection,sim.handle_tree,robotBase,1)
...
local collision_pairs = {robotCollection,environmentCollection}
simOMPL.setCollisionPairs(OMPL_task, collision_pairs)
If additionally you need to check if the robot is self-colliding, then you'd need to specify one additional collision pair (i.e. 2 pairs in total):
Code: Select all
local collision_pairs = {robotCollection,environmentCollection,robotCollection,robotCollection}
simOMPL.setCollisionPairs(OMPL_task, collision_pairs)
Note that self-collision check works by checking every
collidable object in
collection robotCollection, against every other collidable object in the same collection. In your current robot model, there are many many objects colliding with each other. To avoid this, first disable the collidable flag for all shapes that are not visible. Then, make sure that consecutive shapes (i.e. adjacent shapes) do not generate a collision by appropriately adjusting their
collection self-collision indicators. To test if your robot self-collides and which shapes are involved in that self-collision, you can simply type: sim.checkCollision(robotCollection,robotCollection): the 3rd return argument indicates the handles of 2 colliding objects.
Cheers