Skip to content

Commit

Permalink
refactor(geography_utils): prefix package and namespace with autoware (
Browse files Browse the repository at this point in the history
…#7790)

* refactor(geography_utils): prefix package and namespace with autoware

Signed-off-by: Esteve Fernandez <[email protected]>

* move headers to include/autoware/

Signed-off-by: Esteve Fernandez <[email protected]>

---------

Signed-off-by: Esteve Fernandez <[email protected]>
  • Loading branch information
esteve authored Aug 15, 2024
1 parent 1f32972 commit 59a04e5
Show file tree
Hide file tree
Showing 23 changed files with 79 additions and 75 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### Automatically generated from package.xml ###
common/autoware_ad_api_specs/** [email protected] [email protected]
common/autoware_auto_common/** [email protected] [email protected] [email protected] [email protected]
common/autoware_geography_utils/** [email protected]
common/autoware_grid_map_utils/** [email protected]
common/autoware_motion_utils/** [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]
common/autoware_overlay_rviz_plugin/autoware_mission_details_overlay_rviz_plugin/** [email protected]
Expand All @@ -17,7 +18,6 @@ common/component_interface_tools/** [email protected]
common/component_interface_utils/** [email protected] [email protected]
common/cuda_utils/** [email protected] [email protected]
common/fake_test_node/** [email protected] [email protected] [email protected] [email protected]
common/geography_utils/** [email protected]
common/global_parameter_loader/** [email protected]
common/glog_component/** [email protected]
common/goal_distance_calculator/** [email protected]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.14)
project(geography_utils)
project(autoware_geography_utils)

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

ament_auto_add_library(geography_utils SHARED
ament_auto_add_library(${PROJECT_NAME} SHARED
src/height.cpp
src/projection.cpp
src/lanelet2_projector.cpp
)

target_link_libraries(geography_utils
target_link_libraries(${PROJECT_NAME}
${GeographicLib_LIBRARIES}
)

Expand All @@ -27,10 +27,10 @@ if(BUILD_TESTING)

file(GLOB_RECURSE test_files test/*.cpp)

ament_add_ros_isolated_gtest(test_geography_utils ${test_files})
ament_add_ros_isolated_gtest(test_${PROJECT_NAME} ${test_files})

target_link_libraries(test_geography_utils
geography_utils
target_link_libraries(test_${PROJECT_NAME}
${PROJECT_NAME}
)
endif()

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef GEOGRAPHY_UTILS__HEIGHT_HPP_
#define GEOGRAPHY_UTILS__HEIGHT_HPP_
#ifndef AUTOWARE__GEOGRAPHY_UTILS__HEIGHT_HPP_
#define AUTOWARE__GEOGRAPHY_UTILS__HEIGHT_HPP_

#include <string>

namespace geography_utils
namespace autoware::geography_utils
{

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

} // namespace geography_utils
} // namespace autoware::geography_utils

#endif // GEOGRAPHY_UTILS__HEIGHT_HPP_
#endif // AUTOWARE__GEOGRAPHY_UTILS__HEIGHT_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef GEOGRAPHY_UTILS__LANELET2_PROJECTOR_HPP_
#define GEOGRAPHY_UTILS__LANELET2_PROJECTOR_HPP_
#ifndef AUTOWARE__GEOGRAPHY_UTILS__LANELET2_PROJECTOR_HPP_
#define AUTOWARE__GEOGRAPHY_UTILS__LANELET2_PROJECTOR_HPP_

#include <tier4_map_msgs/msg/map_projector_info.hpp>

#include <lanelet2_io/Projection.h>

#include <memory>

namespace geography_utils
namespace autoware::geography_utils
{
using MapProjectorInfo = tier4_map_msgs::msg::MapProjectorInfo;

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

} // namespace geography_utils
} // namespace autoware::geography_utils

#endif // GEOGRAPHY_UTILS__LANELET2_PROJECTOR_HPP_
#endif // AUTOWARE__GEOGRAPHY_UTILS__LANELET2_PROJECTOR_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef GEOGRAPHY_UTILS__PROJECTION_HPP_
#define GEOGRAPHY_UTILS__PROJECTION_HPP_
#ifndef AUTOWARE__GEOGRAPHY_UTILS__PROJECTION_HPP_
#define AUTOWARE__GEOGRAPHY_UTILS__PROJECTION_HPP_

#include <geographic_msgs/msg/geo_point.hpp>
#include <geometry_msgs/msg/point.hpp>
#include <tier4_map_msgs/msg/map_projector_info.hpp>

namespace geography_utils
namespace autoware::geography_utils
{
using MapProjectorInfo = tier4_map_msgs::msg::MapProjectorInfo;
using GeoPoint = geographic_msgs::msg::GeoPoint;
Expand All @@ -28,6 +28,6 @@ using LocalPoint = geometry_msgs::msg::Point;
LocalPoint project_forward(const GeoPoint & geo_point, const MapProjectorInfo & projector_info);
GeoPoint project_reverse(const LocalPoint & local_point, const MapProjectorInfo & projector_info);

} // namespace geography_utils
} // namespace autoware::geography_utils

#endif // GEOGRAPHY_UTILS__PROJECTION_HPP_
#endif // AUTOWARE__GEOGRAPHY_UTILS__PROJECTION_HPP_
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>geography_utils</name>
<name>autoware_geography_utils</name>
<version>0.1.0</version>
<description>The geography_utils package</description>
<description>The autoware_geography_utils package</description>
<maintainer email="[email protected]">Koji Minoda</maintainer>
<license>Apache License 2.0</license>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
// limitations under the License.

#include <GeographicLib/Geoid.hpp>
#include <geography_utils/height.hpp>
#include <autoware/geography_utils/height.hpp>

#include <map>
#include <stdexcept>
#include <string>
#include <utility>

namespace geography_utils
namespace autoware::geography_utils
{

double convert_wgs84_to_egm2008(const double height, const double latitude, const double longitude)
Expand Down Expand Up @@ -60,4 +60,4 @@ double convert_height(
}
}

} // namespace geography_utils
} // namespace autoware::geography_utils
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
// limitations under the License.

#include <GeographicLib/Geoid.hpp>
#include <autoware/geography_utils/lanelet2_projector.hpp>
#include <autoware_lanelet2_extension/projection/mgrs_projector.hpp>
#include <autoware_lanelet2_extension/projection/transverse_mercator_projector.hpp>
#include <geography_utils/lanelet2_projector.hpp>

#include <lanelet2_projection/UTM.h>

namespace geography_utils
namespace autoware::geography_utils
{

std::unique_ptr<lanelet::Projector> get_lanelet2_projector(const MapProjectorInfo & projector_info)
Expand Down Expand Up @@ -51,4 +51,4 @@ std::unique_ptr<lanelet::Projector> get_lanelet2_projector(const MapProjectorInf
throw std::invalid_argument(error_msg);
}

} // namespace geography_utils
} // namespace autoware::geography_utils
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
// limitations under the License.

#include <GeographicLib/Geoid.hpp>
#include <autoware/geography_utils/lanelet2_projector.hpp>
#include <autoware/geography_utils/projection.hpp>
#include <autoware_lanelet2_extension/projection/mgrs_projector.hpp>
#include <geography_utils/lanelet2_projector.hpp>
#include <geography_utils/projection.hpp>

namespace geography_utils
namespace autoware::geography_utils
{

Eigen::Vector3d to_basic_point_3d_pt(const LocalPoint src)
Expand Down Expand Up @@ -92,4 +92,4 @@ GeoPoint project_reverse(const LocalPoint & local_point, const MapProjectorInfo
return geo_point;
}

} // namespace geography_utils
} // namespace autoware::geography_utils
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "geography_utils/height.hpp"
#include "geography_utils/lanelet2_projector.hpp"
#include "geography_utils/projection.hpp"
#include "autoware/geography_utils/height.hpp"
#include "autoware/geography_utils/lanelet2_projector.hpp"
#include "autoware/geography_utils/projection.hpp"

#include <gtest/gtest.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <geography_utils/height.hpp>
#include <autoware/geography_utils/height.hpp>

#include <gtest/gtest.h>

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

double converted_height =
geography_utils::convert_height(height, latitude, longitude, datum, datum);
autoware::geography_utils::convert_height(height, latitude, longitude, datum, datum);

EXPECT_DOUBLE_EQ(height, converted_height);
}
Expand All @@ -44,7 +44,7 @@ TEST(GeographyUtils, ValidSourceTargetDatum)
const double target_height = -30.18;

double converted_height =
geography_utils::convert_height(height, latitude, longitude, "WGS84", "EGM2008");
autoware::geography_utils::convert_height(height, latitude, longitude, "WGS84", "EGM2008");

EXPECT_NEAR(target_height, converted_height, 0.1);
}
Expand All @@ -57,7 +57,7 @@ TEST(GeographyUtils, InvalidSourceTargetDatum)
const double longitude = 139.0;

EXPECT_THROW(
geography_utils::convert_height(height, latitude, longitude, "INVALID1", "INVALID2"),
autoware::geography_utils::convert_height(height, latitude, longitude, "INVALID1", "INVALID2"),
std::invalid_argument);
}

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

EXPECT_THROW(
geography_utils::convert_height(height, latitude, longitude, "INVALID1", "WGS84"),
autoware::geography_utils::convert_height(height, latitude, longitude, "INVALID1", "WGS84"),
std::invalid_argument);
}

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

EXPECT_THROW(
geography_utils::convert_height(height, latitude, longitude, "WGS84", "INVALID2"),
autoware::geography_utils::convert_height(height, latitude, longitude, "WGS84", "INVALID2"),
std::invalid_argument);
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <geography_utils/projection.hpp>
#include <autoware/geography_utils/projection.hpp>

#include <gtest/gtest.h>

Expand Down Expand Up @@ -41,7 +41,7 @@ TEST(GeographyUtilsProjection, ProjectForwardToMGRS)

// conversion
const geometry_msgs::msg::Point converted_point =
geography_utils::project_forward(geo_point, projector_info);
autoware::geography_utils::project_forward(geo_point, projector_info);

EXPECT_NEAR(converted_point.x, local_point.x, 1.0);
EXPECT_NEAR(converted_point.y, local_point.y, 1.0);
Expand Down Expand Up @@ -70,7 +70,7 @@ TEST(GeographyUtilsProjection, ProjectReverseFromMGRS)

// conversion
const geographic_msgs::msg::GeoPoint converted_point =
geography_utils::project_reverse(local_point, projector_info);
autoware::geography_utils::project_reverse(local_point, projector_info);

EXPECT_NEAR(converted_point.latitude, geo_point.latitude, 0.0001);
EXPECT_NEAR(converted_point.longitude, geo_point.longitude, 0.0001);
Expand All @@ -93,9 +93,9 @@ TEST(GeographyUtilsProjection, ProjectForwardAndReverseMGRS)

// conversion
const geometry_msgs::msg::Point converted_local_point =
geography_utils::project_forward(geo_point, projector_info);
autoware::geography_utils::project_forward(geo_point, projector_info);
const geographic_msgs::msg::GeoPoint converted_geo_point =
geography_utils::project_reverse(converted_local_point, projector_info);
autoware::geography_utils::project_reverse(converted_local_point, projector_info);

EXPECT_NEAR(converted_geo_point.latitude, geo_point.latitude, 0.0001);
EXPECT_NEAR(converted_geo_point.longitude, geo_point.longitude, 0.0001);
Expand Down Expand Up @@ -126,7 +126,7 @@ TEST(GeographyUtilsProjection, ProjectForwardToLocalCartesianUTMOrigin)

// conversion
const geometry_msgs::msg::Point converted_point =
geography_utils::project_forward(geo_point, projector_info);
autoware::geography_utils::project_forward(geo_point, projector_info);

EXPECT_NEAR(converted_point.x, local_point.x, 1.0);
EXPECT_NEAR(converted_point.y, local_point.y, 1.0);
Expand All @@ -151,9 +151,9 @@ TEST(GeographyUtilsProjection, ProjectForwardAndReverseLocalCartesianUTMOrigin)

// conversion
const geometry_msgs::msg::Point converted_local_point =
geography_utils::project_forward(geo_point, projector_info);
autoware::geography_utils::project_forward(geo_point, projector_info);
const geographic_msgs::msg::GeoPoint converted_geo_point =
geography_utils::project_reverse(converted_local_point, projector_info);
autoware::geography_utils::project_reverse(converted_local_point, projector_info);

EXPECT_NEAR(converted_geo_point.latitude, geo_point.latitude, 0.0001);
EXPECT_NEAR(converted_geo_point.longitude, geo_point.longitude, 0.0001);
Expand Down
2 changes: 1 addition & 1 deletion localization/autoware_geo_pose_projector/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
<buildtool_depend>ament_cmake_auto</buildtool_depend>
<buildtool_depend>autoware_cmake</buildtool_depend>

<depend>autoware_geography_utils</depend>
<depend>component_interface_specs</depend>
<depend>component_interface_utils</depend>
<depend>geographic_msgs</depend>
<depend>geography_utils</depend>
<depend>geometry_msgs</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

#include "geo_pose_projector.hpp"

#include <geography_utils/height.hpp>
#include <geography_utils/projection.hpp>
#include <autoware/geography_utils/height.hpp>
#include <autoware/geography_utils/projection.hpp>

#ifdef ROS_DISTRO_GALACTIC
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
Expand Down Expand Up @@ -66,8 +66,8 @@ void GeoPoseProjector::on_geo_pose(const GeoPoseWithCovariance::ConstSharedPtr m
gps_point.longitude = msg->pose.pose.position.longitude;
gps_point.altitude = msg->pose.pose.position.altitude;
geometry_msgs::msg::Point position =
geography_utils::project_forward(gps_point, projector_info_.value());
position.z = geography_utils::convert_height(
autoware::geography_utils::project_forward(gps_point, projector_info_.value());
position.z = autoware::geography_utils::convert_height(
position.z, gps_point.latitude, gps_point.longitude, MapProjectorInfo::Message::WGS84,
projector_info_.value().vertical_datum);

Expand Down
2 changes: 1 addition & 1 deletion map/map_loader/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
<buildtool_depend>ament_cmake_auto</buildtool_depend>
<buildtool_depend>autoware_cmake</buildtool_depend>

<depend>autoware_geography_utils</depend>
<depend>autoware_lanelet2_extension</depend>
<depend>autoware_map_msgs</depend>
<depend>component_interface_specs</depend>
<depend>component_interface_utils</depend>
<depend>fmt</depend>
<depend>geography_utils</depend>
<depend>geometry_msgs</depend>
<depend>libpcl-all-dev</depend>
<depend>pcl_conversions</depend>
Expand Down
Loading

0 comments on commit 59a04e5

Please sign in to comment.