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(dummy_diag_publisher): componentize node #7190

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
8 changes: 6 additions & 2 deletions system/dummy_diag_publisher/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ project(dummy_diag_publisher)
find_package(autoware_cmake REQUIRED)
autoware_package()

ament_auto_add_executable(${PROJECT_NAME}
src/dummy_diag_publisher_node.cpp
ament_auto_add_library(${PROJECT_NAME} SHARED
src/dummy_diag_publisher_core.cpp
)

rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "DummyDiagPublisher"
EXECUTABLE ${PROJECT_NAME}_node
)

ament_auto_package(INSTALL_TO_SHARE
launch
config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct DiagConfig
class DummyDiagPublisher : public rclcpp::Node
{
public:
DummyDiagPublisher();
explicit DummyDiagPublisher(const rclcpp::NodeOptions & options);

private:
enum Status {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<arg name="update_rate" default="10.0"/>

<group>
<node pkg="dummy_diag_publisher" exec="dummy_diag_publisher" name="dummy_diag_publisher" output="screen">
<node pkg="dummy_diag_publisher" exec="dummy_diag_publisher_node" name="dummy_diag_publisher" output="screen">
<param from="$(var config_file)"/>
<param from="$(var extra_config_file_sensor)"/>
<param name="update_rate" value="$(var update_rate)"/>
Expand Down
17 changes: 11 additions & 6 deletions system/dummy_diag_publisher/src/dummy_diag_publisher_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,14 @@ void DummyDiagPublisher::onTimer()
updater_.force_update();
}

DummyDiagPublisher::DummyDiagPublisher()
: Node(
"dummy_diag_publisher", rclcpp::NodeOptions()
.allow_undeclared_parameters(true)
.automatically_declare_parameters_from_overrides(true)),
updater_(this)
rclcpp::NodeOptions override_options(rclcpp::NodeOptions options)
{
return options.allow_undeclared_parameters(true).automatically_declare_parameters_from_overrides(
true);
}

DummyDiagPublisher::DummyDiagPublisher(const rclcpp::NodeOptions & options)
: Node("dummy_diag_publisher", override_options(options)), updater_(this)

{
// Parameter
Expand All @@ -277,3 +279,6 @@ DummyDiagPublisher::DummyDiagPublisher()
timer_ = rclcpp::create_timer(
this, get_clock(), period_ns, std::bind(&DummyDiagPublisher::onTimer, this));
}

#include <rclcpp_components/register_node_macro.hpp>
RCLCPP_COMPONENTS_REGISTER_NODE(DummyDiagPublisher)
26 changes: 0 additions & 26 deletions system/dummy_diag_publisher/src/dummy_diag_publisher_node.cpp

This file was deleted.

Loading