Skip to content

Commit 740b467

Browse files
taikitanaka3pre-commit-ci[bot]kenji-miyake
authored andcommitted
fix(lanelet2_extension): fix getAngleDifference (autowarefoundation#264)
* chore(query): update and add gtest Signed-off-by: tanaka3 <ttatcoder@outlook.jp> * ci(pre-commit): autofix * chore(query): add deprecated attribute to getAngleDifference Signed-off-by: tanaka3 <ttatcoder@outlook.jp> * chore(query): deprecated as comment to avoid clang errror Signed-off-by: tanaka3 <ttatcoder@outlook.jp> * Revert "chore(query): deprecated as comment to avoid clang errror" This reverts commit 28cc95d. Signed-off-by: tanaka3 <ttatcoder@outlook.jp> * Revert "chore(query): add deprecated attribute to getAngleDifference" This reverts commit 3b56ce7. Signed-off-by: tanaka3 <ttatcoder@outlook.jp> * Revert "ci(pre-commit): autofix" This reverts commit 61e05c4. Signed-off-by: tanaka3 <ttatcoder@outlook.jp> * Revert "chore(query): update and add gtest" This reverts commit 027c4cf. Signed-off-by: tanaka3 <ttatcoder@outlook.jp> * fix(lanelet2_extension): fix getAngleDifference Signed-off-by: tanaka3 <ttatcoder@outlook.jp> * fix(lanelet2_extension): ref value Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> Signed-off-by: tanaka3 <ttatcoder@outlook.jp> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com>
1 parent bf1f508 commit 740b467

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

map/lanelet2_extension/lib/query.cpp

+1-12
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,6 @@
3434
#include <vector>
3535

3636
using lanelet::utils::to2D;
37-
namespace
38-
{
39-
double getAngleDifference(const double angle1, const double angle2)
40-
{
41-
const double normalized_angle1 = tier4_autoware_utils::normalizeRadian(angle1);
42-
const double normalized_angle2 = tier4_autoware_utils::normalizeRadian(angle2);
43-
const double diff_angle = std::fabs(normalized_angle1 - normalized_angle2);
44-
return diff_angle;
45-
}
46-
47-
} // namespace
4837

4938
namespace lanelet
5039
{
@@ -727,7 +716,7 @@ bool query::getClosestLanelet(
727716
lanelet::ConstLineString3d segment = getClosestSegment(search_point, llt.centerline());
728717
double segment_angle = std::atan2(
729718
segment.back().y() - segment.front().y(), segment.back().x() - segment.front().x());
730-
double angle_diff = getAngleDifference(segment_angle, pose_yaw);
719+
double angle_diff = std::abs(tier4_autoware_utils::normalizeRadian(segment_angle - pose_yaw));
731720
if (angle_diff < min_angle) {
732721
min_angle = angle_diff;
733722
*closest_lanelet_ptr = llt;

0 commit comments

Comments
 (0)