Skip to content

Commit

Permalink
feat(pose_instability_detector): componentize PoseInstabilityDetector (
Browse files Browse the repository at this point in the history
…#7114)

* remove unusing main func file

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

* mod to componentize and use glog

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

* change log output from log to both

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

---------

Signed-off-by: a-maumau <[email protected]>
  • Loading branch information
a-maumau authored May 24, 2024
1 parent fe30833 commit 98cc9f2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 33 deletions.
15 changes: 10 additions & 5 deletions localization/pose_instability_detector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,26 @@ project(pose_instability_detector)
find_package(autoware_cmake REQUIRED)
autoware_package()

ament_auto_add_executable(pose_instability_detector
src/main.cpp
ament_auto_add_library(${PROJECT_NAME} SHARED
src/pose_instability_detector.cpp
)

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

if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)
ament_auto_add_gtest(test_pose_instability_detector
ament_auto_add_gtest(test_${PROJECT_NAME}
test/test.cpp
src/pose_instability_detector.cpp
)
endif()

ament_auto_package(
INSTALL_TO_SHARE
launch
config
launch
config
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<arg name="input_odometry" default="~/input/odometry"/>
<arg name="input_twist" default="~/input/twist"/>

<node pkg="pose_instability_detector" exec="pose_instability_detector" name="$(var node_name)" output="log">
<node pkg="pose_instability_detector" exec="pose_instability_detector_node" name="$(var node_name)" output="both">
<remap from="~/input/odometry" to="$(var input_odometry)"/>
<remap from="~/input/twist" to="$(var input_twist)"/>
<param from="$(var param_file)"/>
Expand Down
1 change: 1 addition & 0 deletions localization/pose_instability_detector/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<depend>geometry_msgs</depend>
<depend>nav_msgs</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
<depend>tf2</depend>
<depend>tf2_geometry_msgs</depend>
<depend>tier4_autoware_utils</depend>
Expand Down
26 changes: 0 additions & 26 deletions localization/pose_instability_detector/src/main.cpp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <string>

PoseInstabilityDetector::PoseInstabilityDetector(const rclcpp::NodeOptions & options)
: Node("pose_instability_detector", options),
: rclcpp::Node("pose_instability_detector", options),
threshold_diff_position_x_(this->declare_parameter<double>("threshold_diff_position_x")),
threshold_diff_position_y_(this->declare_parameter<double>("threshold_diff_position_y")),
threshold_diff_position_z_(this->declare_parameter<double>("threshold_diff_position_z")),
Expand Down Expand Up @@ -174,3 +174,6 @@ void PoseInstabilityDetector::callback_timer()
prev_odometry_ = latest_odometry_;
twist_buffer_.clear();
}

#include <rclcpp_components/register_node_macro.hpp>
RCLCPP_COMPONENTS_REGISTER_NODE(PoseInstabilityDetector)

0 comments on commit 98cc9f2

Please sign in to comment.