From bf158efa48eadc3ae6b8b6e196494454eda6b7b6 Mon Sep 17 00:00:00 2001 From: tanaka3 Date: Wed, 3 Aug 2022 15:14:01 +0900 Subject: [PATCH 1/4] fix: lanelet empty case --- common/had_map_utils/src/had_map_utils.cpp | 1 + map/lanelet2_extension/lib/utilities.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/common/had_map_utils/src/had_map_utils.cpp b/common/had_map_utils/src/had_map_utils.cpp index db9721504c7e6..638f7b1e4195b 100644 --- a/common/had_map_utils/src/had_map_utils.cpp +++ b/common/had_map_utils/src/had_map_utils.cpp @@ -101,6 +101,7 @@ std::vector resamplePoints( // Calculate accumulated lengths const auto accumulated_lengths = calculateAccumulatedLengths(line_string); + if(accumulated_lengths.empty()) return {}; // Create each segment std::vector resampled_points; diff --git a/map/lanelet2_extension/lib/utilities.cpp b/map/lanelet2_extension/lib/utilities.cpp index 1371190421aa9..b234bdf7d02b1 100644 --- a/map/lanelet2_extension/lib/utilities.cpp +++ b/map/lanelet2_extension/lib/utilities.cpp @@ -148,6 +148,7 @@ std::vector resamplePoints( // Calculate accumulated lengths const auto accumulated_lengths = calculateAccumulatedLengths(line_string); + if(accumulated_lengths.empty()) return {}; // Create each segment std::vector resampled_points; From d58f98e3a6c500305f4aa4fb9feb82d0f8d2b333 Mon Sep 17 00:00:00 2001 From: taikitanaka3 <65527974+taikitanaka3@users.noreply.github.com> Date: Wed, 3 Aug 2022 16:52:22 +0900 Subject: [PATCH 2/4] fix(lanelet2_extension,had_map_utils): fix case point 1 Co-authored-by: Maxime CLEMENT <78338830+maxime-clem@users.noreply.github.com> --- map/lanelet2_extension/lib/utilities.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/map/lanelet2_extension/lib/utilities.cpp b/map/lanelet2_extension/lib/utilities.cpp index b234bdf7d02b1..a1f0bac0631f3 100644 --- a/map/lanelet2_extension/lib/utilities.cpp +++ b/map/lanelet2_extension/lib/utilities.cpp @@ -148,7 +148,7 @@ std::vector resamplePoints( // Calculate accumulated lengths const auto accumulated_lengths = calculateAccumulatedLengths(line_string); - if(accumulated_lengths.empty()) return {}; + if(accumulated_lengths.size() < 2) return {}; // Create each segment std::vector resampled_points; From 2a1625af9e6a0f14cc60d57617885d51816fed93 Mon Sep 17 00:00:00 2001 From: taikitanaka3 <65527974+taikitanaka3@users.noreply.github.com> Date: Wed, 3 Aug 2022 16:52:28 +0900 Subject: [PATCH 3/4] fix(lanelet2_extension,had_map_utils): fix case point 1 Co-authored-by: Maxime CLEMENT <78338830+maxime-clem@users.noreply.github.com> --- common/had_map_utils/src/had_map_utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/had_map_utils/src/had_map_utils.cpp b/common/had_map_utils/src/had_map_utils.cpp index 638f7b1e4195b..a409021243ab9 100644 --- a/common/had_map_utils/src/had_map_utils.cpp +++ b/common/had_map_utils/src/had_map_utils.cpp @@ -101,7 +101,7 @@ std::vector resamplePoints( // Calculate accumulated lengths const auto accumulated_lengths = calculateAccumulatedLengths(line_string); - if(accumulated_lengths.empty()) return {}; + if(accumulated_lengths.size() < 2) return {}; // Create each segment std::vector resampled_points; From db5c20239b13e11f55f82647a188564b306eb322 Mon Sep 17 00:00:00 2001 From: taikitanaka3 Date: Wed, 3 Aug 2022 20:50:07 +0900 Subject: [PATCH 4/4] fix: pre-commit Signed-off-by: taikitanaka3 --- common/had_map_utils/src/had_map_utils.cpp | 2 +- map/lanelet2_extension/lib/utilities.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/had_map_utils/src/had_map_utils.cpp b/common/had_map_utils/src/had_map_utils.cpp index a409021243ab9..81f9517f6a8d2 100644 --- a/common/had_map_utils/src/had_map_utils.cpp +++ b/common/had_map_utils/src/had_map_utils.cpp @@ -101,7 +101,7 @@ std::vector resamplePoints( // Calculate accumulated lengths const auto accumulated_lengths = calculateAccumulatedLengths(line_string); - if(accumulated_lengths.size() < 2) return {}; + if (accumulated_lengths.size() < 2) return {}; // Create each segment std::vector resampled_points; diff --git a/map/lanelet2_extension/lib/utilities.cpp b/map/lanelet2_extension/lib/utilities.cpp index a1f0bac0631f3..4af74f0120a55 100644 --- a/map/lanelet2_extension/lib/utilities.cpp +++ b/map/lanelet2_extension/lib/utilities.cpp @@ -148,7 +148,7 @@ std::vector resamplePoints( // Calculate accumulated lengths const auto accumulated_lengths = calculateAccumulatedLengths(line_string); - if(accumulated_lengths.size() < 2) return {}; + if (accumulated_lengths.size() < 2) return {}; // Create each segment std::vector resampled_points;