Skip to content

Commit eec529f

Browse files
committed
Revert "chore(query): update and add gtest"
This reverts commit 027c4cf.
1 parent 38983f9 commit eec529f

File tree

3 files changed

+12
-53
lines changed

3 files changed

+12
-53
lines changed

map/lanelet2_extension/include/lanelet2_extension/utility/query.hpp

-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "lanelet2_extension/regulatory_elements/autoware_traffic_light.hpp"
2121
#include "lanelet2_extension/regulatory_elements/detection_area.hpp"
2222
#include "lanelet2_extension/regulatory_elements/no_stopping_area.hpp"
23-
#include <tier4_autoware_utils/tier4_autoware_utils.hpp>
2423

2524
#include <geometry_msgs/msg/point.hpp>
2625
#include <geometry_msgs/msg/pose.hpp>
@@ -46,11 +45,6 @@ namespace lanelet
4645
{
4746
namespace utils
4847
{
49-
inline double getAngleDifference(const double angle1, const double angle2)
50-
{
51-
const double diff_angle = std::abs(tier4_autoware_utils::normalizeRadian(angle1 - angle2));
52-
return diff_angle;
53-
}
5448
namespace query
5549
{
5650
/**

map/lanelet2_extension/lib/query.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "lanelet2_extension/utility/utilities.hpp"
2121

2222
#include <Eigen/Eigen>
23-
23+
#include <tier4_autoware_utils/tier4_autoware_utils.hpp>
2424

2525
#include <lanelet2_core/geometry/Lanelet.h>
2626
#include <lanelet2_routing/RoutingGraph.h>
@@ -34,6 +34,17 @@
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
3748

3849
namespace lanelet
3950
{

map/lanelet2_extension/test/src/test_query.cpp

-46
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// limitations under the License.
1414

1515
#include "lanelet2_extension/utility/query.hpp"
16-
#include "tier4_autoware_utils/math/normalization.hpp"
1716

1817
#include <gtest/gtest.h>
1918
#include <math.h>
@@ -25,51 +24,6 @@ using lanelet::Point3d;
2524
using lanelet::Points3d;
2625
using lanelet::utils::getId;
2726

28-
// Copyright 2020 Tier IV, Inc.
29-
//
30-
// Licensed under the Apache License, Version 2.0 (the "License");
31-
// you may not use this file except in compliance with the License.
32-
// You may obtain a copy of the License at
33-
//
34-
// http://www.apache.org/licenses/LICENSE-2.0
35-
//
36-
// Unless required by applicable law or agreed to in writing, software
37-
// distributed under the License is distributed on an "AS IS" BASIS,
38-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39-
// See the License for the specific language governing permissions and
40-
// limitations under the License.
41-
42-
TEST(normalizedAngleDifference, getAngleDifference)
43-
{
44-
using lanelet::utils::getAngleDifference;
45-
46-
constexpr double eps = 0.1;
47-
constexpr double pi = M_PI;
48-
constexpr double pi2 = 2.0*M_PI;
49-
// case normal
50-
{
51-
// abs diff
52-
EXPECT_FLOAT_EQ(getAngleDifference(-pi, 0), pi);
53-
// abs diff
54-
EXPECT_FLOAT_EQ(getAngleDifference(pi, 0), pi);
55-
}
56-
// case inverse angle
57-
{
58-
// return normalized angle diff
59-
EXPECT_FLOAT_EQ(getAngleDifference(-pi - eps, pi), eps);
60-
// return 0 if same direction
61-
EXPECT_FLOAT_EQ(getAngleDifference(-pi, pi), 0);
62-
}
63-
// case more than 2PI angle
64-
{
65-
// return normalized angle diff
66-
EXPECT_FLOAT_EQ(getAngleDifference(-pi2 - eps, pi2), eps);
67-
// return pi if invert direction
68-
EXPECT_FLOAT_EQ(getAngleDifference(-pi2, pi), pi);
69-
}
70-
}
71-
72-
7327
class TestSuite : public ::testing::Test
7428
{
7529
public:

0 commit comments

Comments
 (0)