Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pose_estimator_arbiter): componentize PoseEstimatorArbiter #7183

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions localization/pose_estimator_arbiter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,23 @@ project(pose_estimator_arbiter)
find_package(autoware_cmake REQUIRED)
autoware_package()

find_package(glog REQUIRED)

find_package(PCL REQUIRED COMPONENTS common)
include_directories(SYSTEM ${PCL_INCLUDE_DIRS})

# ==============================
# switch rule library
ament_auto_add_library(switch_rule
SHARED
src/pose_estimator_arbiter/switch_rule/enable_all_rule.cpp
)
target_include_directories(switch_rule PUBLIC src)

# ==============================
# pose estimator arbiter node
ament_auto_add_executable(${PROJECT_NAME}
ament_auto_add_library(${PROJECT_NAME} SHARED
src/pose_estimator_arbiter/pose_estimator_arbiter_core.cpp
src/pose_estimator_arbiter/pose_estimator_arbiter_node.cpp
src/pose_estimator_arbiter/switch_rule/enable_all_rule.cpp
)
target_include_directories(${PROJECT_NAME} PUBLIC src)
target_link_libraries(${PROJECT_NAME} switch_rule glog::glog)

# ==============================
rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "pose_estimator_arbiter::PoseEstimatorArbiter"
EXECUTABLE ${PROJECT_NAME}_node
EXECUTOR MultiThreadedExecutor
)

if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)

Expand All @@ -53,6 +47,7 @@ endif()
add_subdirectory(example_rule)

# ==============================
ament_auto_package(INSTALL_TO_SHARE
ament_auto_package(
INSTALL_TO_SHARE
launch
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ament_auto_add_library(example_rule
src/pose_estimator_arbiter/rule_helper/pose_estimator_area.cpp
)
target_include_directories(example_rule PUBLIC src example_rule/src)
target_link_libraries(example_rule switch_rule)
target_link_libraries(example_rule pose_estimator_arbiter)

# ==============================
# define test definition macro
Expand All @@ -16,7 +16,7 @@ function(add_testcase filepath)
string(REGEX REPLACE ".cpp" "" test_name ${filename})

ament_add_gtest(${test_name} ${filepath})
target_link_libraries("${test_name}" switch_rule example_rule)
target_link_libraries("${test_name}" pose_estimator_arbiter example_rule)
target_include_directories(${test_name} PUBLIC src)
ament_target_dependencies(${test_name} ${${PROJECT_NAME}_FOUND_BUILD_DEPENDS})
endfunction()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<arg name="pose_sources" description=""/>
<arg name="input_pointcloud" description=""/>

<node pkg="pose_estimator_arbiter" exec="pose_estimator_arbiter" name="pose_estimator_arbiter" output="screen">
<node pkg="pose_estimator_arbiter" exec="pose_estimator_arbiter_node" output="both">
<param name="pose_sources" value="$(var pose_sources)"/>

<!-- ndt -->
Expand Down
5 changes: 1 addition & 4 deletions localization/pose_estimator_arbiter/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
<depend>autoware_auto_mapping_msgs</depend>
<depend>diagnostic_msgs</depend>
<depend>geometry_msgs</depend>
<depend>glog</depend>
<depend>lanelet2_extension</depend>
<depend>magic_enum</depend>
<depend>pcl_conversions</depend>
<depend>pcl_ros</depend>
<depend>pluginlib</depend>
<depend>rclcpp_components</depend>
<depend>sensor_msgs</depend>
<depend>std_msgs</depend>
<depend>std_srvs</depend>
Expand All @@ -29,9 +29,6 @@
<depend>visualization_msgs</depend>
<depend>yabloc_particle_filter</depend>

<exec_depend>rclcpp</exec_depend>
<exec_depend>rclcpp_components</exec_depend>

<test_depend>ament_cmake_ros</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_lint_common</test_depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class PoseEstimatorArbiter : public rclcpp::Node
using DiagnosticArray = diagnostic_msgs::msg::DiagnosticArray;

public:
PoseEstimatorArbiter();
explicit PoseEstimatorArbiter(const rclcpp::NodeOptions & options);

private:
// Set of running pose estimators specified by ros param `pose_sources`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ static std::unordered_set<PoseEstimatorType> parse_estimator_name_args(
return running_estimator_list;
}

PoseEstimatorArbiter::PoseEstimatorArbiter()
: Node("pose_estimator_arbiter"),
PoseEstimatorArbiter::PoseEstimatorArbiter(const rclcpp::NodeOptions & options)
: rclcpp::Node("pose_estimator_arbiter", options),
running_estimator_list_(parse_estimator_name_args(
declare_parameter<std::vector<std::string>>("pose_sources"), get_logger())),
logger_configure_(std::make_unique<tier4_autoware_utils::LoggerLevelConfigure>(this))
Expand Down Expand Up @@ -211,3 +211,6 @@ void PoseEstimatorArbiter::on_timer()
}

} // namespace pose_estimator_arbiter

#include <rclcpp_components/register_node_macro.hpp>
RCLCPP_COMPONENTS_REGISTER_NODE(pose_estimator_arbiter::PoseEstimatorArbiter)

This file was deleted.

Loading