Simulation has long time blocking when first time primitive sensor detects an object.

Typically: "How do I... ", "How can I... " questions
Post Reply
potatolige
Posts: 10
Joined: 09 Apr 2018, 10:31

Simulation has long time blocking when first time primitive sensor detects an object.

Post by potatolige »

Hello everyone in the Forum,

I am using Vrep Plugin(C++) to run a simulation. My robot has about 10 ultrasonic sensors, which I use primitive sensor to replace their functionality in the simulation. I found an issue, which really bothers me. I found that, the first time when the primitive sensor detecting any object in a totally new loaded scene will let my simulation block(no response) for about 1 min. After 1 min, my simulation will keep running and everything will be fine. And even if I stop the simulation and restart it again will cause no more delay. I guess there should be some internal issue in the Vrep, when the primitive sensor starts working in a virgin scene. But this kind of "warm up" really cost so much time. Also, I found that the decreasing of sensor faces and subdivisions would not help solve this issue at all.
So, I would like to know, does anyone has a similar problem like me? And if yes, do you have some suggestions?
Thank you in advance!

Fitz

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

Re: Simulation has long time blocking when first time primitive sensor detects an object.

Post by coppelia »

Hello,

this is because the first time a proximity sensor comes close to a shape, the shape initializes a calculation structure that allows to perform fast calculations. This also happens with collision detection or minimum distance calculation. The pause is normally hardly perceptible, but of course if you have very large shapes (i.e. containing several 10th of thousands of vertices or triangles), then this can be longer. You have two options:
  • Reduce the complexity of those shapes. You can simplify a shape with [Menu bar --> Edit --> Decimate selected shape...]
  • save the calculation structure with the scene: this increases quite drastically the file size, but you won't have the initial calculations anymore. You can do this in the environment dialog, item Save operation also saves existing calculation structures.
Cheers

potatolige
Posts: 10
Joined: 09 Apr 2018, 10:31

Re: Simulation has long time blocking when first time primitive sensor detects an object.

Post by potatolige »

Thank you very much, your answer is really what I want,

Best Regards,
Fitz

Post Reply