Can v-rep handle big amount of objects?

Typically: "How do I... ", "How can I... " questions
Post Reply
Maenre
Posts: 8
Joined: 29 Jul 2019, 11:10

Can v-rep handle big amount of objects?

Post 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

fferri
Posts: 1229
Joined: 09 Sep 2013, 19:28

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

Post 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...?).

fferri
Posts: 1229
Joined: 09 Sep 2013, 19:28

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

Post 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.

fferri
Posts: 1229
Joined: 09 Sep 2013, 19:28

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

Post by fferri »

Maybe in your case you can use robot proximity as a discriminant for when the objects need to be dynamically enabled.

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

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

Post 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

Post Reply