Page 1 of 1

Can v-rep handle big amount of objects?

Posted: 31 Jul 2019, 10:08
by Maenre
Hello guys.

I've recently found this software and was wondering about its capabilities.
Can it handle simulation when the number of objects is big but relatively simple and no physics simulation required.
Example being this picture:
https://drive.google.com/file/d/1mkKfnM ... sp=sharing

Re: Can v-rep handle big amount of objects?

Posted: 31 Jul 2019, 10:23
by fferri
Sure.

Physics engines will try to do some simplification by themselves: see 3.2.1. Islands and Disabled Bodies (specific to ODE) and simulation islands (specific to Bullet).

However, you can reduce the computational complexity of the scene by not simulating the dynamics of ALL the objects. Instead, only enable dynamics on objects whenever it makes sense (e.g. when the gripper is grasping the object...?).

Re: Can v-rep handle big amount of objects?

Posted: 01 Aug 2019, 14:44
by fferri
this code comes from a scene handling the creation of lots of dynamic respondable objects:

Code: Select all

function sysCall_actuation()
    -- omissis...

    -- set objects to static `decayTime` seconds after their creation:
    while #objectHandle>0 and (objectTime[1]+ decayTime)<sim.getSimulationTime() do
        sim.resetDynamicObject(objectHandle[1])
        sim.setObjectInt32Parameter(objectHandle[1],sim.shapeintparam_static,1)
        table.insert(staticObjectHandle,objectHandle[1])
        table.remove(objectHandle,1)
        table.remove(objectTime,1)
    end

    -- group every `groupFactor` static shapes to speed-up collision checking:
    while #staticObjectHandle>groupFactor do
        sim.groupShapes({unpack(staticObjectHandle,1,groupFactor)})
        for i=1,groupFactor do table.remove(staticObjectHandle,1) end
    end
    
end
a few optimizations that are done are:
  • make the object static when it has stopped moving / it's not moving
  • group the static objects to speed up collision checking
works well if you can assume/predict when objects are moving and when they are not.

Re: Can v-rep handle big amount of objects?

Posted: 01 Aug 2019, 14:49
by fferri
Maybe in your case you can use robot proximity as a discriminant for when the objects need to be dynamically enabled.

Re: Can v-rep handle big amount of objects?

Posted: 08 Aug 2019, 12:56
by coppelia
You can optimize things at various levels. As previously described, you can do this for the physics aspect of things. But you can also simply switch to a different object representation depending on a distance factor (e.g. distance to a camera, a robot, etc.).
So for instance, if the distance is large, then you can hide the mesh and show a simple cube approximating the mesh. In a similar way, you can disable/enable distance calculation or collision detection (or others) for a given object. This can be done, say, every x seconds, (i.e. checking the distance, and enabling/disabling things)

But in the end, you should not expect to have a very fluid simulation if you have more then 1000-2000 objects in your scene, specially if those objects are complex or computational demanding.

Cheers