Simulation freeze when sensor enters objects area

Typically: "How do I... ", "How can I... " questions
Post Reply
pps
Posts: 4
Joined: 13 Feb 2019, 16:03

Simulation freeze when sensor enters objects area

Post by pps » 08 Apr 2019, 08:52

Hello, I have remote controlled car in scene like this https://imgur.com/a/EDWYBIn, and i have a little problem.

In first simulation run, everytime when proximity sensor enters tree object area (like on mentioned picture), simulation freezes for a short period of time. Time period depends on size of tree model. This is happeneging in first lap (scene is racing circuit) only. When car is on 2nd lap and sensors enters tree area, there is no freeze at all. Even if i stop simulation and run it again, freeze occures only on that tree model, which wasnt "loaded by sensors" before.

Isn't it bit strange? Is there a way how to fix it?

Thanks.

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

Re: Simulation freeze when sensor enters objects area

Post by coppelia » 09 Apr 2019, 08:06

Hello,

this is because V-REP will compute calculation structures on-the-fly, when needed. Those calculation structures are needed in order to make fast collision, distance or proximity sensor calculations.
So as long as the proximity sensor's bounding box doesn't overlap with the shape's bounding box, nothing will happen. But the first time it overlaps, the calculation structure is computed for the shape (this takes some time). That calculation structure is quite large, and not saved in a scene save operation (but you can modify that behaviour via the environment dialog). Another option to avoid those temporary freezes, would be to force calculation of those structures at the very beginning of a simulation, e.g. by moving and checking a proximity sensor over a shape.

Cheers

pps
Posts: 4
Joined: 13 Feb 2019, 16:03

Re: Simulation freeze when sensor enters objects area

Post by pps » 10 Apr 2019, 08:54

Hey,

thanks for reply. Changing environment setting solved my problem.

Post Reply