Skip to content

Commit

Permalink
fix(compare_map_segmentation): adjust compare map filter for lv4
Browse files Browse the repository at this point in the history
Signed-off-by: badai-nguyen <[email protected]>
  • Loading branch information
badai-nguyen committed Apr 16, 2024
1 parent 7503f42 commit 0eb6d8d
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions perception/compare_map_segmentation/src/voxel_grid_map_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,6 @@ bool VoxelGridMapLoader::is_close_to_neighbor_voxels(
distance_threshold, map, voxel)) {
return true;
}
if (is_in_voxel(
pcl::PointXYZ(point.x, point.y, point.z - distance_threshold_z), point, distance_threshold,
map, voxel)) {
return true;
}
if (is_in_voxel(
pcl::PointXYZ(point.x, point.y, point.z + distance_threshold_z), point, distance_threshold,
map, voxel)) {
return true;
}
if (is_in_voxel(
pcl::PointXYZ(point.x, point.y + distance_threshold, point.z - distance_threshold_z), point,
distance_threshold, map, voxel)) {
Expand Down Expand Up @@ -235,16 +225,17 @@ bool VoxelGridMapLoader::is_in_voxel(
const pcl::PointXYZ & src_point, const pcl::PointXYZ & target_point,
const double distance_threshold, const PointCloudPtr & map, VoxelGridPointXYZ & voxel) const
{
const double z_distance_threshold = distance_threshold * downsize_ratio_z_axis_;
int voxel_index =
voxel.getCentroidIndexAt(voxel.getGridCoordinates(src_point.x, src_point.y, src_point.z));
if (voxel_index != -1) { // not empty voxel
const double dist_x = map->points.at(voxel_index).x - target_point.x;
const double dist_y = map->points.at(voxel_index).y - target_point.y;
const double dist_z = map->points.at(voxel_index).z - target_point.z - 0.1;
const double dist_z = map->points.at(voxel_index).z - target_point.z - z_distance_threshold;
// check if the point is inside the distance threshold voxel
if (
std::abs(dist_x) < distance_threshold && std::abs(dist_y) < distance_threshold &&
std::abs(dist_z) < distance_threshold * downsize_ratio_z_axis_) {
std::abs(dist_z) < z_distance_threshold) {
return true;
}
}
Expand Down

0 comments on commit 0eb6d8d

Please sign in to comment.