grid_map icon indicating copy to clipboard operation
grid_map copied to clipboard

PolygonIterator getting stuck

Open KlausBuchegger opened this issue 7 years ago • 4 comments

Hi, I can't 100% reproduce this bug, but it seems to me that if one (or more?) of the vertices of the polygon used for the PolygonIterator is outside of the map, for some reason my code just hangs.

It does not happen all the time when I have a polygon that's not fully inside the map, but it happens a lot, and if i reexecute some scenario that got stuck it always gets stuck again.

Anyone else ever experienced something like this?

KlausBuchegger avatar Jun 27 '17 08:06 KlausBuchegger

Hi @KlausBuchegger! I'm sorry you're experiencing problems with Grid Map. Can you help me find and solve this bug? It would be really helpful if you could recreate your scenario in a unit test and if necessary randomize the values and repeat the test until the error occurs?

pfankhauser avatar Jul 06 '17 11:07 pfankhauser

Sure, I'll try and do that if I find some time, hopefully early next week.

KlausBuchegger avatar Jul 06 '17 18:07 KlausBuchegger

So, I tried but failed reproducing my scenario where I got stuck (don't have the exact code anymore). However, during my experiments I noticed that the GridMap function getPosition (const Index &index, Position &position) fails for an Index with negative x or y values. For example I have a 5x5m map with resolution 0.1 and Position(0,0) as center. a) Then Index(0,0) ~ Position(2.45,2.45) b) Index(10,1) ~ Position(1.45,2.35) so far so good But: c) Index(-10,1) ~ Position(-1.45,2.45) d) Index(0,-3) ~ Position(2.3342e-312,0) I'm not sure what the expected behavior for a negative index should be, my intuition was it would just correspond to a Position outside of the map? But the y coordinate of c) should definitely be 2.35 to match b) and not 2.45, right?

Anyway this could kind of explain my "getting stuck" behavior, as in those cases the polygon gets really big, and that would take a long time to iterate over every pixel inside.

KlausBuchegger avatar Jul 11 '17 14:07 KlausBuchegger

Any progress on this issue?

KlausBuchegger avatar Sep 09 '17 15:09 KlausBuchegger