Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(compare_map_segmentation): change height downsize logic #6429

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 Autoware Foundation

Check notice on line 1 in perception/compare_map_segmentation/src/voxel_grid_map_loader.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Overall Code Complexity

The mean cyclomatic complexity increases from 4.75 to 4.88, threshold = 4. This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -241,8 +241,10 @@
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;
const double sqr_distance = dist_x * dist_x + dist_y * dist_y + dist_z * dist_z;
if (sqr_distance < distance_threshold * distance_threshold * downsize_ratio_z_axis_) {
// check if the point is inside the distance threshold voxel
if (
std::abs(dist_x) < distance_threshold && std::abs(dist_y) < distance_threshold &&

Check warning on line 246 in perception/compare_map_segmentation/src/voxel_grid_map_loader.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Complex Conditional

VoxelGridMapLoader::is_in_voxel has 1 complex conditionals with 2 branches, threshold = 2. A complex conditional is an expression inside a branch (e.g. if, for, while) which consists of multiple, logical operators such as AND/OR. The more logical operators in an expression, the more severe the code smell.
std::abs(dist_z) < distance_threshold * downsize_ratio_z_axis_) {

Check warning on line 247 in perception/compare_map_segmentation/src/voxel_grid_map_loader.cpp

View check run for this annotation

Codecov / codecov/patch

perception/compare_map_segmentation/src/voxel_grid_map_loader.cpp#L246-L247

Added lines #L246 - L247 were not covered by tests
return true;
}
}
Expand Down
Loading