Skip to content

Commit

Permalink
feat(pose_estimator_arbiter): componentize PoseEstimatorArbiter (auto…
Browse files Browse the repository at this point in the history
…warefoundation#7183)

* mod to componentize and use glog

Signed-off-by: a-maumau <[email protected]>

* change log output from screen to both

Signed-off-by: a-maumau <[email protected]>

* style(pre-commit): autofix

* Update localization/pose_estimator_arbiter/CMakeLists.txt

add namespace

Co-authored-by: Kento Yabuuchi <[email protected]>

* remove unusing main func

Signed-off-by: a-maumau <[email protected]>

---------

Signed-off-by: a-maumau <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kento Yabuuchi <[email protected]>
  • Loading branch information
3 people authored and karishma1911 committed Jun 3, 2024
1 parent 74f1310 commit 9ed5d93
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 58 deletions.
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.

0 comments on commit 9ed5d93

Please sign in to comment.