in simulation_ws/src/aws_robomaker_simulation_common/nodes/route_manager.py [0:0]
def check_noise(self, x, y, row_id=None):
"""
Check if the point in the world is not a map consistency.
- Low resolution/ noisy sensor data might lead to
noisy patches in the map.
- This function checks if the random valid point is not a noisy
bleap on the map by looking for its neighbor consistency.
Args
----
x (int): in grid coordinates
y (int): in grid coordinates
Returns
-------
bool. False if noise, else True
"""
# to make it depend on resolution
delta_x = max(2, self.meta_data.width // 50)
delta_y = max(2, self.meta_data.height // 50)
l_bound, r_bound = max(
0, x - delta_x), min(self.meta_data.width - 1, x + delta_x)
t_bound, b_bound = max(
0, y - delta_y), min(self.meta_data.height - 1, y + delta_y)
for _x in range(l_bound, r_bound):
for _y in range(t_bound, b_bound):
_row_id = self.ravel_index(_x, _y)
if self.occupancy_data.data[_row_id] != 0:
return False
return True