File tree 6 files changed +16
-41
lines changed
localization/ekf_localizer
6 files changed +16
-41
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ include_directories(
13
13
14
14
ament_auto_find_build_dependencies()
15
15
16
- ament_auto_add_library(ekf_localizer_lib SHARED
16
+ ament_auto_add_library(${PROJECT_NAME} SHARED
17
17
src/ekf_localizer.cpp
18
18
src/covariance.cpp
19
19
src/diagnostics.cpp
@@ -24,21 +24,20 @@ ament_auto_add_library(ekf_localizer_lib SHARED
24
24
src/ekf_module.cpp
25
25
)
26
26
27
- target_link_libraries (ekf_localizer_lib Eigen3::Eigen)
28
-
29
- ament_auto_add_executable(ekf_localizer src/ekf_localizer_node.cpp)
30
-
31
- target_compile_options (ekf_localizer PUBLIC -g -Wall -Wextra -Wpedantic -Werror )
27
+ rclcpp_components_register_node( ${PROJECT_NAME}
28
+ PLUGIN "EKFLocalizer"
29
+ EXECUTABLE ${PROJECT_NAME} _node
30
+ EXECUTOR SingleThreadedExecutor
31
+ )
32
32
33
- target_link_libraries (ekf_localizer ekf_localizer_lib)
34
- target_include_directories (ekf_localizer PUBLIC include )
33
+ target_link_libraries (${PROJECT_NAME} Eigen3::Eigen)
35
34
36
35
function (add_testcase filepath )
37
36
get_filename_component (filename ${filepath} NAME )
38
37
string (REGEX REPLACE ".cpp" "" test_name ${filename} )
39
38
40
39
ament_add_gtest(${test_name} ${filepath} )
41
- target_link_libraries ("${test_name} " ekf_localizer_lib )
40
+ target_link_libraries ("${test_name} " ${PROJECT_NAME} )
42
41
ament_target_dependencies(${test_name} ${${PROJECT_NAME} _FOUND_BUILD_DEPENDS})
43
42
endfunction ()
44
43
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ class Simple1DFilter
102
102
class EKFLocalizer : public rclcpp ::Node
103
103
{
104
104
public:
105
- EKFLocalizer (const std::string & node_name, const rclcpp::NodeOptions & options);
105
+ explicit EKFLocalizer (const rclcpp::NodeOptions & options);
106
106
107
107
private:
108
108
const std::shared_ptr<Warning> warning_;
Original file line number Diff line number Diff line change 17
17
<arg name =" output_twist_name" default =" ekf_twist" />
18
18
<arg name =" output_twist_with_covariance_name" default =" ekf_twist_with_covariance" />
19
19
20
- <node pkg =" ekf_localizer" exec =" ekf_localizer " name = " ekf_localizer " output =" screen " >
20
+ <node pkg =" ekf_localizer" exec =" ekf_localizer_node " output =" both " >
21
21
<remap from =" in_pose_with_covariance" to =" $(var input_pose_with_cov_name)" />
22
22
23
23
<remap from =" in_twist_with_covariance" to =" $(var input_twist_with_cov_name)" />
Original file line number Diff line number Diff line change 29
29
<depend >kalman_filter</depend >
30
30
<depend >nav_msgs</depend >
31
31
<depend >rclcpp</depend >
32
+ <depend >rclcpp_components</depend >
32
33
<depend >std_srvs</depend >
33
34
<depend >tf2</depend >
34
35
<depend >tf2_ros</depend >
Original file line number Diff line number Diff line change 40
40
41
41
using std::placeholders::_1;
42
42
43
- EKFLocalizer::EKFLocalizer (const std::string & node_name, const rclcpp::NodeOptions & node_options)
44
- : rclcpp::Node(node_name , node_options),
43
+ EKFLocalizer::EKFLocalizer (const rclcpp::NodeOptions & node_options)
44
+ : rclcpp::Node(" ekf_localizer " , node_options),
45
45
warning_(std::make_shared<Warning>(this )),
46
46
params_(this ),
47
47
ekf_dt_(params_.ekf_dt),
@@ -479,3 +479,6 @@ void EKFLocalizer::serviceTriggerNode(
479
479
res->success = true ;
480
480
return ;
481
481
}
482
+
483
+ #include < rclcpp_components/register_node_macro.hpp>
484
+ RCLCPP_COMPONENTS_REGISTER_NODE (EKFLocalizer)
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments