Skip to content

Commit

Permalink
feat(yabloc_monitor): componentize yabloc_monitor node (autowarefound…
Browse files Browse the repository at this point in the history
…ation#7509)

* change node to component

Signed-off-by: Kento Yabuuchi <[email protected]>

* fix launch file & cmake

Signed-off-by: Kento Yabuuchi <[email protected]>

---------

Signed-off-by: Kento Yabuuchi <[email protected]>
Signed-off-by: Simon Eisenmann <[email protected]>
  • Loading branch information
KYabuuchi authored and simon-eisenmann-driveblocks committed Jun 26, 2024
1 parent 49e69bd commit 4a7a2a3
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 34 deletions.
10 changes: 7 additions & 3 deletions localization/yabloc/yabloc_monitor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ project(yabloc_monitor)
find_package(autoware_cmake REQUIRED)
autoware_package()

ament_auto_add_executable(yabloc_monitor
src/yabloc_monitor_node.cpp
ament_auto_add_library(${PROJECT_NAME}
src/yabloc_monitor_core.cpp
src/availability_module.cpp
)
ament_target_dependencies(yabloc_monitor)

rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "YabLocMonitor"
EXECUTABLE ${PROJECT_NAME}_node
EXECUTOR SingleThreadedExecutor
)

ament_auto_package(
INSTALL_TO_SHARE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<launch>
<arg name="param_file" default="$(find-pkg-share yabloc_monitor)/config/yabloc_monitor.param.yaml"/>

<node name="yabloc_monitor" pkg="yabloc_monitor" exec="yabloc_monitor" output="screen">
<node pkg="yabloc_monitor" exec="yabloc_monitor_node" output="both">
<param from="$(var param_file)"/>
<remap from="~/input/yabloc_pose" to="/localization/pose_estimator/yabloc/pf/pose"/>
</node>
Expand Down
1 change: 1 addition & 0 deletions localization/yabloc/yabloc_monitor/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<depend>diagnostic_updater</depend>
<depend>geometry_msgs</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>

<test_depend>ament_cmake_gtest</test_depend>
<test_depend>ament_lint_auto</test_depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

#include <memory>

YabLocMonitor::YabLocMonitor() : Node("yabloc_monitor"), updater_(this)
YabLocMonitor::YabLocMonitor(const rclcpp::NodeOptions & options)
: Node("yabloc_monitor", options), updater_(this)
{
updater_.setHardwareID(get_name());
updater_.add("yabloc_status", this, &YabLocMonitor::update_diagnostics);
Expand Down Expand Up @@ -46,3 +47,6 @@ void YabLocMonitor::update_diagnostics(diagnostic_updater::DiagnosticStatusWrapp
stat.summary(diagnostic_msgs::msg::DiagnosticStatus::ERROR, "NG");
}
}

#include <rclcpp_components/register_node_macro.hpp>
RCLCPP_COMPONENTS_REGISTER_NODE(YabLocMonitor)
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
class YabLocMonitor : public rclcpp::Node
{
public:
YabLocMonitor();
explicit YabLocMonitor(const rclcpp::NodeOptions & options = rclcpp::NodeOptions());

private:
void update_diagnostics(diagnostic_updater::DiagnosticStatusWrapper & stat);
Expand Down
28 changes: 0 additions & 28 deletions localization/yabloc/yabloc_monitor/src/yabloc_monitor_node.cpp

This file was deleted.

0 comments on commit 4a7a2a3

Please sign in to comment.