Skip to content

Commit 37808bf

Browse files
fix(compare_map_segmentation): throw runtime error when using non-split map pointcloud for DynamicMapLoader (#9024)
* fix(compare_map_segmentation): throw runtime error when using non-split map pointcloud for DynamicMapLoader Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * chore: typo Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * fix: launch Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * Update perception/autoware_compare_map_segmentation/schema/voxel_distance_based_compare_map_filter.schema.json Co-authored-by: Yoshi Ri <yoshiyoshidetteiu@gmail.com> * fix: change to RCLCPP_ERROR Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> --------- Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> Co-authored-by: Yoshi Ri <yoshiyoshidetteiu@gmail.com>
1 parent 2be4572 commit 37808bf

10 files changed

+41
-4
lines changed

perception/autoware_compare_map_segmentation/config/distance_based_compare_map_filter.param.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
map_update_distance_threshold: 10.0
77
map_loader_radius: 150.0
88
publish_debug_pcd: False
9+
max_map_grid_size: 100.0

perception/autoware_compare_map_segmentation/config/voxel_based_approximate_compare_map_filter.param.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
map_update_distance_threshold: 10.0
88
map_loader_radius: 150.0
99
publish_debug_pcd: False
10+
max_map_grid_size: 100.0

perception/autoware_compare_map_segmentation/config/voxel_based_compare_map_filter.param.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
map_update_distance_threshold: 10.0
88
map_loader_radius: 150.0
99
publish_debug_pcd: False
10+
max_map_grid_size: 100.0

perception/autoware_compare_map_segmentation/config/voxel_distance_based_compare_map_filter.param.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
map_update_distance_threshold: 10.0
88
map_loader_radius: 150.0
99
publish_debug_pcd: False
10+
max_map_grid_size: 100.0

perception/autoware_compare_map_segmentation/schema/distance_based_compare_map_filter.schema.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535
"type": "boolean",
3636
"default": "false",
3737
"description": "Publish a downsampled map pointcloud for debugging"
38+
},
39+
"max_map_grid_size": {
40+
"type": "number",
41+
"default": "100.0",
42+
"description": "Threshold of grid size to split map pointcloud"
3843
}
3944
},
4045
"required": [
@@ -43,7 +48,8 @@
4348
"timer_interval_ms",
4449
"map_update_distance_threshold",
4550
"map_loader_radius",
46-
"publish_debug_pcd"
51+
"publish_debug_pcd",
52+
"max_map_grid_size"
4753
],
4854
"additionalProperties": false
4955
}

perception/autoware_compare_map_segmentation/schema/voxel_based_approximate_compare_map_filter.schema.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
"type": "boolean",
4141
"default": "false",
4242
"description": "Publish a downsampled map pointcloud for debugging"
43+
},
44+
"max_map_grid_size": {
45+
"type": "number",
46+
"default": "100.0",
47+
"description": "Threshold of grid size to split map pointcloud"
4348
}
4449
},
4550
"required": [
@@ -49,7 +54,8 @@
4954
"timer_interval_ms",
5055
"map_update_distance_threshold",
5156
"map_loader_radius",
52-
"publish_debug_pcd"
57+
"publish_debug_pcd",
58+
"max_map_grid_size"
5359
],
5460
"additionalProperties": false
5561
}

perception/autoware_compare_map_segmentation/schema/voxel_based_compare_map_filter.schema.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
"type": "boolean",
4141
"default": "false",
4242
"description": "Publish a downsampled map pointcloud for debugging"
43+
},
44+
"max_map_grid_size": {
45+
"type": "number",
46+
"default": "100.0",
47+
"description": "Threshold of grid size to split map pointcloud"
4348
}
4449
},
4550
"required": [
@@ -49,7 +54,8 @@
4954
"timer_interval_ms",
5055
"map_update_distance_threshold",
5156
"map_loader_radius",
52-
"publish_debug_pcd"
57+
"publish_debug_pcd",
58+
"max_map_grid_size"
5359
],
5460
"additionalProperties": false
5561
}

perception/autoware_compare_map_segmentation/schema/voxel_distance_based_compare_map_filter.schema.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
"type": "boolean",
4141
"default": "false",
4242
"description": "Publish a downsampled map pointcloud for debugging"
43+
},
44+
"max_map_grid_size": {
45+
"type": "number",
46+
"default": "100.0",
47+
"description": "Maximum size of the pcd map with dynamic map loading."
4348
}
4449
},
4550
"required": [
@@ -49,7 +54,8 @@
4954
"timer_interval_ms",
5055
"map_update_distance_threshold",
5156
"map_loader_radius",
52-
"publish_debug_pcd"
57+
"publish_debug_pcd",
58+
"max_map_grid_size"
5359
],
5460
"additionalProperties": false
5561
}

perception/autoware_compare_map_segmentation/src/voxel_grid_map_loader/voxel_grid_map_loader.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ VoxelGridDynamicMapLoader::VoxelGridDynamicMapLoader(
293293
auto timer_interval_ms = node->declare_parameter<int>("timer_interval_ms");
294294
map_update_distance_threshold_ = node->declare_parameter<double>("map_update_distance_threshold");
295295
map_loader_radius_ = node->declare_parameter<double>("map_loader_radius");
296+
max_map_grid_size_ = node->declare_parameter<double>("max_map_grid_size");
296297
auto main_sub_opt = rclcpp::SubscriptionOptions();
297298
main_sub_opt.callback_group = main_callback_group;
298299
sub_kinematic_state_ = node->create_subscription<nav_msgs::msg::Odometry>(

perception/autoware_compare_map_segmentation/src/voxel_grid_map_loader/voxel_grid_map_loader.hpp

+8
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ class VoxelGridDynamicMapLoader : public VoxelGridMapLoader
152152
rclcpp::TimerBase::SharedPtr map_update_timer_;
153153
double map_update_distance_threshold_;
154154
double map_loader_radius_;
155+
double max_map_grid_size_;
155156
rclcpp::Client<autoware_map_msgs::srv::GetDifferentialPointCloudMap>::SharedPtr
156157
map_update_client_;
157158
rclcpp::CallbackGroup::SharedPtr client_callback_group_;
@@ -270,6 +271,13 @@ class VoxelGridDynamicMapLoader : public VoxelGridMapLoader
270271
{
271272
map_grid_size_x_ = map_cell_to_add.metadata.max_x - map_cell_to_add.metadata.min_x;
272273
map_grid_size_y_ = map_cell_to_add.metadata.max_y - map_cell_to_add.metadata.min_y;
274+
if (map_grid_size_x_ > max_map_grid_size_ || map_grid_size_y_ > max_map_grid_size_) {
275+
RCLCPP_ERROR(
276+
logger_,
277+
"Map was not split or split map grid size is too large. Split map with grid size smaller "
278+
"than %f",
279+
max_map_grid_size_);
280+
}
273281

274282
origin_x_remainder_ = std::remainder(map_cell_to_add.metadata.min_x, map_grid_size_x_);
275283
origin_y_remainder_ = std::remainder(map_cell_to_add.metadata.min_y, map_grid_size_y_);

0 commit comments

Comments
 (0)