diff --git a/localization/landmark_based_localizer/ar_tag_based_localizer/package.xml b/localization/landmark_based_localizer/ar_tag_based_localizer/package.xml
index 24b737c309016..7e83220dadf2a 100644
--- a/localization/landmark_based_localizer/ar_tag_based_localizer/package.xml
+++ b/localization/landmark_based_localizer/ar_tag_based_localizer/package.xml
@@ -13,6 +13,7 @@
ament_cmake
autoware_cmake
+ ament_index_cpp
aruco
cv_bridge
diagnostic_msgs
diff --git a/localization/landmark_based_localizer/ar_tag_based_localizer/test/test.cpp b/localization/landmark_based_localizer/ar_tag_based_localizer/test/test.cpp
index 6b302ee6bc862..1b44327fd9e8b 100644
--- a/localization/landmark_based_localizer/ar_tag_based_localizer/test/test.cpp
+++ b/localization/landmark_based_localizer/ar_tag_based_localizer/test/test.cpp
@@ -14,6 +14,7 @@
#include "../src/ar_tag_based_localizer.hpp"
+#include
#include
#include
@@ -29,8 +30,8 @@ class TestArTagBasedLocalizer : public ::testing::Test
void SetUp() override
{
const std::string yaml_path =
- "../../install/ar_tag_based_localizer/share/ar_tag_based_localizer/config/"
- "ar_tag_based_localizer.param.yaml";
+ ament_index_cpp::get_package_share_directory("ar_tag_based_localizer") +
+ "/config/ar_tag_based_localizer.param.yaml";
rcl_params_t * params_st = rcl_yaml_node_struct_init(rcl_get_default_allocator());
if (!rcl_parse_yaml_file(yaml_path.c_str(), params_st)) {
diff --git a/localization/pose_instability_detector/package.xml b/localization/pose_instability_detector/package.xml
index 9f38cf6e00262..7774407a7990d 100644
--- a/localization/pose_instability_detector/package.xml
+++ b/localization/pose_instability_detector/package.xml
@@ -16,6 +16,7 @@
ament_cmake_auto
autoware_cmake
+ ament_index_cpp
diagnostic_msgs
geometry_msgs
nav_msgs
diff --git a/localization/pose_instability_detector/test/test.cpp b/localization/pose_instability_detector/test/test.cpp
index 4747582cdd163..5ea03859d7731 100644
--- a/localization/pose_instability_detector/test/test.cpp
+++ b/localization/pose_instability_detector/test/test.cpp
@@ -15,6 +15,7 @@
#include "../src/pose_instability_detector.hpp"
#include "test_message_helper_node.hpp"
+#include
#include
#include
@@ -35,8 +36,8 @@ class TestPoseInstabilityDetector : public ::testing::Test
void SetUp() override
{
const std::string yaml_path =
- "../../install/pose_instability_detector/share/pose_instability_detector/config/"
- "pose_instability_detector.param.yaml";
+ ament_index_cpp::get_package_share_directory("pose_instability_detector") +
+ "/config/pose_instability_detector.param.yaml";
rcl_params_t * params_st = rcl_yaml_node_struct_init(rcl_get_default_allocator());
if (!rcl_parse_yaml_file(yaml_path.c_str(), params_st)) {