From e445e3ad0d1f0d71b5a45bb9969168e296fe14b1 Mon Sep 17 00:00:00 2001 From: Alejandro Hernandez Cordero Date: Tue, 1 Sep 2026 17:40:00 +0200 Subject: [PATCH 1/2] granular rclcpp/rclcpp.hpp and include what you use Signed-off-by: Alejandro Hernandez Cordero --- test_tf2/test/buffer_core_test.cpp | 3 ++- test_tf2/test/test_buffer_client.cpp | 5 +++- test_tf2/test/test_buffer_server.cpp | 5 +++- test_tf2/test/test_message_filter.cpp | 5 +++- test_tf2/test/test_static_publisher.cpp | 5 +++- test_tf2/test/test_tf2_bullet.cpp | 4 ++- tf2_bullet/test/test_tf2_bullet.cpp | 1 - tf2_kdl/test/test_tf2_kdl.cpp | 2 +- tf2_ros/CMakeLists.txt | 7 +++++ tf2_ros/package.xml | 1 + tf2_ros/src/buffer_server_main.cpp | 6 ++++- tf2_ros/src/create_timer_ros.cpp | 2 +- tf2_ros/src/static_transform_broadcaster.cpp | 1 - .../src/static_transform_broadcaster_node.cpp | 9 ++++++- .../static_transform_broadcaster_program.cpp | 7 ++++- tf2_ros/src/tf2_echo.cpp | 18 ++++++++++++- tf2_ros/src/tf2_monitor.cpp | 18 ++++++++++++- tf2_ros/src/transform_broadcaster.cpp | 1 - tf2_ros/test/listener_unittest.cpp | 14 +++++++--- tf2_ros/test/message_filter_test.cpp | 26 +++++++++++++++---- tf2_ros/test/node_wrapper.hpp | 8 ++++-- tf2_ros/test/test_buffer.cpp | 19 +++++++++++++- tf2_ros/test/test_buffer_client.cpp | 15 ++++++++--- tf2_ros/test/test_buffer_server.cpp | 12 +++++++-- .../test_static_transform_broadcaster.cpp | 8 ++++++ tf2_ros/test/test_transform_broadcaster.cpp | 6 +++++ tf2_ros/test/test_transform_listener.cpp | 5 ++++ tf2_ros/test/time_reset_test.cpp | 9 +++++-- tf2_ros/test/velocity_test.cpp | 4 +++ tf2_sensor_msgs/test/test_tf2_sensor_msgs.cpp | 3 ++- 30 files changed, 194 insertions(+), 35 deletions(-) diff --git a/test_tf2/test/buffer_core_test.cpp b/test_tf2/test/buffer_core_test.cpp index 877e7cd65..ca8aba6b6 100644 --- a/test_tf2/test/buffer_core_test.cpp +++ b/test_tf2/test/buffer_core_test.cpp @@ -43,7 +43,8 @@ #include #include #include -#include +#include +#include #include #include #include diff --git a/test_tf2/test/test_buffer_client.cpp b/test_tf2/test/test_buffer_client.cpp index 171d3b378..399e27769 100644 --- a/test_tf2/test/test_buffer_client.cpp +++ b/test_tf2/test/test_buffer_client.cpp @@ -36,7 +36,10 @@ *********************************************************************/ #include -#include +#include +#include +#include +#include #include #include #include diff --git a/test_tf2/test/test_buffer_server.cpp b/test_tf2/test/test_buffer_server.cpp index deb27a893..80e9d4d68 100644 --- a/test_tf2/test/test_buffer_server.cpp +++ b/test_tf2/test/test_buffer_server.cpp @@ -37,7 +37,10 @@ #include #include #include -#include +#include +#include +#include +#include #include int main(int argc, char ** argv) diff --git a/test_tf2/test/test_message_filter.cpp b/test_tf2/test/test_message_filter.cpp index e9757046b..7adb389f1 100644 --- a/test_tf2/test/test_message_filter.cpp +++ b/test_tf2/test/test_message_filter.cpp @@ -39,7 +39,10 @@ #include #include #include -#include +#include +#include +#include +#include #include #include #include diff --git a/test_tf2/test/test_static_publisher.cpp b/test_tf2/test/test_static_publisher.cpp index 54f3ed8f7..72180d8f8 100644 --- a/test_tf2/test/test_static_publisher.cpp +++ b/test_tf2/test/test_static_publisher.cpp @@ -35,7 +35,10 @@ #include #include -#include +#include +#include +#include +#include #include #include #include diff --git a/test_tf2/test/test_tf2_bullet.cpp b/test_tf2/test/test_tf2_bullet.cpp index c8ff80a01..398881c95 100644 --- a/test_tf2/test/test_tf2_bullet.cpp +++ b/test_tf2/test/test_tf2_bullet.cpp @@ -31,7 +31,9 @@ #include #include -#include +#include +#include +#include #include #include diff --git a/tf2_bullet/test/test_tf2_bullet.cpp b/tf2_bullet/test/test_tf2_bullet.cpp index 09a4f99b8..72831fecc 100644 --- a/tf2_bullet/test/test_tf2_bullet.cpp +++ b/tf2_bullet/test/test_tf2_bullet.cpp @@ -29,7 +29,6 @@ /** \author Wim Meeussen */ #include "tf2_bullet/tf2_bullet.hpp" -#include "rclcpp/rclcpp.hpp" #include "gtest/gtest.h" #include "tf2/convert.hpp" diff --git a/tf2_kdl/test/test_tf2_kdl.cpp b/tf2_kdl/test/test_tf2_kdl.cpp index be0dd4d34..112926c8a 100644 --- a/tf2_kdl/test/test_tf2_kdl.cpp +++ b/tf2_kdl/test/test_tf2_kdl.cpp @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include "tf2_ros/buffer.hpp" #include diff --git a/tf2_ros/CMakeLists.txt b/tf2_ros/CMakeLists.txt index 258c20b21..aaf12da32 100644 --- a/tf2_ros/CMakeLists.txt +++ b/tf2_ros/CMakeLists.txt @@ -16,6 +16,7 @@ find_package(rclcpp REQUIRED) find_package(rclcpp_action REQUIRED) find_package(rclcpp_components REQUIRED) find_package(rcpputils REQUIRED) +find_package(rcutils REQUIRED) find_package(tf2 REQUIRED) find_package(tf2_msgs REQUIRED) @@ -57,6 +58,7 @@ target_link_libraries(buffer_server PRIVATE ament_cmake_ros_core::ament_ros_defaults ${PROJECT_NAME} rclcpp::rclcpp + tf2::tf2 ) add_library(static_transform_broadcaster_node SHARED @@ -69,6 +71,7 @@ target_include_directories(static_transform_broadcaster_node PUBLIC target_link_libraries(static_transform_broadcaster_node PUBLIC ${PROJECT_NAME} geometry_msgs::geometry_msgs + rcl_interfaces::rcl_interfaces rclcpp::rclcpp tf2_msgs::tf2_msgs) target_link_libraries(static_transform_broadcaster_node PRIVATE @@ -84,6 +87,7 @@ target_link_libraries(static_transform_publisher PRIVATE ament_cmake_ros_core::ament_ros_defaults ${PROJECT_NAME} rclcpp::rclcpp + rcutils::rcutils static_transform_broadcaster_node tf2::tf2 ) @@ -94,7 +98,9 @@ add_executable(tf2_echo target_link_libraries(tf2_echo PRIVATE ament_cmake_ros_core::ament_ros_defaults ${PROJECT_NAME} + geometry_msgs::geometry_msgs rclcpp::rclcpp + tf2::tf2 ) add_executable(tf2_monitor @@ -104,6 +110,7 @@ target_link_libraries(tf2_monitor PRIVATE ament_cmake_ros_core::ament_ros_defaults ${PROJECT_NAME} rclcpp::rclcpp + tf2::tf2 tf2_msgs::tf2_msgs ) diff --git a/tf2_ros/package.xml b/tf2_ros/package.xml index 7371b7e18..2f828e6b0 100644 --- a/tf2_ros/package.xml +++ b/tf2_ros/package.xml @@ -27,6 +27,7 @@ rclcpp_action rclcpp_components rcpputils + rcutils tf2 tf2_msgs diff --git a/tf2_ros/src/buffer_server_main.cpp b/tf2_ros/src/buffer_server_main.cpp index b7d082af8..50c8f621c 100644 --- a/tf2_ros/src/buffer_server_main.cpp +++ b/tf2_ros/src/buffer_server_main.cpp @@ -37,11 +37,15 @@ #include +#include "tf2/time.hpp" + #include "tf2_ros/buffer.hpp" #include "tf2_ros/buffer_server.hpp" #include "tf2_ros/transform_listener.hpp" -#include "rclcpp/rclcpp.hpp" +#include "rclcpp/executors/single_threaded_executor.hpp" +#include "rclcpp/node.hpp" +#include "rclcpp/utilities.hpp" int main(int argc, char ** argv) { diff --git a/tf2_ros/src/create_timer_ros.cpp b/tf2_ros/src/create_timer_ros.cpp index 36258387d..6325e4826 100644 --- a/tf2_ros/src/create_timer_ros.cpp +++ b/tf2_ros/src/create_timer_ros.cpp @@ -32,11 +32,11 @@ #include #include #include +#include #include "tf2/time.hpp" #include "rclcpp/create_timer.hpp" -#include "rclcpp/rclcpp.hpp" namespace tf2_ros { diff --git a/tf2_ros/src/static_transform_broadcaster.cpp b/tf2_ros/src/static_transform_broadcaster.cpp index 35fe3f2de..dccec778e 100644 --- a/tf2_ros/src/static_transform_broadcaster.cpp +++ b/tf2_ros/src/static_transform_broadcaster.cpp @@ -35,7 +35,6 @@ #include #include "geometry_msgs/msg/transform_stamped.hpp" -#include "rclcpp/rclcpp.hpp" #include "tf2_msgs/msg/tf_message.hpp" namespace tf2_ros diff --git a/tf2_ros/src/static_transform_broadcaster_node.cpp b/tf2_ros/src/static_transform_broadcaster_node.cpp index 0647404d8..cb2aca205 100644 --- a/tf2_ros/src/static_transform_broadcaster_node.cpp +++ b/tf2_ros/src/static_transform_broadcaster_node.cpp @@ -27,13 +27,20 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include #include #include +#include "geometry_msgs/msg/transform_stamped.hpp" +#include "rcl_interfaces/msg/parameter_descriptor.hpp" + +#include "tf2_ros/static_transform_broadcaster.hpp" #include "tf2_ros/static_transform_broadcaster_node.hpp" -#include "rclcpp/rclcpp.hpp" + +#include "rclcpp/logging.hpp" +#include "rclcpp/node_options.hpp" namespace { diff --git a/tf2_ros/src/static_transform_broadcaster_program.cpp b/tf2_ros/src/static_transform_broadcaster_program.cpp index 6c5effebb..a1779a237 100644 --- a/tf2_ros/src/static_transform_broadcaster_program.cpp +++ b/tf2_ros/src/static_transform_broadcaster_program.cpp @@ -40,7 +40,12 @@ #include "tf2/LinearMath/Quaternion.hpp" #include "tf2/LinearMath/Vector3.hpp" -#include "rclcpp/rclcpp.hpp" +#include "rcutils/logging_macros.h" + +#include "rclcpp/executors.hpp" +#include "rclcpp/logging.hpp" +#include "rclcpp/node_options.hpp" +#include "rclcpp/utilities.hpp" struct Option { diff --git a/tf2_ros/src/tf2_echo.cpp b/tf2_ros/src/tf2_echo.cpp index 9cd9411ad..162b8300e 100644 --- a/tf2_ros/src/tf2_echo.cpp +++ b/tf2_ros/src/tf2_echo.cpp @@ -35,17 +35,33 @@ #endif #include +#include #include #include +#include #include #include #include #include +#include "geometry_msgs/msg/transform_stamped.hpp" + +#include "tf2/LinearMath/Matrix3x3.hpp" +#include "tf2/LinearMath/Quaternion.hpp" +#include "tf2/LinearMath/Scalar.hpp" +#include "tf2/exceptions.hpp" +#include "tf2/time.hpp" + #include "tf2_ros/buffer.hpp" +#include "tf2_ros/buffer_interface.hpp" #include "tf2_ros/transform_listener.hpp" -#include "rclcpp/rclcpp.hpp" +#include "rclcpp/clock.hpp" +#include "rclcpp/logging.hpp" +#include "rclcpp/node.hpp" +#include "rclcpp/rate.hpp" +#include "rclcpp/time.hpp" +#include "rclcpp/utilities.hpp" class echoListener { diff --git a/tf2_ros/src/tf2_monitor.cpp b/tf2_ros/src/tf2_monitor.cpp index 43ff8e784..70747f847 100644 --- a/tf2_ros/src/tf2_monitor.cpp +++ b/tf2_ros/src/tf2_monitor.cpp @@ -31,18 +31,34 @@ /** \author Wim Meeussen */ #include +#include +#include #include +#include #include #include +#include +#include #include #include #include +#include "tf2/buffer_core.hpp" +#include "tf2/exceptions.hpp" +#include "tf2/time.hpp" + #include "tf2_ros/buffer.hpp" +#include "tf2_ros/buffer_interface.hpp" #include "tf2_ros/transform_listener.hpp" #include "tf2_ros/qos.hpp" -#include "rclcpp/rclcpp.hpp" +#include "rclcpp/clock.hpp" +#include "rclcpp/executors.hpp" +#include "rclcpp/logging.hpp" +#include "rclcpp/node.hpp" +#include "rclcpp/subscription.hpp" +#include "rclcpp/utilities.hpp" + #include "tf2_msgs/msg/tf_message.hpp" class TFMonitor diff --git a/tf2_ros/src/transform_broadcaster.cpp b/tf2_ros/src/transform_broadcaster.cpp index f4a2566ac..894a8d2ff 100644 --- a/tf2_ros/src/transform_broadcaster.cpp +++ b/tf2_ros/src/transform_broadcaster.cpp @@ -35,7 +35,6 @@ #include #include "geometry_msgs/msg/transform_stamped.hpp" -#include "rclcpp/rclcpp.hpp" #include "tf2_msgs/msg/tf_message.hpp" namespace tf2_ros diff --git a/tf2_ros/test/listener_unittest.cpp b/tf2_ros/test/listener_unittest.cpp index cdb8d5c2c..db7f38462 100644 --- a/tf2_ros/test/listener_unittest.cpp +++ b/tf2_ros/test/listener_unittest.cpp @@ -28,17 +28,25 @@ */ #include -#include #include #include #include "gtest/gtest.h" +#include "builtin_interfaces/msg/time.hpp" +#include "geometry_msgs/msg/transform_stamped.hpp" + +#include "tf2/buffer_core.hpp" +#include "tf2/time.hpp" + #include "tf2_ros/buffer.hpp" #include "tf2_ros/transform_listener.hpp" -#include "rclcpp/rclcpp.hpp" -#include "builtin_interfaces/msg/time.hpp" +#include "rclcpp/clock.hpp" +#include "rclcpp/executors/single_threaded_executor.hpp" +#include "rclcpp/node.hpp" +#include "rclcpp/time.hpp" +#include "rclcpp/utilities.hpp" TEST(tf2_ros_test_listener, transform_listener) { diff --git a/tf2_ros/test/message_filter_test.cpp b/tf2_ros/test/message_filter_test.cpp index edf17c882..09c8c3165 100644 --- a/tf2_ros/test/message_filter_test.cpp +++ b/tf2_ros/test/message_filter_test.cpp @@ -28,16 +28,24 @@ */ #include +#include #include +#include +#include #include #include +#include #include #include "gtest/gtest.h" +#include "geometry_msgs/msg/point_stamped.hpp" +#include "geometry_msgs/msg/transform_stamped.hpp" + #include "message_filters/subscriber.hpp" -#include "message_filters/simple_filter.hpp" -#include "message_filters/message_traits.hpp" + +#include "tf2/buffer_core.hpp" +#include "tf2/time.hpp" #include "tf2_ros/buffer.hpp" #include "tf2_ros/create_timer_ros.hpp" @@ -45,9 +53,17 @@ #include "tf2_ros/static_transform_broadcaster.hpp" #include "tf2_ros/transform_listener.hpp" -#include "rclcpp/rclcpp.hpp" -#include "geometry_msgs/msg/point_stamped.hpp" -#include "geometry_msgs/msg/transform_stamped.hpp" +#include "rclcpp/clock.hpp" +#include "rclcpp/duration.hpp" +#include "rclcpp/executors/single_threaded_executor.hpp" +#include "rclcpp/node.hpp" +#include "rclcpp/node_interfaces/node_clock_interface.hpp" +#include "rclcpp/node_interfaces/node_interfaces.hpp" +#include "rclcpp/node_interfaces/node_logging_interface.hpp" +#include "rclcpp/publisher.hpp" +#include "rclcpp/qos.hpp" +#include "rclcpp/time.hpp" +#include "rclcpp/utilities.hpp" std::atomic filter_callback_fired = 0; void filter_callback(const geometry_msgs::msg::PointStamped & msg) diff --git a/tf2_ros/test/node_wrapper.hpp b/tf2_ros/test/node_wrapper.hpp index a33870001..2cd4233e9 100644 --- a/tf2_ros/test/node_wrapper.hpp +++ b/tf2_ros/test/node_wrapper.hpp @@ -33,8 +33,12 @@ #include #include -#include "gtest/gtest.h" -#include "rclcpp/rclcpp.hpp" +#include "rclcpp/node.hpp" +#include "rclcpp/node_interfaces/node_base_interface.hpp" +#include "rclcpp/node_interfaces/node_logging_interface.hpp" +#include "rclcpp/node_interfaces/node_parameters_interface.hpp" +#include "rclcpp/node_interfaces/node_services_interface.hpp" +#include "rclcpp/node_interfaces/node_topics_interface.hpp" class NodeWrapper { diff --git a/tf2_ros/test/test_buffer.cpp b/tf2_ros/test/test_buffer.cpp index 2f7848c29..05744efae 100644 --- a/tf2_ros/test/test_buffer.cpp +++ b/tf2_ros/test/test_buffer.cpp @@ -28,16 +28,33 @@ */ #include +#include +#include #include #include #include #include +#include #include #include +#include #include "gtest/gtest.h" -#include "rclcpp/rclcpp.hpp" +#include "builtin_interfaces/msg/time.hpp" +#include "geometry_msgs/msg/transform_stamped.hpp" +#include "geometry_msgs/msg/velocity_stamped.hpp" + +#include "tf2/time.hpp" + +#include "rclcpp/clock.hpp" +#include "rclcpp/duration.hpp" +#include "rclcpp/node.hpp" +#include "rclcpp/node_interfaces/node_base_interface.hpp" +#include "rclcpp/node_interfaces/node_interfaces.hpp" +#include "rclcpp/node_interfaces/node_timers_interface.hpp" +#include "rclcpp/time.hpp" +#include "rclcpp/utilities.hpp" #include "tf2_ros/buffer.hpp" #include "tf2_ros/create_timer_interface.hpp" diff --git a/tf2_ros/test/test_buffer_client.cpp b/tf2_ros/test/test_buffer_client.cpp index e1117d7c4..2b7b9b96a 100644 --- a/tf2_ros/test/test_buffer_client.cpp +++ b/tf2_ros/test/test_buffer_client.cpp @@ -29,16 +29,25 @@ #include #include -#include #include #include #include #include "gtest/gtest.h" +#include "geometry_msgs/msg/transform.hpp" + +#include "tf2/time.hpp" + #include "tf2_msgs/action/lookup_transform.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_action/rclcpp_action.hpp" + +#include "rclcpp/executors/single_threaded_executor.hpp" +#include "rclcpp/node.hpp" +#include "rclcpp/utilities.hpp" +#include "rclcpp_action/create_server.hpp" +#include "rclcpp_action/server.hpp" +#include "rclcpp_action/server_goal_handle.hpp" +#include "rclcpp_action/types.hpp" #include "tf2_ros/buffer.hpp" #include "tf2_ros/buffer_client.hpp" diff --git a/tf2_ros/test/test_buffer_server.cpp b/tf2_ros/test/test_buffer_server.cpp index 13c4b00f9..57d5b7291 100644 --- a/tf2_ros/test/test_buffer_server.cpp +++ b/tf2_ros/test/test_buffer_server.cpp @@ -34,9 +34,17 @@ #include "gtest/gtest.h" +#include "geometry_msgs/msg/transform.hpp" +#include "geometry_msgs/msg/transform_stamped.hpp" + #include "tf2_msgs/action/lookup_transform.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_action/rclcpp_action.hpp" + +#include "rclcpp/executors/single_threaded_executor.hpp" +#include "rclcpp/node.hpp" +#include "rclcpp/utilities.hpp" +#include "rclcpp_action/client.hpp" +#include "rclcpp_action/client_goal_handle.hpp" +#include "rclcpp_action/create_client.hpp" #include "tf2_ros/buffer.hpp" #include "tf2_ros/buffer_server.hpp" diff --git a/tf2_ros/test/test_static_transform_broadcaster.cpp b/tf2_ros/test/test_static_transform_broadcaster.cpp index 36b1ae98d..4456944fc 100644 --- a/tf2_ros/test/test_static_transform_broadcaster.cpp +++ b/tf2_ros/test/test_static_transform_broadcaster.cpp @@ -33,6 +33,14 @@ #include +#include "rclcpp/executors/single_threaded_executor.hpp" +#include "rclcpp/node.hpp" +#include "rclcpp/node_interfaces/node_interfaces.hpp" +#include "rclcpp/node_interfaces/node_parameters_interface.hpp" +#include "rclcpp/node_interfaces/node_topics_interface.hpp" +#include "rclcpp/node_options.hpp" +#include "rclcpp/utilities.hpp" + #include "node_wrapper.hpp" class CustomNode : public rclcpp::Node diff --git a/tf2_ros/test/test_transform_broadcaster.cpp b/tf2_ros/test/test_transform_broadcaster.cpp index e70f242ca..ea9da392f 100644 --- a/tf2_ros/test/test_transform_broadcaster.cpp +++ b/tf2_ros/test/test_transform_broadcaster.cpp @@ -33,6 +33,12 @@ #include +#include "rclcpp/node.hpp" +#include "rclcpp/node_interfaces/node_interfaces.hpp" +#include "rclcpp/node_interfaces/node_parameters_interface.hpp" +#include "rclcpp/node_interfaces/node_topics_interface.hpp" +#include "rclcpp/utilities.hpp" + #include "node_wrapper.hpp" class CustomNode : public rclcpp::Node diff --git a/tf2_ros/test/test_transform_listener.cpp b/tf2_ros/test/test_transform_listener.cpp index 4077e9217..e14e12196 100644 --- a/tf2_ros/test/test_transform_listener.cpp +++ b/tf2_ros/test/test_transform_listener.cpp @@ -37,6 +37,11 @@ #include #include +#include "rclcpp/clock.hpp" +#include "rclcpp/executors/single_threaded_executor.hpp" +#include "rclcpp/node.hpp" +#include "rclcpp/node_options.hpp" +#include "rclcpp/utilities.hpp" #include "node_wrapper.hpp" diff --git a/tf2_ros/test/time_reset_test.cpp b/tf2_ros/test/time_reset_test.cpp index 145ce632c..113c83c40 100644 --- a/tf2_ros/test/time_reset_test.cpp +++ b/tf2_ros/test/time_reset_test.cpp @@ -27,7 +27,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include #include #include "gtest/gtest.h" @@ -37,7 +36,13 @@ #include "tf2_ros/transform_listener.hpp" #include "builtin_interfaces/msg/time.hpp" -#include "rclcpp/rclcpp.hpp" +#include "geometry_msgs/msg/transform_stamped.hpp" +#include "rclcpp/clock.hpp" +#include "rclcpp/executors/single_threaded_executor.hpp" +#include "rclcpp/node.hpp" +#include "rclcpp/rate.hpp" +#include "rclcpp/time.hpp" +#include "rclcpp/utilities.hpp" #include "rosgraph_msgs/msg/clock.hpp" void spin_for_a_second(std::shared_ptr & node) diff --git a/tf2_ros/test/velocity_test.cpp b/tf2_ros/test/velocity_test.cpp index a77e338eb..8b72a7805 100644 --- a/tf2_ros/test/velocity_test.cpp +++ b/tf2_ros/test/velocity_test.cpp @@ -37,7 +37,11 @@ #include "tf2_ros/create_timer_ros.hpp" #include "tf2_ros/transform_listener.hpp" +#include "rclcpp/clock.hpp" +#include "rclcpp/duration.hpp" #include "rclcpp/node.hpp" +#include "rclcpp/time.hpp" +#include "rclcpp/utilities.hpp" // #include "tf/LinearMath/Vector3.h" diff --git a/tf2_sensor_msgs/test/test_tf2_sensor_msgs.cpp b/tf2_sensor_msgs/test/test_tf2_sensor_msgs.cpp index cde898a08..cbf5657e2 100644 --- a/tf2_sensor_msgs/test/test_tf2_sensor_msgs.cpp +++ b/tf2_sensor_msgs/test/test_tf2_sensor_msgs.cpp @@ -35,7 +35,8 @@ #include "builtin_interfaces/msg/time.hpp" #include "geometry_msgs/msg/pose_stamped.hpp" -#include "rclcpp/rclcpp.hpp" +#include "rclcpp/clock.hpp" +#include "rclcpp/time.hpp" #include "sensor_msgs/point_cloud2_iterator.hpp" #include "tf2_sensor_msgs/tf2_sensor_msgs.hpp" From 132c518a76be43dc8161a6e096b2c97f465e4809 Mon Sep 17 00:00:00 2001 From: Alejandro Hernandez Cordero Date: Thu, 10 Sep 2026 14:19:15 +0200 Subject: [PATCH 2/2] Removed rcutils dependency Signed-off-by: Alejandro Hernandez Cordero --- tf2_ros/CMakeLists.txt | 2 -- tf2_ros/include/tf2_ros/message_filter.hpp | 9 +++++---- tf2_ros/package.xml | 1 - tf2_ros/src/static_transform_broadcaster_program.cpp | 7 ++++--- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/tf2_ros/CMakeLists.txt b/tf2_ros/CMakeLists.txt index aaf12da32..f8337695e 100644 --- a/tf2_ros/CMakeLists.txt +++ b/tf2_ros/CMakeLists.txt @@ -16,7 +16,6 @@ find_package(rclcpp REQUIRED) find_package(rclcpp_action REQUIRED) find_package(rclcpp_components REQUIRED) find_package(rcpputils REQUIRED) -find_package(rcutils REQUIRED) find_package(tf2 REQUIRED) find_package(tf2_msgs REQUIRED) @@ -87,7 +86,6 @@ target_link_libraries(static_transform_publisher PRIVATE ament_cmake_ros_core::ament_ros_defaults ${PROJECT_NAME} rclcpp::rclcpp - rcutils::rcutils static_transform_broadcaster_node tf2::tf2 ) diff --git a/tf2_ros/include/tf2_ros/message_filter.hpp b/tf2_ros/include/tf2_ros/message_filter.hpp index 43122661d..7c3dfc43f 100644 --- a/tf2_ros/include/tf2_ros/message_filter.hpp +++ b/tf2_ros/include/tf2_ros/message_filter.hpp @@ -62,6 +62,7 @@ #include "builtin_interfaces/msg/time.hpp" #include "rclcpp/clock.hpp" #include "rclcpp/duration.hpp" +#include "rclcpp/logger.hpp" #include "rclcpp/logging.hpp" #include "rclcpp/time.hpp" #include "rclcpp/node_interfaces/node_interfaces.hpp" @@ -69,14 +70,14 @@ #include "rclcpp/node_interfaces/get_node_clock_interface.hpp" #define TF2_ROS_MESSAGEFILTER_DEBUG(fmt, ...) \ - RCUTILS_LOG_DEBUG_NAMED( \ - "tf2_ros_message_filter", \ + RCLCPP_DEBUG( \ + rclcpp::get_logger("tf2_ros_message_filter"), \ std::string(std::string("MessageFilter [target=%s]: ") + std::string(fmt)).c_str(), \ getTargetFramesString().c_str(), __VA_ARGS__) #define TF2_ROS_MESSAGEFILTER_WARN(fmt, ...) \ - RCUTILS_LOG_WARN_NAMED( \ - "tf2_ros_message_filter", \ + RCLCPP_WARN( \ + rclcpp::get_logger("tf2_ros_message_filter"), \ std::string(std::string("MessageFilter [target=%s]: ") + std::string(fmt)).c_str(), \ getTargetFramesString().c_str(), __VA_ARGS__) diff --git a/tf2_ros/package.xml b/tf2_ros/package.xml index 2f828e6b0..7371b7e18 100644 --- a/tf2_ros/package.xml +++ b/tf2_ros/package.xml @@ -27,7 +27,6 @@ rclcpp_action rclcpp_components rcpputils - rcutils tf2 tf2_msgs diff --git a/tf2_ros/src/static_transform_broadcaster_program.cpp b/tf2_ros/src/static_transform_broadcaster_program.cpp index a1779a237..e69cb020a 100644 --- a/tf2_ros/src/static_transform_broadcaster_program.cpp +++ b/tf2_ros/src/static_transform_broadcaster_program.cpp @@ -40,9 +40,8 @@ #include "tf2/LinearMath/Quaternion.hpp" #include "tf2/LinearMath/Vector3.hpp" -#include "rcutils/logging_macros.h" - #include "rclcpp/executors.hpp" +#include "rclcpp/logger.hpp" #include "rclcpp/logging.hpp" #include "rclcpp/node_options.hpp" #include "rclcpp/utilities.hpp" @@ -305,7 +304,9 @@ int main(int argc, char ** argv) std::string ret = parse_args(args, help, rotation, translation, frame_id, child_frame_id); if (ret != "") { - RCUTILS_LOG_ERROR("error parsing command line arguments: %s", ret.c_str()); + RCLCPP_ERROR( + rclcpp::get_logger("static_transform_publisher"), + "error parsing command line arguments: %s", ret.c_str()); print_usage(); return 1; }