Skip to content

Commit 24c4368

Browse files
committed
refactor(geography_utils): prefix package and namespace with autoware
Signed-off-by: Esteve Fernandez <esteve.fernandez@tier4.jp>
1 parent ce09907 commit 24c4368

File tree

22 files changed

+78
-74
lines changed

22 files changed

+78
-74
lines changed

common/geography_utils/CMakeLists.txt common/autoware_geography_utils/CMakeLists.txt

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.14)
2-
project(geography_utils)
2+
project(autoware_geography_utils)
33

44
find_package(autoware_cmake REQUIRED)
55
autoware_package()
@@ -12,13 +12,13 @@ find_path(GeographicLib_INCLUDE_DIR GeographicLib/Config.h
1212
set(GeographicLib_INCLUDE_DIRS ${GeographicLib_INCLUDE_DIR})
1313
find_library(GeographicLib_LIBRARIES NAMES Geographic)
1414

15-
ament_auto_add_library(geography_utils SHARED
15+
ament_auto_add_library(${PROJECT_NAME} SHARED
1616
src/height.cpp
1717
src/projection.cpp
1818
src/lanelet2_projector.cpp
1919
)
2020

21-
target_link_libraries(geography_utils
21+
target_link_libraries(${PROJECT_NAME}
2222
${GeographicLib_LIBRARIES}
2323
)
2424

@@ -27,10 +27,10 @@ if(BUILD_TESTING)
2727

2828
file(GLOB_RECURSE test_files test/*.cpp)
2929

30-
ament_add_ros_isolated_gtest(test_geography_utils ${test_files})
30+
ament_add_ros_isolated_gtest(test_${PROJECT_NAME} ${test_files})
3131

32-
target_link_libraries(test_geography_utils
33-
geography_utils
32+
target_link_libraries(test_${PROJECT_NAME}
33+
${PROJECT_NAME}
3434
)
3535
endif()
3636

File renamed without changes.

common/geography_utils/include/geography_utils/height.hpp common/autoware_geography_utils/include/autoware_geography_utils/height.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#ifndef GEOGRAPHY_UTILS__HEIGHT_HPP_
16-
#define GEOGRAPHY_UTILS__HEIGHT_HPP_
15+
#ifndef AUTOWARE_GEOGRAPHY_UTILS__HEIGHT_HPP_
16+
#define AUTOWARE_GEOGRAPHY_UTILS__HEIGHT_HPP_
1717

1818
#include <string>
1919

20-
namespace geography_utils
20+
namespace autoware::geography_utils
2121
{
2222

2323
typedef double (*HeightConversionFunction)(
@@ -28,6 +28,6 @@ double convert_height(
2828
const double height, const double latitude, const double longitude,
2929
const std::string & source_vertical_datum, const std::string & target_vertical_datum);
3030

31-
} // namespace geography_utils
31+
} // namespace autoware::geography_utils
3232

33-
#endif // GEOGRAPHY_UTILS__HEIGHT_HPP_
33+
#endif // AUTOWARE_GEOGRAPHY_UTILS__HEIGHT_HPP_

common/geography_utils/include/geography_utils/lanelet2_projector.hpp common/autoware_geography_utils/include/autoware_geography_utils/lanelet2_projector.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#ifndef GEOGRAPHY_UTILS__LANELET2_PROJECTOR_HPP_
16-
#define GEOGRAPHY_UTILS__LANELET2_PROJECTOR_HPP_
15+
#ifndef AUTOWARE_GEOGRAPHY_UTILS__LANELET2_PROJECTOR_HPP_
16+
#define AUTOWARE_GEOGRAPHY_UTILS__LANELET2_PROJECTOR_HPP_
1717

1818
#include <tier4_map_msgs/msg/map_projector_info.hpp>
1919

2020
#include <lanelet2_io/Projection.h>
2121

2222
#include <memory>
2323

24-
namespace geography_utils
24+
namespace autoware::geography_utils
2525
{
2626
using MapProjectorInfo = tier4_map_msgs::msg::MapProjectorInfo;
2727

2828
std::unique_ptr<lanelet::Projector> get_lanelet2_projector(const MapProjectorInfo & projector_info);
2929

30-
} // namespace geography_utils
30+
} // namespace autoware::geography_utils
3131

32-
#endif // GEOGRAPHY_UTILS__LANELET2_PROJECTOR_HPP_
32+
#endif // AUTOWARE_GEOGRAPHY_UTILS__LANELET2_PROJECTOR_HPP_

common/geography_utils/include/geography_utils/projection.hpp common/autoware_geography_utils/include/autoware_geography_utils/projection.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#ifndef GEOGRAPHY_UTILS__PROJECTION_HPP_
16-
#define GEOGRAPHY_UTILS__PROJECTION_HPP_
15+
#ifndef AUTOWARE_GEOGRAPHY_UTILS__PROJECTION_HPP_
16+
#define AUTOWARE_GEOGRAPHY_UTILS__PROJECTION_HPP_
1717

1818
#include <geographic_msgs/msg/geo_point.hpp>
1919
#include <geometry_msgs/msg/point.hpp>
2020
#include <tier4_map_msgs/msg/map_projector_info.hpp>
2121

22-
namespace geography_utils
22+
namespace autoware::geography_utils
2323
{
2424
using MapProjectorInfo = tier4_map_msgs::msg::MapProjectorInfo;
2525
using GeoPoint = geographic_msgs::msg::GeoPoint;
@@ -28,6 +28,6 @@ using LocalPoint = geometry_msgs::msg::Point;
2828
LocalPoint project_forward(const GeoPoint & geo_point, const MapProjectorInfo & projector_info);
2929
GeoPoint project_reverse(const LocalPoint & local_point, const MapProjectorInfo & projector_info);
3030

31-
} // namespace geography_utils
31+
} // namespace autoware::geography_utils
3232

33-
#endif // GEOGRAPHY_UTILS__PROJECTION_HPP_
33+
#endif // AUTOWARE_GEOGRAPHY_UTILS__PROJECTION_HPP_

common/geography_utils/package.xml common/autoware_geography_utils/package.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0"?>
22
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="3">
4-
<name>geography_utils</name>
4+
<name>autoware_geography_utils</name>
55
<version>0.1.0</version>
6-
<description>The geography_utils package</description>
6+
<description>The autoware_geography_utils package</description>
77
<maintainer email="koji.minoda@tier4.jp">Koji Minoda</maintainer>
88
<license>Apache License 2.0</license>
99

common/geography_utils/src/height.cpp common/autoware_geography_utils/src/height.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
// limitations under the License.
1414

1515
#include <GeographicLib/Geoid.hpp>
16-
#include <geography_utils/height.hpp>
16+
#include <autoware_geography_utils/height.hpp>
1717

1818
#include <map>
1919
#include <stdexcept>
2020
#include <string>
2121
#include <utility>
2222

23-
namespace geography_utils
23+
namespace autoware::geography_utils
2424
{
2525

2626
double convert_wgs84_to_egm2008(const double height, const double latitude, const double longitude)
@@ -60,4 +60,4 @@ double convert_height(
6060
}
6161
}
6262

63-
} // namespace geography_utils
63+
} // namespace autoware::geography_utils

common/geography_utils/src/lanelet2_projector.cpp common/autoware_geography_utils/src/lanelet2_projector.cpp

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

1515
#include <GeographicLib/Geoid.hpp>
16+
#include <autoware_geography_utils/lanelet2_projector.hpp>
1617
#include <autoware_lanelet2_extension/projection/mgrs_projector.hpp>
1718
#include <autoware_lanelet2_extension/projection/transverse_mercator_projector.hpp>
18-
#include <geography_utils/lanelet2_projector.hpp>
1919

2020
#include <lanelet2_projection/UTM.h>
2121

22-
namespace geography_utils
22+
namespace autoware::geography_utils
2323
{
2424

2525
std::unique_ptr<lanelet::Projector> get_lanelet2_projector(const MapProjectorInfo & projector_info)
@@ -51,4 +51,4 @@ std::unique_ptr<lanelet::Projector> get_lanelet2_projector(const MapProjectorInf
5151
throw std::invalid_argument(error_msg);
5252
}
5353

54-
} // namespace geography_utils
54+
} // namespace autoware::geography_utils

common/geography_utils/src/projection.cpp common/autoware_geography_utils/src/projection.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
// limitations under the License.
1414

1515
#include <GeographicLib/Geoid.hpp>
16+
#include <autoware_geography_utils/lanelet2_projector.hpp>
17+
#include <autoware_geography_utils/projection.hpp>
1618
#include <autoware_lanelet2_extension/projection/mgrs_projector.hpp>
17-
#include <geography_utils/lanelet2_projector.hpp>
18-
#include <geography_utils/projection.hpp>
1919

20-
namespace geography_utils
20+
namespace autoware::geography_utils
2121
{
2222

2323
Eigen::Vector3d to_basic_point_3d_pt(const LocalPoint src)
@@ -92,4 +92,4 @@ GeoPoint project_reverse(const LocalPoint & local_point, const MapProjectorInfo
9292
return geo_point;
9393
}
9494

95-
} // namespace geography_utils
95+
} // namespace autoware::geography_utils

common/geography_utils/test/test_geography_utils.cpp common/autoware_geography_utils/test/test_geography_utils.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include "geography_utils/height.hpp"
16-
#include "geography_utils/lanelet2_projector.hpp"
17-
#include "geography_utils/projection.hpp"
15+
#include "autoware_geography_utils/height.hpp"
16+
#include "autoware_geography_utils/lanelet2_projector.hpp"
17+
#include "autoware_geography_utils/projection.hpp"
1818

1919
#include <gtest/gtest.h>
2020

common/geography_utils/test/test_height.cpp common/autoware_geography_utils/test/test_height.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include <geography_utils/height.hpp>
15+
#include <autoware_geography_utils/height.hpp>
1616

1717
#include <gtest/gtest.h>
1818

@@ -28,7 +28,7 @@ TEST(GeographyUtils, SameSourceTargetDatum)
2828
const std::string datum = "WGS84";
2929

3030
double converted_height =
31-
geography_utils::convert_height(height, latitude, longitude, datum, datum);
31+
autoware::geography_utils::convert_height(height, latitude, longitude, datum, datum);
3232

3333
EXPECT_DOUBLE_EQ(height, converted_height);
3434
}
@@ -44,7 +44,7 @@ TEST(GeographyUtils, ValidSourceTargetDatum)
4444
const double target_height = -30.18;
4545

4646
double converted_height =
47-
geography_utils::convert_height(height, latitude, longitude, "WGS84", "EGM2008");
47+
autoware::geography_utils::convert_height(height, latitude, longitude, "WGS84", "EGM2008");
4848

4949
EXPECT_NEAR(target_height, converted_height, 0.1);
5050
}
@@ -57,7 +57,7 @@ TEST(GeographyUtils, InvalidSourceTargetDatum)
5757
const double longitude = 139.0;
5858

5959
EXPECT_THROW(
60-
geography_utils::convert_height(height, latitude, longitude, "INVALID1", "INVALID2"),
60+
autoware::geography_utils::convert_height(height, latitude, longitude, "INVALID1", "INVALID2"),
6161
std::invalid_argument);
6262
}
6363

@@ -69,7 +69,7 @@ TEST(GeographyUtils, InvalidSourceDatum)
6969
const double longitude = 139.0;
7070

7171
EXPECT_THROW(
72-
geography_utils::convert_height(height, latitude, longitude, "INVALID1", "WGS84"),
72+
autoware::geography_utils::convert_height(height, latitude, longitude, "INVALID1", "WGS84"),
7373
std::invalid_argument);
7474
}
7575

@@ -81,6 +81,6 @@ TEST(GeographyUtils, InvalidTargetDatum)
8181
const double longitude = 139.0;
8282

8383
EXPECT_THROW(
84-
geography_utils::convert_height(height, latitude, longitude, "WGS84", "INVALID2"),
84+
autoware::geography_utils::convert_height(height, latitude, longitude, "WGS84", "INVALID2"),
8585
std::invalid_argument);
8686
}

common/geography_utils/test/test_projection.cpp common/autoware_geography_utils/test/test_projection.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include <geography_utils/projection.hpp>
15+
#include <autoware_geography_utils/projection.hpp>
1616

1717
#include <gtest/gtest.h>
1818

@@ -41,7 +41,7 @@ TEST(GeographyUtilsProjection, ProjectForwardToMGRS)
4141

4242
// conversion
4343
const geometry_msgs::msg::Point converted_point =
44-
geography_utils::project_forward(geo_point, projector_info);
44+
autoware::geography_utils::project_forward(geo_point, projector_info);
4545

4646
EXPECT_NEAR(converted_point.x, local_point.x, 1.0);
4747
EXPECT_NEAR(converted_point.y, local_point.y, 1.0);
@@ -70,7 +70,7 @@ TEST(GeographyUtilsProjection, ProjectReverseFromMGRS)
7070

7171
// conversion
7272
const geographic_msgs::msg::GeoPoint converted_point =
73-
geography_utils::project_reverse(local_point, projector_info);
73+
autoware::geography_utils::project_reverse(local_point, projector_info);
7474

7575
EXPECT_NEAR(converted_point.latitude, geo_point.latitude, 0.0001);
7676
EXPECT_NEAR(converted_point.longitude, geo_point.longitude, 0.0001);
@@ -93,9 +93,9 @@ TEST(GeographyUtilsProjection, ProjectForwardAndReverseMGRS)
9393

9494
// conversion
9595
const geometry_msgs::msg::Point converted_local_point =
96-
geography_utils::project_forward(geo_point, projector_info);
96+
autoware::geography_utils::project_forward(geo_point, projector_info);
9797
const geographic_msgs::msg::GeoPoint converted_geo_point =
98-
geography_utils::project_reverse(converted_local_point, projector_info);
98+
autoware::geography_utils::project_reverse(converted_local_point, projector_info);
9999

100100
EXPECT_NEAR(converted_geo_point.latitude, geo_point.latitude, 0.0001);
101101
EXPECT_NEAR(converted_geo_point.longitude, geo_point.longitude, 0.0001);
@@ -126,7 +126,7 @@ TEST(GeographyUtilsProjection, ProjectForwardToLocalCartesianUTMOrigin)
126126

127127
// conversion
128128
const geometry_msgs::msg::Point converted_point =
129-
geography_utils::project_forward(geo_point, projector_info);
129+
autoware::geography_utils::project_forward(geo_point, projector_info);
130130

131131
EXPECT_NEAR(converted_point.x, local_point.x, 1.0);
132132
EXPECT_NEAR(converted_point.y, local_point.y, 1.0);
@@ -151,9 +151,9 @@ TEST(GeographyUtilsProjection, ProjectForwardAndReverseLocalCartesianUTMOrigin)
151151

152152
// conversion
153153
const geometry_msgs::msg::Point converted_local_point =
154-
geography_utils::project_forward(geo_point, projector_info);
154+
autoware::geography_utils::project_forward(geo_point, projector_info);
155155
const geographic_msgs::msg::GeoPoint converted_geo_point =
156-
geography_utils::project_reverse(converted_local_point, projector_info);
156+
autoware::geography_utils::project_reverse(converted_local_point, projector_info);
157157

158158
EXPECT_NEAR(converted_geo_point.latitude, geo_point.latitude, 0.0001);
159159
EXPECT_NEAR(converted_geo_point.longitude, geo_point.longitude, 0.0001);

localization/geo_pose_projector/package.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
<buildtool_depend>ament_cmake_auto</buildtool_depend>
1919
<buildtool_depend>autoware_cmake</buildtool_depend>
2020

21+
<depend>autoware_geography_utils</depend>
2122
<depend>component_interface_specs</depend>
2223
<depend>component_interface_utils</depend>
2324
<depend>geographic_msgs</depend>
24-
<depend>geography_utils</depend>
2525
<depend>geometry_msgs</depend>
2626
<depend>rclcpp</depend>
2727
<depend>rclcpp_components</depend>

localization/geo_pose_projector/src/geo_pose_projector.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
#include "geo_pose_projector.hpp"
1616

17-
#include <geography_utils/height.hpp>
18-
#include <geography_utils/projection.hpp>
17+
#include <autoware_geography_utils/height.hpp>
18+
#include <autoware_geography_utils/projection.hpp>
1919

2020
#ifdef ROS_DISTRO_GALACTIC
2121
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
@@ -64,8 +64,8 @@ void GeoPoseProjector::on_geo_pose(const GeoPoseWithCovariance::ConstSharedPtr m
6464
gps_point.longitude = msg->pose.pose.position.longitude;
6565
gps_point.altitude = msg->pose.pose.position.altitude;
6666
geometry_msgs::msg::Point position =
67-
geography_utils::project_forward(gps_point, projector_info_.value());
68-
position.z = geography_utils::convert_height(
67+
autoware::geography_utils::project_forward(gps_point, projector_info_.value());
68+
position.z = autoware::geography_utils::convert_height(
6969
position.z, gps_point.latitude, gps_point.longitude, MapProjectorInfo::Message::WGS84,
7070
projector_info_.value().vertical_datum);
7171

map/map_loader/package.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
<buildtool_depend>ament_cmake_auto</buildtool_depend>
2121
<buildtool_depend>autoware_cmake</buildtool_depend>
2222

23+
<depend>autoware_geography_utils</depend>
2324
<depend>autoware_lanelet2_extension</depend>
2425
<depend>autoware_map_msgs</depend>
2526
<depend>component_interface_specs</depend>
2627
<depend>component_interface_utils</depend>
2728
<depend>fmt</depend>
28-
<depend>geography_utils</depend>
2929
<depend>geometry_msgs</depend>
3030
<depend>libpcl-all-dev</depend>
3131
<depend>pcl_conversions</depend>

map/map_loader/src/lanelet2_map_loader/lanelet2_map_loader_node.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@
3636
#include "lanelet2_local_projector.hpp"
3737

3838
#include <ament_index_cpp/get_package_prefix.hpp>
39+
#include <autoware_geography_utils/lanelet2_projector.hpp>
3940
#include <autoware_lanelet2_extension/io/autoware_osm_parser.hpp>
4041
#include <autoware_lanelet2_extension/projection/mgrs_projector.hpp>
4142
#include <autoware_lanelet2_extension/projection/transverse_mercator_projector.hpp>
4243
#include <autoware_lanelet2_extension/utility/message_conversion.hpp>
4344
#include <autoware_lanelet2_extension/utility/utilities.hpp>
44-
#include <geography_utils/lanelet2_projector.hpp>
4545
#include <rclcpp/rclcpp.hpp>
4646

4747
#include <lanelet2_core/LaneletMap.h>
@@ -104,7 +104,7 @@ lanelet::LaneletMapPtr Lanelet2MapLoaderNode::load_map(
104104
lanelet::ErrorMessages errors{};
105105
if (projector_info.projector_type != tier4_map_msgs::msg::MapProjectorInfo::LOCAL) {
106106
std::unique_ptr<lanelet::Projector> projector =
107-
geography_utils::get_lanelet2_projector(projector_info);
107+
autoware::geography_utils::get_lanelet2_projector(projector_info);
108108
const lanelet::LaneletMapPtr map = lanelet::load(lanelet2_filename, *projector, &errors);
109109
if (errors.empty()) {
110110
return map;

0 commit comments

Comments
 (0)